packages feed

ghclive 0.1.0.0 → 0.1.0.1

raw patch · 82 files changed

+29404/−3 lines, 82 filessetup-changedbinary-added

Files

+ README.md view
@@ -0,0 +1,45 @@+ghclive+=======++Google Summer of Code 2012 project, GHCi for the web++Requirements+------------+Chrome 21.x+Firefox 14.x++Does not work with Firefox 10++Quick start installation+------------------------+`git clone https://github.com/shapr/ghclive.git && cd ghclive && cabal install && ghclive` +then point your browser to [http://localhost:3000](http://localhost:3000)++Here's some source code to paste into the editor buffer:+```haskell+import Diagrams.Prelude+import Prelude+import Network.Web.GHCLive.Display++hilbert = iterate expand mempty where+  expand t = alignBL $ hcat [u, hrule 1, reflectX u] where+             u = vcat [t, vrule 1, rotateBy (3/4) t]++ex = pad 1.1 . centerXY . lw 0.05 $ hilbert!!5+```++then type ex in the Haskell expression buffer and hit enter!++Prototypes+----------+The prototypes subdirectory contains several quick hacks demonstrating various concepts.++* [hintdownloadexecute](ghclive/tree/master/prototypes/hintdownloadexecute) is hint's [example.hs](http://code.haskell.org/hint/devel/examples/examples.hs) modified to download and execute Demo.main from http://www.scannedinavian.com/~shae/Demo.hs .+* [scottywebexecute](ghclive/tree/master/prototypes/scottywebexecute) is the basic.hs example from [scotty](https://github.com/xich/scotty/) modified only slightly to prove to myself that I understand the code.+* [hintdownloadexecute](ghclive/tree/master/prototypes/hintdownloadexecute) is the front end from http://haskell.handcraft.com/ modified to have scotty and hint as a backend instead of calling tryhaskell.org.+* [scottyjsonclock](ghclive/tree/master/prototypes/scottyjsonclock) was a quick refresher for how AJAX works in Haskell.+* [hintpostexecute](ghclive/tree/master/prototypes/hintpostexecute) uses all the previous prototypes to give a very basic ghci in the browser with Main.hs loaded from any http URL+* [jqueryconsole](ghclive/tree/master/prototypes/jqueryconsole) extends the above prototypes to use [Chris Done](https://github.com/chrisdone/)‘s [jquery-console](https://github.com/chrisdone/jquery-console) as famously seen in [tryhaskell.org](http://tryhaskell.org/), giving a more GHCi-like result+* [jqueryraw](ghclive/tree/master/prototypes/jqueryraw) is much simpler in that it uses jquery but not jquery-console.+* [svgdemo](ghclive/tree/master/prototypes/svgdemo) demonstrates SVG being returned from diagrams+* [multimport](ghclive/tree/master/prototypes/multimport) takes any number of imports from a textbox. Each line is either the http address of a file to load, or a module name to bring in scope (Data.Char).
Setup.hs view
@@ -1,2 +1,3 @@+#!/usr/bin/env runhaskell import Distribution.Simple main = defaultMain
+ cache/Helper.hs view
@@ -0,0 +1,26 @@+module Helper where+{-+hint requires that setTopLevelModules be given only interpreted modules+Thus this file exists to import Diagrams and Blaze and still be interpreted+-}++import           Diagrams.Backend.SVG+import           Diagrams.Prelude+import           Network.Web.GHCLive.Display+import           Text.Blaze.Internal+import           Prelude++spike :: Trail R2+spike = fromOffsets . map r2 $ [(1,3), (1,-3)]++burst = mconcat . take 13 . iterate (rotateBy (-1/13)) $ spike++colors = cycle [aqua, orange, deeppink, blueviolet, crimson, darkgreen]++example :: Diagram Diagrams.Backend.SVG.SVG R2+example = lw 1.0 . mconcat  . zipWith lc colors . map stroke . explodeTrail origin $ burst++starburst = renderDia SVG (SVGOptions "output.file" (Dims 200 200)) example++dia :: Diagram Diagrams.Backend.SVG.SVG R2 -> Diagram Diagrams.Backend.SVG.SVG R2+dia = id
ghclive.cabal view
@@ -5,11 +5,11 @@ -- PVP summary:      +-+------- breaking API changes --                   | | +----- non-breaking API additions --                   | | | +--- code changes with no API change-version:             0.1.0.0+version:             0.1.0.1 synopsis:            Interactive Haskell interpreter in a browser. Description:-                     ghclive is an interactive Haskell interactive in a browser.-                     It can do most of what ghci does, with a few extra abilities.+                     ghclive is an interactive multi-user Haskell interpreter in a browser.+                     It mixes a pastebin with an interpreter and is designed for remote teaching.  homepage:            http://github.com/shapr/ghclive/ license:             BSD3@@ -19,6 +19,91 @@ category:            Web, Compilers/Interpreters, Application build-type:          Simple cabal-version:       >=1.8+extra-source-files:  README.md+                     cache/Helper.hs+                     src-main/SignalHandlers.hs+                     src-main/SeqMap.hs+                     cache/Helper.hs+                     src-main/Main.hs+                     src-main/SeqMap.hs+                     src-main/SignalHandlers.hs+                     static/codemirror/LICENSE+                     static/codemirror/README.md+                     static/codemirror/index.html+                     static/codemirror/keymap/emacs.js+                     static/codemirror/keymap/vim.js+                     static/codemirror/lib/codemirror.css+                     static/codemirror/lib/codemirror.js+                     static/codemirror/lib/util/closetag.js+                     static/codemirror/lib/util/dialog.css+                     static/codemirror/lib/util/dialog.js+                     static/codemirror/lib/util/foldcode.js+                     static/codemirror/lib/util/formatting.js+                     static/codemirror/lib/util/javascript-hint.js+                     static/codemirror/lib/util/loadmode.js+                     static/codemirror/lib/util/match-highlighter.js+                     static/codemirror/lib/util/multiplex.js+                     static/codemirror/lib/util/overlay.js+                     static/codemirror/lib/util/pig-hint.js+                     static/codemirror/lib/util/runmode.js+                     static/codemirror/lib/util/search.js+                     static/codemirror/lib/util/searchcursor.js+                     static/codemirror/lib/util/simple-hint.css+                     static/codemirror/lib/util/simple-hint.js+                     static/codemirror/lib/util/xml-hint.js+                     static/codemirror/mode/haskell/haskell.js+                     static/codemirror/mode/haskell/index.html+                     static/codemirror/package.json+                     static/codemirror/test/driver.js+                     static/codemirror/test/index.html+                     static/codemirror/test/mode_test.css+                     static/codemirror/test/mode_test.js+                     static/codemirror/test/test.js+                     static/codemirror/theme/ambiance.css+                     static/codemirror/theme/blackboard.css+                     static/codemirror/theme/cobalt.css+                     static/codemirror/theme/eclipse.css+                     static/codemirror/theme/elegant.css+                     static/codemirror/theme/erlang-dark.css+                     static/codemirror/theme/lesser-dark.css+                     static/codemirror/theme/monokai.css+                     static/codemirror/theme/neat.css+                     static/codemirror/theme/night.css+                     static/codemirror/theme/rubyblue.css+                     static/codemirror/theme/vibrant-ink.css+                     static/codemirror/theme/xq-dark.css+                     static/document.js+                     static/foo.css+                     static/ghclive.js+                     static/grippie.png+                     static/images/ui-bg_flat_65_ffffff_40x100.png+                     static/images/ui-bg_glass_40_111111_1x400.png+                     static/images/ui-bg_glass_55_1c1c1c_1x400.png+                     static/images/ui-bg_highlight-hard_100_f9f9f9_1x100.png+                     static/images/ui-bg_highlight-hard_40_aaaaaa_1x100.png+                     static/images/ui-bg_highlight-soft_50_aaaaaa_1x100.png+                     static/images/ui-bg_inset-hard_45_cd0a0a_1x100.png+                     static/images/ui-bg_inset-hard_55_ffeb80_1x100.png+                     static/images/ui-icons_222222_256x240.png+                     static/images/ui-icons_4ca300_256x240.png+                     static/images/ui-icons_bbbbbb_256x240.png+                     static/images/ui-icons_ededed_256x240.png+                     static/images/ui-icons_ffcf29_256x240.png+                     static/images/ui-icons_ffffff_256x240.png+                     static/jquery-ui-1.8.23.custom.css+                     static/jquery-ui-1.8.23.custom.min.js+                     static/jquery.js+                     static/jquery.layout-latest.js+                     static/jquery.scrollTo.js+                     static/layout/changelog.txt+                     static/layout/example.html+                     static/layout/jquery.js+                     static/layout/jquery.layout.js+                     static/layout/jquery.layout.min.js+                     static/layout/jquery.ui.all.js+                     static/layout/nested.html+                     static/layout/simple.html+ Library   build-depends:     aeson > 0.6 && < 0.7,@@ -65,3 +150,6 @@     base >= 4 && < 5    hs-source-dirs:  src-main+source-repository    head+  type:              git+  location:          http://github.com/shapr/ghclive
+ src-main/SeqMap.hs view
@@ -0,0 +1,213 @@+{-+  A sequence with lookuppable keys+-}+module SeqMap ( SeqMap+              , fromList+              , toList+              , toListFromTo+              , toListTo+              , toListFrom+              , values+              , keys+              , singleton+              , remove+              , removeAll+              , null+              , size+              , lookup+              , insertAfter+              , insertBefore+              , adjust+              , first+              , last+              , prev+              , next+              , (|>)+              , (<|)+              ) where++import           Prelude hiding (lookup, last, null)+import qualified Prelude++import           Control.Monad ((>=>))++import           Data.List (foldl')+import qualified Data.Map as M+import           Data.Map (Map)+import           Data.Maybe (fromJust, isJust)+import           Data.Monoid+import qualified Data.Set as S+import           Data.Set (Set)++data SeqMap k v = SeqMapM k k (Map k (SM k v))+                | SeqMapE+  deriving Show++data SM k v = SM+    { smVal :: v+    , smPrev :: Maybe k+    , smNext :: Maybe k+    } deriving Show++null SeqMapE = True+null _       = False++size SeqMapE         = 0+size (SeqMapM _ _ m) = M.size m++singleton :: k -> v -> SeqMap k v+singleton k v = SeqMapM k k (M.singleton k $ SM v Nothing Nothing)++fromList :: Ord k => [(k,v)] -> SeqMap k v+fromList [] = SeqMapE+fromList xs =+    let xs'  = nubBy' fst xs+        vs   = zipWith3 (\(k,v) p n -> (k, SM v p n)) xs'+                        (Nothing : map (Just . fst) xs') (map (Just . fst) (tail xs') ++ [Nothing])+    in  SeqMapM (fst . head $ xs') (fst . Prelude.last $ xs') (M.fromList vs)++toList :: Ord k => SeqMap k v -> [(k,v)]+toList SeqMapE = []+toList (SeqMapM f _ m) = go (Just f)+    where+      go (Just k) = let v = fromJust (M.lookup k m) in (k, smVal v) : go (smNext v)+      go Nothing  = []+++toListFrom :: Ord k => k -> SeqMap k v -> [(k,v)]+toListFrom from sm@(SeqMapM _ l _) = toListFromTo from l sm+toListFrom _    _                  = []++toListTo :: Ord k => k -> SeqMap k v -> [(k,v)]+toListTo to sm@(SeqMapM f _ _) = toListFromTo f to sm+toListTo _  _                  = []++toListFromTo :: Ord k => k -> k -> SeqMap k v -> [(k,v)]+toListFromTo from to (SeqMapM _ _ m)+    | isJust (M.lookup from m) = go (Just from)+    | otherwise                = []+  where+    go (Just k) = let next = if k == to then [] else go (smNext v)+                      v    = fromJust (M.lookup k m)+                  in (k, smVal v) : next++    go Nothing  = []+toListFromTo _ _ SeqMapE = []++values :: Ord k => SeqMap k v -> [v]+values m = map snd (toList m)++keys :: Ord k => SeqMap k v -> [k]+keys m = map fst (toList m)++removeAll :: Ord k => [k] -> SeqMap k v -> SeqMap k v+removeAll ks m = foldl' (flip remove) m ks++remove :: Ord k => k -> SeqMap k v -> SeqMap k v+remove _ SeqMapE = SeqMapE+remove k sm@(SeqMapM f l m)+    | M.null m'                       = SeqMapE+    | Just (SM v p n) <- M.lookup k m = let (f', adjustp) = if f == k+                                                             then (fromJust n, id)+                                                             else (f, M.adjust (setNext n) (fromJust p))+                                            (l', adjustn) = if l == k+                                                             then (fromJust p, id)+                                                             else (l, M.adjust (setPrev p) (fromJust n))+                                        in SeqMapM f' l' (adjustp . adjustn $ m')+    | otherwise                       = sm+  where+    m' = M.delete k m++lookup :: Ord k => k -> SeqMap k v -> Maybe v+lookup k (SeqMapM _ _ m) = fmap smVal (M.lookup k m)+lookup _ _               = Nothing++first :: SeqMap k v -> Maybe k+first (SeqMapM f _ _) = Just f+first _               = Nothing++last :: SeqMap k v -> Maybe k+last (SeqMapM _ l _) = Just l+last _               = Nothing++next :: Ord k => k -> SeqMap k v -> Maybe k+next k = smLookup k >=> smNext++prev :: Ord k => k -> SeqMap k v -> Maybe k+prev k = smLookup k >=> smPrev++smLookup :: Ord k => k -> SeqMap k v -> Maybe (SM k v)+smLookup k (SeqMapM _ _ m) = M.lookup k m+smLookup _ _               = Nothing+++-- | insert (k,v) before k0, no-op if k0 is not present, if k == k0 then the value is just replaced with v+insertBefore :: Ord k => k -> (k,v) -> SeqMap k v -> SeqMap k v+insertBefore k0 (k,v) sm@(SeqMapM f l m)+                        | k == k0                              = SeqMapM f l $ M.adjust (setVal v) k m+                        | Just (SM v0 p0 n0) <- M.lookup k0 m' =+                            let m'' = case p0 of+                                        Nothing -> M.insert k0 (SM v0 (Just k) n0) .+                                                   M.insert k  (SM v  Nothing (Just k0))  $ m'+                                        Just p  -> M.adjust (setNext (Just k)) p .+                                                   M.insert k0 (SM v0 (Just k) n0) .+                                                   M.insert k  (SM v  (Just p) (Just k0)) $ m'+                            in SeqMapM (if isJust p0 then f else k) l m''+                        | otherwise                            = sm+    where+      m' = M.delete k m+insertBefore _ _ m = m+++-- | insert (k,v) after k0, no-op if k0 is not present+insertAfter :: Ord k => k -> (k,v) -> SeqMap k v -> SeqMap k v+insertAfter k0 (k,v) sm@(SeqMapM f l m)+                        | k == k0   = SeqMapM f l $ M.adjust (setVal v) k m+                        | Just (SM v0 p0 n0) <- M.lookup k0 m' =+                            let m'' = case n0 of+                                        Nothing -> M.insert k0 (SM v0 p0 (Just k)) .+                                                   M.insert k  (SM v  (Just k0) Nothing)  $ m'+                                        Just n  -> M.adjust (setPrev (Just k)) n .+                                                   M.insert k0 (SM v0 p0 (Just k)) .+                                                   M.insert k  (SM v  (Just k0) (Just n)) $ m'+                            in SeqMapM f (if isJust n0 then l else k) m''+                        | otherwise = sm+    where+      m' = M.delete k m+insertAfter _ _ m = m++adjust :: Ord k => (v -> v) -> k -> SeqMap k v -> SeqMap k v+adjust fun k (SeqMapM f l m) = SeqMapM f l (M.adjust (\(SM v p n) -> (SM (fun v) p n)) k m)+adjust _ _ SeqMapE         = SeqMapE++setVal  v (SM _ p n) = SM v p n+setPrev p (SM v _ n) = SM v p n+setNext n (SM v p _) = SM v p n++-- monoid instance removes duplicate keys from second part first+instance Ord k => Monoid (SeqMap k v) where+  mempty  = SeqMapE+  mappend sm0@(SeqMapM f0 l0 m0) sm1 =+    case removeAll (keys sm0) sm1 of+      SeqMapE          -> sm0+      SeqMapM f1 l1 m1 -> SeqMapM f0 l1 ( M.adjust (setNext (Just f1)) l0 .+                                          M.adjust (setPrev (Just l0)) f1 $+                                          M.union m0 m1+                                        )+  mappend SeqMapE sm = sm++-- 'tip' operators append a single value, if key exists somewhere else, it's removed first+(k,v) <| m = singleton k v <> remove k m++m |> (k,v) = remove k m <> singleton k v++--+nubBy' :: (Eq b, Ord b) => (a -> b) -> [a] -> [a]+nubBy' f xs = go xs S.empty+    where+      go [] _     = []+      go (x:xs) s | fx `S.member` s = go xs s+                  | otherwise       = x : go xs (S.insert fx s)+        where+          fx = f x+
+ src-main/SignalHandlers.hs view
@@ -0,0 +1,23 @@+{-# LANGUAGE CPP #-}++module SignalHandlers where++#if !defined(mingw32_HOST_OS)++import System.Posix.Signals+import Control.Concurrent+import Control.Monad++restoreHandlers :: IO ()+restoreHandlers = do+    mapM_ restore [sigQUIT, sigINT, sigHUP, sigTERM]+    putStrLn "" -- for some reason, restoring handlers often fails without this+  where+    restore s  = installHandler s Default Nothing++#else++restoreHandlers :: IO ()+restoreHandlers = return ()++#endif
+ static/codemirror/LICENSE view
@@ -0,0 +1,23 @@+Copyright (C) 2012 by Marijn Haverbeke <marijnh@gmail.com>++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.++Please note that some subdirectories of the CodeMirror distribution+include their own LICENSE files, and are released under different+licences.
+ static/codemirror/README.md view
@@ -0,0 +1,8 @@+# CodeMirror 2++CodeMirror is a JavaScript component that provides a code editor in+the browser. When a mode is available for the language you are coding+in, it will color your code, and optionally help with indentation.++The project page is http://codemirror.net+The manual is at http://codemirror.net/doc/manual.html
+ static/codemirror/index.html view
@@ -0,0 +1,453 @@+<!doctype html>+<html>+  <head>+    <title>CodeMirror</title>+    <link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Droid+Sans|Droid+Sans:bold"/>+    <link rel="stylesheet" type="text/css" href="doc/docs.css"/>+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>+    <link rel="alternate" href="http://twitter.com/statuses/user_timeline/242283288.rss" type="application/rss+xml"/>+  </head>+  <body style="margin-top: 9em">++<div style="background: #eee; border-bottom: 2px solid #df0019; position: absolute; left: 0; top: 0; right: 0; padding: 18px 0;">+  <div style="max-width: 64.3em; margin: 0 auto;">+    <a href="http://www.pledgie.com/campaigns/17784">+      <img style="width: 149px; height: 37px; vertical-align: bottom" alt='Click here to lend your support to: Fund CodeMirror development and make a donation at www.pledgie.com !' src='http://www.pledgie.com/campaigns/17784.png?skin_name=chrome' border=0/>+    </a> &nbsp; <span style="font-size: 1.23em; font-weight: bold;">Please check out our development fundraiser.+  </div>+</div>++<h1><span class="logo-braces">{ }</span> <a href="http://codemirror.net/">CodeMirror</a></h1>++<pre class="grey">+<img src="doc/baboon.png" class="logo" alt="logo"/>/* In-browser code editing+   made bearable */+</pre>++<div class="clear"><div class="left blk">++  <p style="margin-top: 0">CodeMirror is a JavaScript component that+  provides a code editor in the browser. When a mode is available for+  the language you are coding in, it will color your code, and+  optionally help with indentation.</p>++  <p>A <a href="doc/manual.html">rich programming API</a> and a CSS+  theming system are available for customizing CodeMirror to fit your+  application, and extending it with new functionality.</p>++  <div class="clear"><div class="left1 blk">++    <h2 style="margin-top: 0">Supported modes:</h2>++    <ul>+      <li><a href="mode/clike/index.html">C, C++, C#</a></li>+      <li><a href="mode/clojure/index.html">Clojure</a></li>+      <li><a href="mode/coffeescript/index.html">CoffeeScript</a></li>+      <li><a href="mode/css/index.html">CSS</a></li>+      <li><a href="mode/diff/index.html">diff</a></li>+      <li><a href="mode/ecl/index.html">ECL</a></li>+      <li><a href="mode/erlang/index.html">Erlang</a></li>+      <li><a href="mode/go/index.html">Go</a></li>+      <li><a href="mode/groovy/index.html">Groovy</a></li>+      <li><a href="mode/haskell/index.html">Haskell</a></li>+      <li><a href="mode/haxe/index.html">Haxe</a></li>+      <li><a href="mode/htmlembedded/index.html">HTML embedded scripts</a></li>+      <li><a href="mode/htmlmixed/index.html">HTML mixed-mode</a></li>+      <li><a href="mode/clike/index.html">Java</a></li>+      <li><a href="mode/javascript/index.html">JavaScript</a></li>+      <li><a href="mode/jinja2/index.html">Jinja2</a></li>+      <li><a href="mode/less/index.html">LESS</a></li>+      <li><a href="mode/lua/index.html">Lua</a></li>+      <li><a href="mode/markdown/index.html">Markdown</a> (<a href="mode/gfm/index.html">Github-flavour</a>)</li>+      <li><a href="mode/mysql/index.html">MySQL</a></li>+      <li><a href="mode/ntriples/index.html">NTriples</a></li>+      <li><a href="mode/ocaml/index.html">OCaml</a></li>+      <li><a href="mode/pascal/index.html">Pascal</a></li>+      <li><a href="mode/perl/index.html">Perl</a></li>+      <li><a href="mode/php/index.html">PHP</a></li>+      <li><a href="mode/pig/index.html">Pig Latin</a></li>+      <li><a href="mode/plsql/index.html">PL/SQL</a></li>+      <li><a href="mode/properties/index.html">Properties files</a></li>+      <li><a href="mode/python/index.html">Python</a></li>+      <li><a href="mode/r/index.html">R</a></li>+      <li>RPM <a href="mode/rpm/spec/index.html">spec</a> and <a href="mode/rpm/changes/index.html">changelog</a></li>+      <li><a href="mode/rst/index.html">reStructuredText</a></li>+      <li><a href="mode/ruby/index.html">Ruby</a></li>+      <li><a href="mode/rust/index.html">Rust</a></li>+      <li><a href="mode/clike/scala.html">Scala</a></li>+      <li><a href="mode/scheme/index.html">Scheme</a></li>+      <li><a href="mode/shell/index.html">Shell</a></li>+      <li><a href="mode/smalltalk/index.html">Smalltalk</a></li>+      <li><a href="mode/smarty/index.html">Smarty</a></li>+      <li><a href="mode/sparql/index.html">SPARQL</a></li>+      <li><a href="mode/stex/index.html">sTeX, LaTeX</a></li>+      <li><a href="mode/tiddlywiki/index.html">Tiddlywiki</a></li>+      <li><a href="mode/tiki/index.html">Tiki wiki</a></li>+      <li><a href="mode/vb/index.html">VB.NET</a></li>+      <li><a href="mode/vbscript/index.html">VBScript</a></li>+      <li><a href="mode/velocity/index.html">Velocity</a></li>+      <li><a href="mode/verilog/index.html">Verilog</a></li>+      <li><a href="mode/xml/index.html">XML/HTML</a></li>+      <li><a href="mode/xquery/index.html">XQuery</a></li>+      <li><a href="mode/yaml/index.html">YAML</a></li>+    </ul>++  </div><div class="left2 blk">++    <h2 style="margin-top: 0">Usage demos:</h2>++    <ul>+      <li><a href="demo/complete.html">Autocompletion</a> (<a href="demo/xmlcomplete.html">XML</a>)</li>+      <li><a href="demo/search.html">Search/replace</a></li>+      <li><a href="demo/folding.html">Code folding</a></li>+      <li><a href="demo/mustache.html">Mode overlays</a></li>+      <li><a href="demo/multiplex.html">Mode multiplexer</a></li>+      <li><a href="demo/preview.html">HTML editor with preview</a></li>+      <li><a href="demo/resize.html">Auto-resizing editor</a></li>+      <li><a href="demo/marker.html">Setting breakpoints</a></li>+      <li><a href="demo/activeline.html">Highlighting the current line</a></li>+      <li><a href="demo/matchhighlighter.html">Highlighting selection matches</a></li>+      <li><a href="demo/theme.html">Theming</a></li>+      <li><a href="demo/runmode.html">Stand-alone highlighting</a></li>+      <li><a href="demo/fullscreen.html">Full-screen editing</a></li>+      <li><a href="demo/changemode.html">Mode auto-changing</a></li>+      <li><a href="demo/visibletabs.html">Visible tabs</a></li>+      <li><a href="demo/formatting.html">Autoformatting of code</a></li>+      <li><a href="demo/emacs.html">Emacs keybindings</a></li>+      <li><a href="demo/vim.html">Vim keybindings</a></li>+      <li><a href="demo/closetag.html">Automatic xml tag closing</a></li>+      <li><a href="demo/loadmode.html">Lazy mode loading</a></li>+    </ul>++    <h2>Real-world uses:</h2>++    <ul>+      <li><a href="http://jsbin.com">jsbin.com</a> (JS playground)</li>+      <li><a href="http://www.chris-granger.com/2012/04/12/light-table---a-new-ide-concept/">Light Table</a> (experimental IDE)</li>+      <li><a href="http://brackets.io">Adobe Brackets</a> (code editor)</li>+      <li><a href="http://www.mergely.com/">Mergely</a> (interactive diffing)</li>+      <li><a href="https://script.google.com/">Google Apps Script</a></li>+      <li><a href="http://eloquentjavascript.net/chapter1.html">Eloquent JavaScript</a> (book)</li>+      <li><a href="http://media.chikuyonok.ru/codemirror2/">Zen Coding</a> (fast XML editing)</li>+      <li><a href="http://paperjs.org/">Paper.js</a> (graphics scripting)</li>+      <li><a href="http://tour.golang.org">Go language tour</a></li>+      <li><a href="http://enjalot.com/tributary/2636296/sinwaves.js">Tributary</a> (augmented editing)</li>+      <li><a href="http://prose.io/">Prose.io</a> (github content editor)</li>+      <li><a href="http://www.wescheme.org/">WeScheme</a> (learning tool)</li>+      <li><a href="http://webglplayground.net/">WebGL playground</a></li>+      <li><a href="http://ql.io/">ql.io</a> (http API query helper)</li>+      <li><a href="http://elm-lang.org/Examples.elm">Elm language examples</a></li>+      <li><a href="https://thefiletree.com">The File Tree</a> (collab editor)</li>+      <li><a href="http://bluegriffon.org/">BlueGriffon</a> (HTML editor)</li>+      <li><a href="http://www.jshint.com/">JSHint</a> (JS linter)</li>+      <li><a href="http://kl1p.com/cmtest/1">kl1p</a> (paste service)</li>+      <li><a href="http://sqlfiddle.com">SQLFiddle</a> (SQL playground)</li>+      <li><a href="http://try.haxe.org">Try Haxe</a> (Haxe Playground) </li>+      <li><a href="http://cssdeck.com/">CSSDeck</a> (CSS showcase)</li>+      <li><a href="http://www.ckwnc.com/">CKWNC</a> (UML editor)</li>+      <li><a href="http://www.sketchpatch.net/labs/livecodelabIntro.html">sketchPatch Livecodelab</a></li>+    </ul>++  </div></div>++  <h2 id="code">Getting the code</h2>++  <p>All of CodeMirror is released under a <a+  href="LICENSE">MIT-style</a> license. To get it, you can download+  the <a href="http://codemirror.net/codemirror.zip">latest+  release</a> or the current <a+  href="http://codemirror.net/codemirror2-latest.zip">development+  snapshot</a> as zip files. To create a custom minified script file,+  you can use the <a href="doc/compress.html">compression API</a>.</p>++  <p>We use <a href="http://git-scm.com/">git</a> for version control.+  The main repository can be fetched in this way:</p>++  <pre class="code">git clone http://marijnhaverbeke.nl/git/codemirror2</pre>++  <p>CodeMirror can also be found on GitHub at <a+  href="http://github.com/marijnh/CodeMirror2">marijnh/CodeMirror2</a>.+  If you plan to hack on the code and contribute patches, the best way+  to do it is to create a GitHub fork, and send pull requests.</p>++  <h2 id="documention">Documentation</h2>++  <p>The <a href="doc/manual.html">manual</a> is your first stop for+  learning how to use this library. It starts with a quick explanation+  of how to use the editor, and then describes the API in detail.</p>++  <p>For those who want to learn more about the code, there is+  an <a href="doc/internals.html">overview of the internals</a> available.+  The <a href="http://github.com/marijnh/CodeMirror2">source code</a>+  itself is, for the most part, also well commented.</p>++  <h2 id="support">Support and bug reports</h2>++  <p>There is+  a <a href="http://groups.google.com/group/codemirror">Google+  group</a> (a sort of mailing list/newsgroup thing) for discussion+  and news related to CodeMirror. When reporting a bug,+  <a href="doc/reporting.html">read this first</a>. If you have+  a <a href="http://github.com">github</a> account,+  simply <a href="http://github.com/marijnh/CodeMirror2/issues">open+  an issue there</a>. Otherwise, post something to+  the <a href="http://groups.google.com/group/codemirror">group</a>,+  or e-mail me directly: <a href="mailto:marijnh@gmail.com">Marijn+  Haverbeke</a>.</p>++  <h2 id="supported">Supported browsers</h2>++  <p>The following browsers are able to run CodeMirror:</p>++  <ul>+    <li>Firefox 2 or higher</li>+    <li>Chrome, any version</li>+    <li>Safari 3 or higher</li>+    <li>Opera 9 or higher (with some key-handling problems on OS X)</li>+    <li>Internet Explorer 7 or higher in standards mode<br>+      <em>(So not quirks mode. But quasi-standards mode with a+      transitional doctype is also flaky. <code>&lt;!doctype+      html></code> is recommended.)</em></li>+  </ul>++  <p>I am not actively testing against every new browser release, and+  vendors have a habit of introducing bugs all the time, so I am+  relying on the community to tell me when something breaks.+  See <a href="#support">here</a> for information on how to contact+  me.</p>++  <h2 id="commercial">Commercial support</h2>++  <p>CodeMirror is developed and maintained by me, Marijn Haverbeke,+  in my own time. If your company is getting value out of CodeMirror,+  please consider purchasing a support contract.</p>++  <ul>+    <li>You'll be funding further work on CodeMirror.</li>+    <li>You ensure that you get a quick response when you have a+    problem, even when I am otherwise busy.</li>+  </ul>++  <p>CodeMirror support contracts exist in two+  forms—<strong>basic</strong> at €100 per month,+  and <strong>premium</strong> at €500 per+  month. <a href="mailto:marijnh@gmail.com">Contact me</a> for further+  information.</p>++</div>++<div class="right blk">++  <a href="http://codemirror.net/codemirror.zip" class="download">Download the latest release</a>++  <h2>Support CodeMirror</h2>++  <ul>+    <li>Donate+    (<span onclick="document.getElementById('paypal').submit();"+    class="quasilink">Paypal</span>+    or <span onclick="document.getElementById('bankinfo').style.display = 'block';"+             class="quasilink">bank</span>)</li>+    <li>Purchase <a href="#commercial">commercial support</a></li>+  </ul>++  <p id="bankinfo" style="display: none;">+    Bank: <i>Rabobank</i><br/>+    Country: <i>Netherlands</i><br/>+    SWIFT: <i>RABONL2U</i><br/>+    Account: <i>147850770</i><br/>+    Name: <i>Marijn Haverbeke</i><br/>+    IBAN: <i>NL26 RABO 0147 8507 70</i>+  </p>++  <h2>Reading material</h2>++  <ul>+    <li><a href="doc/manual.html">User manual</a></li>+    <li><a href="http://github.com/marijnh/CodeMirror2">Browse the code</a></li>+  </ul>++  <h2 id=releases>Releases</h2>++  <p class="rel">23-07-2012: <a href="http://codemirror.net/codemirror-2.32.zip">Version 2.32</a>:</p>++  <p class="rel-note">Emergency fix for a bug where an editor with+  line wrapping on IE will break when there is <em>no</em>+  scrollbar.</p>++  <p class="rel">20-07-2012: <a href="http://codemirror.net/codemirror-2.31.zip">Version 2.31</a>:</p>++  <ul class="rel-note">+    <li>New modes: <a href="mode/ocaml/index.html">OCaml</a>, <a href="mode/haxe/index.html">Haxe</a>, and <a href="mode/vb/index.html">VB.NET</a>.</li>+    <li>Several fixes to the new scrolling model.</li>+    <li>Add a <a href="doc/manual.html#setSize"><code>setSize</code></a> method for programmatic resizing.</li>+    <li>Add <a href="doc/manual.html#getHistory"><code>getHistory</code></a> and <a href="doc/manual.html#setHistory"><code>setHistory</code></a> methods.</li>+    <li>Allow custom line separator string in <a href="doc/manual.html#getValue"><code>getValue</code></a> and <a href="doc/manual.html#getRange"><code>getRange</code></a>.</li>+    <li>Support double- and triple-click drag, double-clicking whitespace.</li>+    <li>And more... <a href="https://github.com/marijnh/CodeMirror2/compare/v2.3...v2.31">(all patches)</a></li>+  </ul>++  <p class="rel">22-06-2012: <a href="http://codemirror.net/codemirror-2.3.zip">Version 2.3</a>:</p>++  <ul class="rel-note">+    <li><strong>New scrollbar implementation</strong>. Should flicker less. Changes DOM structure of the editor.</li>+    <li>New theme: <a href="demo/theme.html?vibrant-ink">vibrant-ink</a>.</li>+    <li>Many extensions to the VIM keymap (including text objects).</li>+    <li>Add <a href="demo/multiplex.html">mode-multiplexing</a> utility script.</li>+    <li>Fix bug where right-click paste works in read-only mode.</li>+    <li>Add a <a href="doc/manual.html#getScrollInfo"><code>getScrollInfo</code></a> method.</li>+    <li>Lots of other <a href="https://github.com/marijnh/CodeMirror2/compare/v2.25...v2.3">fixes</a>.</li>+  </ul>++  <p class="rel">23-05-2012: <a href="http://codemirror.net/codemirror-2.25.zip">Version 2.25</a>:</p>++  <ul class="rel-note">+    <li>New mode: <a href="mode/erlang/index.html">Erlang</a>.</li>+    <li><strong>Remove xmlpure mode</strong> (use <a href="mode/xml/index.html">xml.js</a>).</li>+    <li>Fix line-wrapping in Opera.</li>+    <li>Fix X Windows middle-click paste in Chrome.</li>+    <li>Fix bug that broke pasting of huge documents.</li>+    <li>Fix backspace and tab key repeat in Opera.</li>+  </ul>++  <p class="rel">23-04-2012: <a href="http://codemirror.net/codemirror-2.24.zip">Version 2.24</a>:</p>++  <ul class="rel-note">+    <li><strong>Drop support for Internet Explorer 6</strong>.</li>+    <li>New+    modes: <a href="mode/shell/index.html">Shell</a>, <a href="mode/tiki/index.html">Tiki+    wiki</a>, <a href="mode/pig/index.html">Pig Latin</a>.</li>+    <li>New themes: <a href="demo/theme.html?ambiance">Ambiance</a>, <a href="demo/theme.html?blackboard">Blackboard</a>.</li>+    <li>More control over drag/drop+    with <a href="doc/manual.html#option_dragDrop"><code>dragDrop</code></a>+    and <a href="doc/manual.html#option_onDragEvent"><code>onDragEvent</code></a>+    options.</li>+    <li>Make HTML mode a bit less pedantic.</li>+    <li>Add <a href="doc/manual.html#compoundChange"><code>compoundChange</code></a> API method.</li>+    <li>Several fixes in undo history and line hiding.</li>+    <li>Remove (broken) support for <code>catchall</code> in key maps,+    add <code>nofallthrough</code> boolean field instead.</li>+  </ul>++  <p class="rel">26-03-2012: <a href="http://codemirror.net/codemirror-2.23.zip">Version 2.23</a>:</p>++  <ul class="rel-note">+    <li>Change <strong>default binding for tab</strong> <a href="javascript:void(document.getElementById('tabbinding').style.display='')">[more]</a>+      <div style="display: none" id=tabbinding>+        Starting in 2.23, these bindings are default:+        <ul><li>Tab: Insert tab character</li>+          <li>Shift-tab: Reset line indentation to default</li>+          <li>Ctrl/Cmd-[: Reduce line indentation (old tab behaviour)</li>+          <li>Ctrl/Cmd-]: Increase line indentation (old shift-tab behaviour)</li>+        </ul>+      </div>+    </li>+    <li>New modes: <a href="mode/xquery/index.html">XQuery</a> and <a href="mode/vbscript/index.html">VBScript</a>.</li>+    <li>Two new themes: <a href="mode/less/index.html">lesser-dark</a> and <a href="mode/xquery/index.html">xq-dark</a>.</li>+    <li>Differentiate between background and text styles in <a href="doc/manual.html#setLineClass"><code>setLineClass</code></a>.</li>+    <li>Fix drag-and-drop in IE9+.</li>+    <li>Extend <a href="doc/manual.html#charCoords"><code>charCoords</code></a>+    and <a href="doc/manual.html#cursorCoords"><code>cursorCoords</code></a> with a <code>mode</code> argument.</li>+    <li>Add <a href="doc/manual.html#option_autofocus"><code>autofocus</code></a> option.</li>+    <li>Add <a href="doc/manual.html#findMarksAt"><code>findMarksAt</code></a> method.</li>+  </ul>++  <p class="rel">27-02-2012: <a href="http://codemirror.net/codemirror-2.22.zip">Version 2.22</a>:</p>++  <ul class="rel-note">+    <li>Allow <a href="doc/manual.html#keymaps">key handlers</a> to pass up events, allow binding characters.</li>+    <li>Add <a href="doc/manual.html#option_autoClearEmptyLines"><code>autoClearEmptyLines</code></a> option.</li>+    <li>Properly use tab stops when rendering tabs.</li>+    <li>Make PHP mode more robust.</li>+    <li>Support indentation blocks in <a href="doc/manual.html#util_foldcode">code folder</a>.</li>+    <li>Add a script for <a href="doc/manual.html#util_match-highlighter">highlighting instances of the selection</a>.</li>+    <li>New <a href="mode/properties/index.html">.properties</a> mode.</li>+    <li>Fix many bugs.</li>+  </ul>++  <p class="rel">27-01-2012: <a href="http://codemirror.net/codemirror-2.21.zip">Version 2.21</a>:</p>++  <ul class="rel-note">+    <li>Added <a href="mode/less/index.html">LESS</a>, <a href="mode/mysql/index.html">MySQL</a>,+    <a href="mode/go/index.html">Go</a>, and <a href="mode/verilog/index.html">Verilog</a> modes.</li>+    <li>Add <a href="doc/manual.html#option_smartIndent"><code>smartIndent</code></a>+    option.</li>+    <li>Support a cursor in <a href="doc/manual.html#option_readOnly"><code>readOnly</code></a>-mode.</li>+    <li>Support assigning multiple styles to a token.</li>+    <li>Use a new approach to drawing the selection.</li>+    <li>Add <a href="doc/manual.html#scrollTo"><code>scrollTo</code></a> method.</li>+    <li>Allow undo/redo events to span non-adjacent lines.</li>+    <li>Lots and lots of bugfixes.</li>+  </ul>++  <p class="rel">20-12-2011: <a href="http://codemirror.net/codemirror-2.2.zip">Version 2.2</a>:</p>++  <ul class="rel-note">+    <li>Slightly incompatible API changes. Read <a href="doc/upgrade_v2.2.html">this</a>.</li>+    <li>New approach+    to <a href="doc/manual.html#option_extraKeys">binding</a> keys,+    support for <a href="doc/manual.html#option_keyMap">custom+    bindings</a>.</li>+    <li>Support for overwrite (insert).</li>+    <li><a href="doc/manual.html#option_tabSize">Custom-width</a>+    and <a href="demo/visibletabs.html">stylable</a> tabs.</li>+    <li>Moved more code into <a href="doc/manual.html#addons">add-on scripts</a>.</li>+    <li>Support for sane vertical cursor movement in wrapped lines.</li>+    <li>More reliable handling of+    editing <a href="doc/manual.html#markText">marked text</a>.</li>+    <li>Add minimal <a href="demo/emacs.html">emacs</a>+    and <a href="demo/vim.html">vim</a> bindings.</li>+    <li>Rename <code>coordsFromIndex</code>+    to <a href="doc/manual.html#posFromIndex"><code>posFromIndex</code></a>,+    add <a href="doc/manual.html#indexFromPos"><code>indexFromPos</code></a>+    method.</li>+  </ul>++  <p class="rel">21-11-2011: <a href="http://codemirror.net/codemirror-2.18.zip">Version 2.18</a>:</p>+  <p class="rel-note">Fixes <code>TextMarker.clear</code>, which is broken in 2.17.</p>++  <p class="rel">21-11-2011: <a href="http://codemirror.net/codemirror-2.17.zip">Version 2.17</a>:</p>+  <ul class="rel-note">+    <li>Add support for <a href="doc/manual.html#option_lineWrapping">line+    wrapping</a> and <a href="doc/manual.html#hideLine">code+    folding</a>.</li>+    <li>Add <a href="mode/gfm/index.html">Github-style Markdown</a> mode.</li>+    <li>Add <a href="theme/monokai.css">Monokai</a>+    and <a href="theme/rubyblue.css">Rubyblue</a> themes.</li>+    <li>Add <a href="doc/manual.html#setBookmark"><code>setBookmark</code></a> method.</li>+    <li>Move some of the demo code into reusable components+    under <a href="lib/util/"><code>lib/util</code></a>.</li>+    <li>Make screen-coord-finding code faster and more reliable.</li>+    <li>Fix drag-and-drop in Firefox.</li>+    <li>Improve support for IME.</li>+    <li>Speed up content rendering.</li>+    <li>Fix browser's built-in search in Webkit.</li>+    <li>Make double- and triple-click work in IE.</li>+    <li>Various fixes to modes.</li>+  </ul>++  <p class="rel">27-10-2011: <a href="http://codemirror.net/codemirror-2.16.zip">Version 2.16</a>:</p>+  <ul class="rel-note">+    <li>Add <a href="mode/perl/index.html">Perl</a>, <a href="mode/rust/index.html">Rust</a>, <a href="mode/tiddlywiki/index.html">TiddlyWiki</a>, and <a href="mode/groovy/index.html">Groovy</a> modes.</li>+    <li>Dragging text inside the editor now moves, rather than copies.</li>+    <li>Add a <a href="doc/manual.html#coordsFromIndex"><code>coordsFromIndex</code></a> method.</li>+    <li><strong>API change</strong>: <code>setValue</code> now no longer clears history. Use <a href="doc/manual.html#clearHistory"><code>clearHistory</code></a> for that.</li>+    <li><strong>API change</strong>: <a href="doc/manual.html#markText"><code>markText</code></a> now+    returns an object with <code>clear</code> and <code>find</code>+    methods. Marked text is now more robust when edited.</li>+    <li>Fix editing code with tabs in Internet Explorer.</li>+  </ul>++  <p><a href="doc/oldrelease.html">Older releases...</a></p>++</div></div>++<div style="height: 2em">&nbsp;</div>++  <form action="https://www.paypal.com/cgi-bin/webscr" method="post" id="paypal">+    <input type="hidden" name="cmd" value="_s-xclick"/>+    <input type="hidden" name="hosted_button_id" value="3FVHS5FGUY7CC"/>+  </form>++  </body>+</html>
+ static/codemirror/keymap/emacs.js view
@@ -0,0 +1,29 @@+// TODO number prefixes+(function() {+  // Really primitive kill-ring implementation.+  var killRing = [];+  function addToRing(str) {+    killRing.push(str);+    if (killRing.length > 50) killRing.shift();+  }+  function getFromRing() { return killRing[killRing.length - 1] || ""; }+  function popFromRing() { if (killRing.length > 1) killRing.pop(); return getFromRing(); }++  CodeMirror.keyMap.emacs = {+    "Ctrl-X": function(cm) {cm.setOption("keyMap", "emacs-Ctrl-X");},+    "Ctrl-W": function(cm) {addToRing(cm.getSelection()); cm.replaceSelection("");},+    "Ctrl-Alt-W": function(cm) {addToRing(cm.getSelection()); cm.replaceSelection("");},+    "Alt-W": function(cm) {addToRing(cm.getSelection());},+    "Ctrl-Y": function(cm) {cm.replaceSelection(getFromRing());},+    "Alt-Y": function(cm) {cm.replaceSelection(popFromRing());},+    "Ctrl-/": "undo", "Shift-Ctrl--": "undo", "Shift-Alt-,": "goDocStart", "Shift-Alt-.": "goDocEnd",+    "Ctrl-S": "findNext", "Ctrl-R": "findPrev", "Ctrl-G": "clearSearch", "Shift-Alt-5": "replace",+    "Ctrl-Z": "undo", "Cmd-Z": "undo", "Alt-/": "autocomplete",+    fallthrough: ["basic", "emacsy"]+  };++  CodeMirror.keyMap["emacs-Ctrl-X"] = {+    "Ctrl-S": "save", "Ctrl-W": "save", "S": "saveAll", "F": "open", "U": "undo", "K": "close",+    auto: "emacs", nofallthrough: true+  };+})();
+ static/codemirror/keymap/vim.js view
@@ -0,0 +1,785 @@+// Supported keybindings:+//+// Cursor movement:+// h, j, k, l+// e, E, w, W, b, B+// Ctrl-f, Ctrl-b+// Ctrl-n, Ctrl-p+// $, ^, 0+// G+// ge, gE+// gg+// f<char>, F<char>, t<char>, T<char>+// Ctrl-o, Ctrl-i TODO (FIXME - Ctrl-O wont work in Chrome)+// /, ?, n, N TODO (does not work)+// #, * TODO+//+// Entering insert mode:+// i, I, a, A, o, O+// s+// ce, cb (without support for number of actions like c3e - TODO)+// cc+// S, C TODO+// cf<char>, cF<char>, ct<char>, cT<char>+//+// Deleting text:+// x, X+// J+// dd, D+// de, db (without support for number of actions like d3e - TODO)+// df<char>, dF<char>, dt<char>, dT<char>+//+// Yanking and pasting:+// yy, Y+// p, P+// p'<char> TODO - test+// y'<char> TODO - test+// m<char> TODO - test+//+// Changing text in place:+// ~+// r<char>+//+// Visual mode:+// v, V TODO+//+// Misc:+// . TODO+//++(function() {+  var count = "";+  var sdir = "f";+  var buf = "";+  var yank = 0;+  var mark = [];+  var reptTimes = 0;+  function emptyBuffer() { buf = ""; }+  function pushInBuffer(str) { buf += str; }+  function pushCountDigit(digit) { return function(cm) {count += digit;}; }+  function popCount() { var i = parseInt(count, 10); count = ""; return i || 1; }+  function iterTimes(func) {+    for (var i = 0, c = popCount(); i < c; ++i) func(i, i == c - 1);+  }+  function countTimes(func) {+    if (typeof func == "string") func = CodeMirror.commands[func];+    return function(cm) { iterTimes(function () { func(cm); }); };+  }++  function iterObj(o, f) {+    for (var prop in o) if (o.hasOwnProperty(prop)) f(prop, o[prop]);+  }+  function iterList(l, f) {+    for (var i in l) f(l[i]);+  }+  function toLetter(ch) {+    // T -> t, Shift-T -> T, '*' -> *, "Space" -> " "+    if (ch.slice(0, 6) == "Shift-") {+      return ch.slice(0, 1);+    } else {+      if (ch == "Space") return " ";+      if (ch.length == 3 && ch[0] == "'" && ch[2] == "'") return ch[1];+      return ch.toLowerCase();+    }+  }+  var SPECIAL_SYMBOLS = "~`!@#$%^&*()_-+=[{}]\\|/?.,<>:;\"\'1234567890";+  function toCombo(ch) {+    // t -> T, T -> Shift-T, * -> '*', " " -> "Space"+    if (ch == " ") return "Space";+    var specialIdx = SPECIAL_SYMBOLS.indexOf(ch);+    if (specialIdx != -1) return "'" + ch + "'";+    if (ch.toLowerCase() == ch) return ch.toUpperCase();+    return "Shift-" + ch.toUpperCase();+  }++  var word = [/\w/, /[^\w\s]/], bigWord = [/\S/];+  function findWord(line, pos, dir, regexps) {+    var stop = 0, next = -1;+    if (dir > 0) { stop = line.length; next = 0; }+    var start = stop, end = stop;+    // Find bounds of next one.+    outer: for (; pos != stop; pos += dir) {+      for (var i = 0; i < regexps.length; ++i) {+        if (regexps[i].test(line.charAt(pos + next))) {+          start = pos;+          for (; pos != stop; pos += dir) {+            if (!regexps[i].test(line.charAt(pos + next))) break;+          }+          end = pos;+          break outer;+        }+      }+    }+    return {from: Math.min(start, end), to: Math.max(start, end)};+  }+  function moveToWord(cm, regexps, dir, times, where) {+    var cur = cm.getCursor();++    for (var i = 0; i < times; i++) {+      var line = cm.getLine(cur.line), startCh = cur.ch, word;+      while (true) {+        // If we're at start/end of line, start on prev/next respectivly+        if (cur.ch == line.length && dir > 0) {+          cur.line++;+          cur.ch = 0;+          line = cm.getLine(cur.line);+        } else if (cur.ch == 0 && dir < 0) {+          cur.line--;+          cur.ch = line.length;+          line = cm.getLine(cur.line);+        }+        if (!line) break;++        // On to the actual searching+        word = findWord(line, cur.ch, dir, regexps);+        cur.ch = word[where == "end" ? "to" : "from"];+        if (startCh == cur.ch && word.from != word.to) cur.ch = word[dir < 0 ? "from" : "to"];+        else break;+      }+    }+    return cur;+  }+  function joinLineNext(cm) {+    var cur = cm.getCursor(), ch = cur.ch, line = cm.getLine(cur.line);+    CodeMirror.commands.goLineEnd(cm);+    if (cur.line != cm.lineCount()) {+      CodeMirror.commands.goLineEnd(cm);+      cm.replaceSelection(" ", "end");+      CodeMirror.commands.delCharRight(cm);+    }+  }+  function delTillMark(cm, cHar) {+    var i = mark[cHar];+    if (i === undefined) {+      // console.log("Mark not set"); // TODO - show in status bar+      return;+    }+    var l = cm.getCursor().line, start = i > l ? l : i, end = i > l ? i : l;+    cm.setCursor(start);+    for (var c = start; c <= end; c++) {+      pushInBuffer("\n"+cm.getLine(start));+      cm.removeLine(start);+    }+  }+  function yankTillMark(cm, cHar) {+    var i = mark[cHar];+    if (i === undefined) {+      // console.log("Mark not set"); // TODO - show in status bar+      return;+    }+    var l = cm.getCursor().line, start = i > l ? l : i, end = i > l ? i : l;+    for (var c = start; c <= end; c++) {+      pushInBuffer("\n"+cm.getLine(c));+    }+    cm.setCursor(start);+  }+  function goLineStartText(cm) {+    // Go to the start of the line where the text begins, or the end for whitespace-only lines+    var cur = cm.getCursor(), firstNonWS = cm.getLine(cur.line).search(/\S/);+    cm.setCursor(cur.line, firstNonWS == -1 ? line.length : firstNonWS, true);+  }++  function charIdxInLine(cm, cHar, motion_options) {+    // Search for cHar in line.+    // motion_options: {forward, inclusive}+    // If inclusive = true, include it too.+    // If forward = true, search forward, else search backwards.+    // If char is not found on this line, do nothing+    var cur = cm.getCursor(), line = cm.getLine(cur.line), idx;+    var ch = toLetter(cHar), mo = motion_options;+    if (mo.forward) {+      idx = line.indexOf(ch, cur.ch + 1);+      if (idx != -1 && mo.inclusive) idx += 1;+    } else {+      idx = line.lastIndexOf(ch, cur.ch);+      if (idx != -1 && !mo.inclusive) idx += 1;+    }+    return idx;+  }++  function moveTillChar(cm, cHar, motion_options) {+    // Move to cHar in line, as found by charIdxInLine.+    var idx = charIdxInLine(cm, cHar, motion_options), cur = cm.getCursor();+    if (idx != -1) cm.setCursor({line: cur.line, ch: idx});+  }++  function delTillChar(cm, cHar, motion_options) {+    // delete text in this line, untill cHar is met,+    // as found by charIdxInLine.+    // If char is not found on this line, do nothing+    var idx = charIdxInLine(cm, cHar, motion_options);+    var cur = cm.getCursor();+    if (idx !== -1) {+      if (motion_options.forward) {+        cm.replaceRange("", {line: cur.line, ch: cur.ch}, {line: cur.line, ch: idx});+      } else {+        cm.replaceRange("", {line: cur.line, ch: idx}, {line: cur.line, ch: cur.ch});+      }+    }+  }++  function enterInsertMode(cm) {+    // enter insert mode: switch mode and cursor+    popCount();+    cm.setOption("keyMap", "vim-insert");+  }++  function dialog(cm, text, shortText, f) {+    if (cm.openDialog) cm.openDialog(text, f);+    else f(prompt(shortText, ""));+  }+  function showAlert(cm, text) {+    if (cm.openDialog) cm.openDialog(CodeMirror.htmlEscape(text) + " <button type=button>OK</button>");+    else alert(text);+  }++  // main keymap+  var map = CodeMirror.keyMap.vim = {+    // Pipe (|); TODO: should be *screen* chars, so need a util function to turn tabs into spaces?+    "'|'": function(cm) {+      cm.setCursor(cm.getCursor().line, popCount() - 1, true);+    },+    "A": function(cm) {+      cm.setCursor(cm.getCursor().line, cm.getCursor().ch+1, true);+      enterInsertMode(cm);+    },+    "Shift-A": function(cm) { CodeMirror.commands.goLineEnd(cm); enterInsertMode(cm);},+    "I": function(cm) { enterInsertMode(cm);},+    "Shift-I": function(cm) { goLineStartText(cm); enterInsertMode(cm);},+    "O": function(cm) {+      CodeMirror.commands.goLineEnd(cm);+      CodeMirror.commands.newlineAndIndent(cm);+      enterInsertMode(cm);+    },+    "Shift-O": function(cm) {+      CodeMirror.commands.goLineStart(cm);+      cm.replaceSelection("\n", "start");+      cm.indentLine(cm.getCursor().line);+      enterInsertMode(cm);+    },+    "G": function(cm) { cm.setOption("keyMap", "vim-prefix-g");},+    "Shift-D": function(cm) {+      // commented out verions works, but I left original, cause maybe+      // I don't know vim enouth to see what it does+      /* var cur = cm.getCursor();+      var f = {line: cur.line, ch: cur.ch}, t = {line: cur.line};+      pushInBuffer(cm.getRange(f, t));+      */+      emptyBuffer();+      mark["Shift-D"] = cm.getCursor(false).line;+      cm.setCursor(cm.getCursor(true).line);+      delTillMark(cm,"Shift-D"); mark = [];+    },++    "S": function (cm) {+      countTimes(function (_cm) {+        CodeMirror.commands.delCharRight(_cm);+      })(cm);+      enterInsertMode(cm);+    },+    "M": function(cm) {cm.setOption("keyMap", "vim-prefix-m"); mark = [];},+    "Y": function(cm) {cm.setOption("keyMap", "vim-prefix-y"); emptyBuffer(); yank = 0;},+    "Shift-Y": function(cm) {+      emptyBuffer();+      mark["Shift-D"] = cm.getCursor(false).line;+      cm.setCursor(cm.getCursor(true).line);+      yankTillMark(cm,"Shift-D"); mark = [];+    },+    "/": function(cm) {var f = CodeMirror.commands.find; f && f(cm); sdir = "f";},+    "'?'": function(cm) {+      var f = CodeMirror.commands.find;+      if (f) { f(cm); CodeMirror.commands.findPrev(cm); sdir = "r"; }+    },+    "N": function(cm) {+      var fn = CodeMirror.commands.findNext;+      if (fn) sdir != "r" ? fn(cm) : CodeMirror.commands.findPrev(cm);+    },+    "Shift-N": function(cm) {+      var fn = CodeMirror.commands.findNext;+      if (fn) sdir != "r" ? CodeMirror.commands.findPrev(cm) : fn.findNext(cm);+    },+    "Shift-G": function(cm) {+      count == "" ? cm.setCursor(cm.lineCount()) : cm.setCursor(parseInt(count, 10)-1);+      popCount();+      CodeMirror.commands.goLineStart(cm);+    },+    "':'": function(cm) {+      var exModeDialog = ': <input type="text" style="width: 90%"/>';+      dialog(cm, exModeDialog, ':', function(command) {+        if (command.match(/^\d+$/)) {+          cm.setCursor(command - 1, cm.getCursor().ch);+        } else {+          showAlert(cm, "Bad command: " + command);+        }+      });+    },+    nofallthrough: true, style: "fat-cursor"+  };++  // standard mode switching+  iterList(["d", "t", "T", "f", "F", "c", "r"],+      function (ch) {+        CodeMirror.keyMap.vim[toCombo(ch)] = function (cm) {+          cm.setOption("keyMap", "vim-prefix-" + ch);+          emptyBuffer();+        };+      });++  function addCountBindings(keyMap) {+    // Add bindings for number keys+    keyMap["0"] = function(cm) {+      count.length > 0 ? pushCountDigit("0")(cm) : CodeMirror.commands.goLineStart(cm);+    };+    for (var i = 1; i < 10; ++i) keyMap[i] = pushCountDigit(i);+  }+  addCountBindings(CodeMirror.keyMap.vim);++  // main num keymap+  // Add bindings that are influenced by number keys+  iterObj({+    "Left": "goColumnLeft", "Right": "goColumnRight",+    "Down": "goLineDown", "Up": "goLineUp", "Backspace": "goCharLeft",+    "Space": "goCharRight",+    "X": function(cm) {CodeMirror.commands.delCharRight(cm);},+    "P": function(cm) {+      var cur = cm.getCursor().line;+      if (buf!= "") {+        if (buf[0] == "\n") CodeMirror.commands.goLineEnd(cm);+        cm.replaceRange(buf, cm.getCursor());+      }+    },+    "Shift-X": function(cm) {CodeMirror.commands.delCharLeft(cm);},+    "Shift-J": function(cm) {joinLineNext(cm);},+    "Shift-P": function(cm) {+      var cur = cm.getCursor().line;+      if (buf!= "") {+        CodeMirror.commands.goLineUp(cm);+        CodeMirror.commands.goLineEnd(cm);+        cm.replaceSelection(buf, "end");+      }+      cm.setCursor(cur+1);+    },+    "'~'": function(cm) {+      var cur = cm.getCursor(), cHar = cm.getRange({line: cur.line, ch: cur.ch}, {line: cur.line, ch: cur.ch+1});+      cHar = cHar != cHar.toLowerCase() ? cHar.toLowerCase() : cHar.toUpperCase();+      cm.replaceRange(cHar, {line: cur.line, ch: cur.ch}, {line: cur.line, ch: cur.ch+1});+      cm.setCursor(cur.line, cur.ch+1);+    },+    "Ctrl-B": function(cm) {CodeMirror.commands.goPageUp(cm);},+    "Ctrl-F": function(cm) {CodeMirror.commands.goPageDown(cm);},+    "Ctrl-P": "goLineUp", "Ctrl-N": "goLineDown",+    "U": "undo", "Ctrl-R": "redo"+  }, function(key, cmd) { map[key] = countTimes(cmd); });++  // empty key maps+  iterList([+      "vim-prefix-d'",+      "vim-prefix-y'",+      "vim-prefix-df",+      "vim-prefix-dF",+      "vim-prefix-dt",+      "vim-prefix-dT",+      "vim-prefix-c",+      "vim-prefix-cf",+      "vim-prefix-cF",+      "vim-prefix-ct",+      "vim-prefix-cT",+      "vim-prefix-",+      "vim-prefix-f",+      "vim-prefix-F",+      "vim-prefix-t",+      "vim-prefix-T",+      "vim-prefix-r",+      "vim-prefix-m"+      ],+      function (prefix) {+        CodeMirror.keyMap[prefix] = {+          auto: "vim",+          nofallthrough: true,+          style: "fat-cursor"+        };+      });++  CodeMirror.keyMap["vim-prefix-g"] = {+    "E": countTimes(function(cm) { cm.setCursor(moveToWord(cm, word, -1, 1, "start"));}),+    "Shift-E": countTimes(function(cm) { cm.setCursor(moveToWord(cm, bigWord, -1, 1, "start"));}),+    "G": function (cm) { cm.setCursor({line: 0, ch: cm.getCursor().ch});},+    auto: "vim", nofallthrough: true, style: "fat-cursor"+  };++  CodeMirror.keyMap["vim-prefix-d"] = {+    "D": countTimes(function(cm) {+      pushInBuffer("\n"+cm.getLine(cm.getCursor().line));+      cm.removeLine(cm.getCursor().line);+      cm.setOption("keyMap", "vim");+    }),+    "'": function(cm) {+      cm.setOption("keyMap", "vim-prefix-d'");+      emptyBuffer();+    },+    "B": function(cm) {+      var cur = cm.getCursor();+      var line = cm.getLine(cur.line);+      var index = line.lastIndexOf(" ", cur.ch);++      pushInBuffer(line.substring(index, cur.ch));+      cm.replaceRange("", {line: cur.line, ch: index}, cur);+      cm.setOption("keyMap", "vim");+    },+    nofallthrough: true, style: "fat-cursor"+  };+  // FIXME - does not work for bindings like "d3e"+  addCountBindings(CodeMirror.keyMap["vim-prefix-d"]);++  CodeMirror.keyMap["vim-prefix-c"] = {+    "B": function (cm) {+      countTimes("delWordLeft")(cm);+      enterInsertMode(cm);+    },+    "C": function (cm) {+      iterTimes(function (i, last) {+        CodeMirror.commands.deleteLine(cm);+        if (i) {+          CodeMirror.commands.delCharRight(cm);+          if (last) CodeMirror.commands.deleteLine(cm);+        }+      });+      enterInsertMode(cm);+    },+    nofallthrough: true, style: "fat-cursor"+  };++  iterList(["vim-prefix-d", "vim-prefix-c", "vim-prefix-"], function (prefix) {+    iterList(["f", "F", "T", "t"],+      function (ch) {+        CodeMirror.keyMap[prefix][toCombo(ch)] = function (cm) {+          cm.setOption("keyMap", prefix + ch);+          emptyBuffer();+        };+      });+  });++  var MOTION_OPTIONS = {+    "t": {inclusive: false, forward: true},+    "f": {inclusive: true,  forward: true},+    "T": {inclusive: false, forward: false},+    "F": {inclusive: true,  forward: false}+  };++  function setupPrefixBindingForKey(m) {+    CodeMirror.keyMap["vim-prefix-m"][m] = function(cm) {+      mark[m] = cm.getCursor().line;+    };+    CodeMirror.keyMap["vim-prefix-d'"][m] = function(cm) {+      delTillMark(cm,m);+    };+    CodeMirror.keyMap["vim-prefix-y'"][m] = function(cm) {+      yankTillMark(cm,m);+    };+    CodeMirror.keyMap["vim-prefix-r"][m] = function (cm) {+      var cur = cm.getCursor();+      cm.replaceRange(toLetter(m),+          {line: cur.line, ch: cur.ch},+          {line: cur.line, ch: cur.ch + 1});+      CodeMirror.commands.goColumnLeft(cm);+    };+    // all commands, related to motions till char in line+    iterObj(MOTION_OPTIONS, function (ch, options) {+      CodeMirror.keyMap["vim-prefix-" + ch][m] = function(cm) {+        moveTillChar(cm, m, options);+      };+      CodeMirror.keyMap["vim-prefix-d" + ch][m] = function(cm) {+        delTillChar(cm, m, options);+      };+      CodeMirror.keyMap["vim-prefix-c" + ch][m] = function(cm) {+        delTillChar(cm, m, options);+        enterInsertMode(cm);+      };+    });+  }+  for (var i = 65; i < 65 + 26; i++) { // uppercase alphabet char codes+    var ch = String.fromCharCode(i);+    setupPrefixBindingForKey(toCombo(ch));+    setupPrefixBindingForKey(toCombo(ch.toLowerCase()));+  }+  iterList(SPECIAL_SYMBOLS, function (ch) {+    setupPrefixBindingForKey(toCombo(ch));+  });+  setupPrefixBindingForKey("Space");++  CodeMirror.keyMap["vim-prefix-y"] = {+    "Y": countTimes(function(cm) { pushInBuffer("\n"+cm.getLine(cm.getCursor().line+yank)); yank++; }),+    "'": function(cm) {cm.setOption("keyMap", "vim-prefix-y'"); emptyBuffer();},+    nofallthrough: true, style: "fat-cursor"+  };++  CodeMirror.keyMap["vim-insert"] = {+    // TODO: override navigation keys so that Esc will cancel automatic indentation from o, O, i_<CR>+    "Esc": function(cm) {+      cm.setCursor(cm.getCursor().line, cm.getCursor().ch-1, true);+      cm.setOption("keyMap", "vim");+    },+    "Ctrl-N": "autocomplete",+    "Ctrl-P": "autocomplete",+    fallthrough: ["default"]+  };++  function findMatchedSymbol(cm, cur, symb) {+    var line = cur.line;+    var symb = symb ? symb : cm.getLine(line)[cur.ch];++    // Are we at the opening or closing char+    var forwards = ['(', '[', '{'].indexOf(symb) != -1;++    var reverseSymb = (function(sym) {+      switch (sym) {+        case '(' : return ')';+        case '[' : return ']';+        case '{' : return '}';+        case ')' : return '(';+        case ']' : return '[';+        case '}' : return '{';+        default : return null;+      }+    })(symb);++    // Couldn't find a matching symbol, abort+    if (reverseSymb == null) return cur;++    // Tracking our imbalance in open/closing symbols. An opening symbol wii be+    // the first thing we pick up if moving forward, this isn't true moving backwards+    var disBal = forwards ? 0 : 1;++    while (true) {+      if (line == cur.line) {+        // First pass, do some special stuff+        var currLine =  forwards ? cm.getLine(line).substr(cur.ch).split('') : cm.getLine(line).substr(0,cur.ch).split('').reverse();+      } else {+        var currLine =  forwards ? cm.getLine(line).split('') : cm.getLine(line).split('').reverse();+      }++      for (var index = 0;  index < currLine.length; index++) {+        if (currLine[index] == symb) disBal++;+        else if (currLine[index] == reverseSymb) disBal--;++        if (disBal == 0) {+          if (forwards && cur.line == line) return {line: line, ch: index + cur.ch};+          else if (forwards) return {line: line, ch: index};+          else return {line: line, ch: currLine.length - index - 1 };+        }+      }++      if (forwards) line++;+      else line--;+    }+  }++  function selectCompanionObject(cm, revSymb, inclusive) {+    var cur = cm.getCursor();++    var end = findMatchedSymbol(cm, cur, revSymb);+    var start = findMatchedSymbol(cm, end);+    start.ch += inclusive ? 1 : 0;+    end.ch += inclusive ? 0 : 1;++    return {start: start, end: end};+  }++  // These are our motion commands to be used for navigation and selection with+  // certian other commands. All should return a cursor object.+  var motionList = ['B', 'E', 'J', 'K', 'H', 'L', 'W', 'Shift-W', "'^'", "'$'", "'%'", 'Esc'];++  motions = {+    'B': function(cm, times) { return moveToWord(cm, word, -1, times); },+    'Shift-B': function(cm, times) { return moveToWord(cm, bigWord, -1, times); },+    'E': function(cm, times) { return moveToWord(cm, word, 1, times, 'end'); },+    'Shift-E': function(cm, times) { return moveToWord(cm, bigWord, 1, times, 'end'); },+    'J': function(cm, times) {+      var cur = cm.getCursor();+      return {line: cur.line+times, ch : cur.ch};+    },++    'K': function(cm, times) {+      var cur = cm.getCursor();+      return {line: cur.line-times, ch: cur.ch};+    },++    'H': function(cm, times) {+      var cur = cm.getCursor();+      return {line: cur.line, ch: cur.ch-times};+    },++    'L': function(cm, times) {+      var cur = cm.getCursor();+      return {line: cur.line, ch: cur.ch+times};+    },+    'W': function(cm, times) { return moveToWord(cm, word, 1, times); },+    'Shift-W': function(cm, times) { return moveToWord(cm, bigWord, 1, times); },+    "'^'": function(cm, times) {+      var cur = cm.getCursor();+      var line = cm.getLine(cur.line).split('');++      // Empty line :o+      if (line.length == 0) return cur;++      for (var index = 0;  index < line.length; index++) {+        if (line[index].match(/[^\s]/)) return {line: cur.line, ch: index};+      }+    },+    "'$'": function(cm) {+      var cur = cm.getCursor();+      var line = cm.getLine(cur.line);+      return {line: cur.line, ch: line.length};+    },+    "'%'": function(cm) { return findMatchedSymbol(cm, cm.getCursor()); },+    "Esc" : function(cm) {+      cm.setOption('vim');+      reptTimes = 0;++      return cm.getCursor();+    }+  };++  // Map our movement actions each operator and non-operational movement+  motionList.forEach(function(key, index, array) {+    CodeMirror.keyMap['vim-prefix-d'][key] = function(cm) {+      // Get our selected range+      var start = cm.getCursor();+      var end = motions[key](cm, reptTimes ? reptTimes : 1);++      // Set swap var if range is of negative length+      if ((start.line > end.line) || (start.line == end.line && start.ch > end.ch)) var swap = true;++      // Take action, switching start and end if swap var is set+      pushInBuffer(cm.getRange(swap ? end : start, swap ? start : end));+      cm.replaceRange("", swap ? end : start, swap ? start : end);++      // And clean up+      reptTimes = 0;+      cm.setOption("keyMap", "vim");+    };++    CodeMirror.keyMap['vim-prefix-c'][key] = function(cm) {+      var start = cm.getCursor();+      var end = motions[key](cm, reptTimes ? reptTimes : 1);++      if ((start.line > end.line) || (start.line == end.line && start.ch > end.ch)) var swap = true;+      pushInBuffer(cm.getRange(swap ? end : start, swap ? start : end));+      cm.replaceRange("", swap ? end : start, swap ? start : end);++      reptTimes = 0;+      cm.setOption('keyMap', 'vim-insert');+    };++    CodeMirror.keyMap['vim-prefix-y'][key] = function(cm) {+      var start = cm.getCursor();+      var end = motions[key](cm, reptTimes ? reptTimes : 1);++      if ((start.line > end.line) || (start.line == end.line && start.ch > end.ch)) var swap = true;+      pushInBuffer(cm.getRange(swap ? end : start, swap ? start : end));++      reptTimes = 0;+      cm.setOption("keyMap", "vim");+    };++    CodeMirror.keyMap['vim'][key] = function(cm) {+      var cur = motions[key](cm, reptTimes ? reptTimes : 1);+      cm.setCursor(cur.line, cur.ch);++      reptTimes = 0;+    };+  });++  var nums = [1,2,3,4,5,6,7,8,9];+  nums.forEach(function(key, index, array) {+    CodeMirror.keyMap['vim'][key] = function (cm) {+      reptTimes = (reptTimes * 10) + key;+    };+    CodeMirror.keyMap['vim-prefix-d'][key] = function (cm) {+      reptTimes = (reptTimes * 10) + key;+    };+    CodeMirror.keyMap['vim-prefix-y'][key] = function (cm) {+      reptTimes = (reptTimes * 10) + key;+    };+    CodeMirror.keyMap['vim-prefix-c'][key] = function (cm) {+      reptTimes = (reptTimes * 10) + key;+    };+  });++  // Create our keymaps for each operator and make xa and xi where x is an operator+  // change to the corrosponding keymap+  var operators = ['d', 'y', 'c'];+  operators.forEach(function(key, index, array) {+    CodeMirror.keyMap['vim-prefix-'+key+'a'] = {+      auto: 'vim', nofallthrough: true, style: "fat-cursor"+    };+    CodeMirror.keyMap['vim-prefix-'+key+'i'] = {+      auto: 'vim', nofallthrough: true, style: "fat-cursor"+    };++    CodeMirror.keyMap['vim-prefix-'+key]['A'] = function(cm) {+      reptTimes = 0;+      cm.setOption('keyMap', 'vim-prefix-' + key + 'a');+    };++    CodeMirror.keyMap['vim-prefix-'+key]['I'] = function(cm) {+      reptTimes = 0;+      cm.setOption('keyMap', 'vim-prefix-' + key + 'i');+    };+  });++  function regexLastIndexOf(string, pattern, startIndex) {+    for (var i = startIndex == null ? string.length : startIndex; i >= 0; --i)+      if (pattern.test(string.charAt(i))) return i;+    return -1;+  }++  // Create our text object functions. They work similar to motions but they+  // return a start cursor as well+  var textObjectList = ['W', 'Shift-[', 'Shift-9', '['];+  var textObjects = {+    'W': function(cm, inclusive) {+      var cur = cm.getCursor();+      var line = cm.getLine(cur.line);++      var line_to_char = new String(line.substring(0, cur.ch));+      var start = regexLastIndexOf(line_to_char, /[^a-zA-Z0-9]/) + 1;+      var end = motions["E"](cm, 1) ;++      end.ch += inclusive ? 1 : 0 ;+      return {start: {line: cur.line, ch: start}, end: end };+    },+    'Shift-[': function(cm, inclusive) { return selectCompanionObject(cm, '}', inclusive); },+    'Shift-9': function(cm, inclusive) { return selectCompanionObject(cm, ')', inclusive); },+    '[': function(cm, inclusive) { return selectCompanionObject(cm, ']', inclusive); }+  };++  // One function to handle all operation upon text objects. Kinda funky but it works+  // better than rewriting this code six times+  function textObjectManipulation(cm, object, remove, insert, inclusive) {+    // Object is the text object, delete object if remove is true, enter insert+    // mode if insert is true, inclusive is the difference between a and i+    var tmp = textObjects[object](cm, inclusive);+    var start = tmp.start;+    var end = tmp.end;++    if ((start.line > end.line) || (start.line == end.line && start.ch > end.ch)) var swap = true ;++    pushInBuffer(cm.getRange(swap ? end : start, swap ? start : end));+    if (remove) cm.replaceRange("", swap ? end : start, swap ? start : end);+    if (insert) cm.setOption('keyMap', 'vim-insert');+  }++  // And finally build the keymaps up from the text objects+  for (var i = 0; i < textObjectList.length; ++i) {+    var object = textObjectList[i];+    (function(object) {+      CodeMirror.keyMap['vim-prefix-di'][object] = function(cm) { textObjectManipulation(cm, object, true, false, false); };+      CodeMirror.keyMap['vim-prefix-da'][object] = function(cm) { textObjectManipulation(cm, object, true, false, true); };+      CodeMirror.keyMap['vim-prefix-yi'][object] = function(cm) { textObjectManipulation(cm, object, false, false, false); };+      CodeMirror.keyMap['vim-prefix-ya'][object] = function(cm) { textObjectManipulation(cm, object, false, false, true); };+      CodeMirror.keyMap['vim-prefix-ci'][object] = function(cm) { textObjectManipulation(cm, object, true, true, false); };+      CodeMirror.keyMap['vim-prefix-ca'][object] = function(cm) { textObjectManipulation(cm, object, true, true, true); };+    })(object)+  }+})();
+ static/codemirror/lib/codemirror.css view
@@ -0,0 +1,169 @@+.CodeMirror {+  line-height: 1em;+  font-family: monospace;++  /* Necessary so the scrollbar can be absolutely positioned within the wrapper on Lion. */+  position: relative;+  /* This prevents unwanted scrollbars from showing up on the body and wrapper in IE. */+  overflow: hidden;+}++.CodeMirror-scroll {+  overflow-x: auto;+  overflow-y: hidden;+  height: 300px;+  /* This is needed to prevent an IE[67] bug where the scrolled content+     is visible outside of the scrolling box. */+  position: relative;+  outline: none;+}++/* Vertical scrollbar */+.CodeMirror-scrollbar {+  float: right;+  overflow-x: hidden;+  overflow-y: scroll;++  /* This corrects for the 1px gap introduced to the left of the scrollbar+     by the rule for .CodeMirror-scrollbar-inner. */+  margin-left: -1px;+}+.CodeMirror-scrollbar-inner {+  /* This needs to have a nonzero width in order for the scrollbar to appear+     in Firefox and IE9. */+  width: 1px;+}+.CodeMirror-scrollbar.cm-sb-overlap {+  /* Ensure that the scrollbar appears in Lion, and that it overlaps the content+     rather than sitting to the right of it. */+  position: absolute;+  z-index: 1;+  float: none;+  right: 0;+  min-width: 12px;+}+.CodeMirror-scrollbar.cm-sb-nonoverlap {+  min-width: 12px;+}+.CodeMirror-scrollbar.cm-sb-ie7 {+  min-width: 18px;+}++.CodeMirror-gutter {+  position: absolute; left: 0; top: 0;+  z-index: 10;+  background-color: #f7f7f7;+  border-right: 1px solid #eee;+  min-width: 2em;+  height: 100%;+}+.CodeMirror-gutter-text {+  color: #aaa;+  text-align: right;+  padding: .4em .2em .4em .4em;+  white-space: pre !important;+  cursor: default;+}+.CodeMirror-lines {+  padding: .4em;+  white-space: pre;+  cursor: text;+}+.CodeMirror-lines * {+  /* Necessary for throw-scrolling to decelerate properly on Safari. */+  pointer-events: none;+}++.CodeMirror pre {+  -moz-border-radius: 0;+  -webkit-border-radius: 0;+  -o-border-radius: 0;+  border-radius: 0;+  border-width: 0; margin: 0; padding: 0; background: transparent;+  font-family: inherit;+  font-size: inherit;+  padding: 0; margin: 0;+  white-space: pre;+  word-wrap: normal;+  line-height: inherit;+  color: inherit;+}++.CodeMirror-wrap pre {+  word-wrap: break-word;+  white-space: pre-wrap;+  word-break: normal;+}+.CodeMirror-wrap .CodeMirror-scroll {+  overflow-x: hidden;+}++.CodeMirror textarea {+  outline: none !important;+}++.CodeMirror pre.CodeMirror-cursor {+  z-index: 10;+  position: absolute;+  visibility: hidden;+  border-left: 1px solid black;+  border-right: none;+  width: 0;+}+.cm-keymap-fat-cursor pre.CodeMirror-cursor {+  width: auto;+  border: 0;+  background: transparent;+  background: rgba(0, 200, 0, .4);+  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#6600c800, endColorstr=#4c00c800);+}+/* Kludge to turn off filter in ie9+, which also accepts rgba */+.cm-keymap-fat-cursor pre.CodeMirror-cursor:not(#nonsense_id) {+  filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);+}+.CodeMirror pre.CodeMirror-cursor.CodeMirror-overwrite {}+.CodeMirror-focused pre.CodeMirror-cursor {+  visibility: visible;+}++div.CodeMirror-selected { background: #d9d9d9; }+.CodeMirror-focused div.CodeMirror-selected { background: #d7d4f0; }++.CodeMirror-searching {+  background: #ffa;+  background: rgba(255, 255, 0, .4);+}++/* Default theme */++.cm-s-default span.cm-keyword {color: #708;}+.cm-s-default span.cm-atom {color: #219;}+.cm-s-default span.cm-number {color: #164;}+.cm-s-default span.cm-def {color: #00f;}+.cm-s-default span.cm-variable {color: black;}+.cm-s-default span.cm-variable-2 {color: #05a;}+.cm-s-default span.cm-variable-3 {color: #085;}+.cm-s-default span.cm-property {color: black;}+.cm-s-default span.cm-operator {color: black;}+.cm-s-default span.cm-comment {color: #a50;}+.cm-s-default span.cm-string {color: #a11;}+.cm-s-default span.cm-string-2 {color: #f50;}+.cm-s-default span.cm-meta {color: #555;}+.cm-s-default span.cm-error {color: #f00;}+.cm-s-default span.cm-qualifier {color: #555;}+.cm-s-default span.cm-builtin {color: #30a;}+.cm-s-default span.cm-bracket {color: #cc7;}+.cm-s-default span.cm-tag {color: #170;}+.cm-s-default span.cm-attribute {color: #00c;}+.cm-s-default span.cm-header {color: blue;}+.cm-s-default span.cm-quote {color: #090;}+.cm-s-default span.cm-hr {color: #999;}+.cm-s-default span.cm-link {color: #00c;}++span.cm-header, span.cm-strong {font-weight: bold;}+span.cm-em {font-style: italic;}+span.cm-emstrong {font-style: italic; font-weight: bold;}+span.cm-link {text-decoration: underline;}++div.CodeMirror span.CodeMirror-matchingbracket {color: #0f0;}+div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
+ static/codemirror/lib/codemirror.js view
@@ -0,0 +1,3231 @@+// CodeMirror version 2.32+//+// All functions that need access to the editor's state live inside+// the CodeMirror function. Below that, at the bottom of the file,+// some utilities are defined.++// CodeMirror is the only global var we claim+var CodeMirror = (function() {+  // This is the function that produces an editor instance. Its+  // closure is used to store the editor state.+  function CodeMirror(place, givenOptions) {+    // Determine effective options based on given values and defaults.+    var options = {}, defaults = CodeMirror.defaults;+    for (var opt in defaults)+      if (defaults.hasOwnProperty(opt))+        options[opt] = (givenOptions && givenOptions.hasOwnProperty(opt) ? givenOptions : defaults)[opt];++    // The element in which the editor lives.+    var wrapper = document.createElement("div");+    wrapper.className = "CodeMirror" + (options.lineWrapping ? " CodeMirror-wrap" : "");+    // This mess creates the base DOM structure for the editor.+    wrapper.innerHTML =+      '<div style="overflow: hidden; position: relative; width: 3px; height: 0px;">' + // Wraps and hides input textarea+        '<textarea style="position: absolute; padding: 0; width: 1px; height: 1em" wrap="off" ' ++          'autocorrect="off" autocapitalize="off"></textarea></div>' ++      '<div class="CodeMirror-scrollbar">' + // The vertical scrollbar. Horizontal scrolling is handled by the scroller itself.+        '<div class="CodeMirror-scrollbar-inner">' + // The empty scrollbar content, used solely for managing the scrollbar thumb.+      '</div></div>' + // This must be before the scroll area because it's float-right.+      '<div class="CodeMirror-scroll" tabindex="-1">' ++        '<div style="position: relative">' + // Set to the height of the text, causes scrolling+          '<div style="position: relative">' + // Moved around its parent to cover visible view+            '<div class="CodeMirror-gutter"><div class="CodeMirror-gutter-text"></div></div>' ++            // Provides positioning relative to (visible) text origin+            '<div class="CodeMirror-lines"><div style="position: relative; z-index: 0">' ++              // Used to measure text size+              '<div style="position: absolute; width: 100%; height: 0px; overflow: hidden; visibility: hidden;"></div>' ++              '<pre class="CodeMirror-cursor">&#160;</pre>' + // Absolutely positioned blinky cursor+              '<pre class="CodeMirror-cursor" style="visibility: hidden">&#160;</pre>' + // Used to force a width+              '<div style="position: relative; z-index: -1"></div><div></div>' + // DIVs containing the selection and the actual code+            '</div></div></div></div></div>';+    if (place.appendChild) place.appendChild(wrapper); else place(wrapper);+    // I've never seen more elegant code in my life.+    var inputDiv = wrapper.firstChild, input = inputDiv.firstChild,+        scroller = wrapper.lastChild, code = scroller.firstChild,+        mover = code.firstChild, gutter = mover.firstChild, gutterText = gutter.firstChild,+        lineSpace = gutter.nextSibling.firstChild, measure = lineSpace.firstChild,+        cursor = measure.nextSibling, widthForcer = cursor.nextSibling,+        selectionDiv = widthForcer.nextSibling, lineDiv = selectionDiv.nextSibling,+        scrollbar = inputDiv.nextSibling, scrollbarInner = scrollbar.firstChild;+    themeChanged(); keyMapChanged();+    // Needed to hide big blue blinking cursor on Mobile Safari+    if (ios) input.style.width = "0px";+    if (!webkit) scroller.draggable = true;+    lineSpace.style.outline = "none";+    if (options.tabindex != null) input.tabIndex = options.tabindex;+    if (options.autofocus) focusInput();+    if (!options.gutter && !options.lineNumbers) gutter.style.display = "none";+    // Needed to handle Tab key in KHTML+    if (khtml) inputDiv.style.height = "1px", inputDiv.style.position = "absolute";++    // Check for OS X >= 10.7. If so, we need to force a width on the scrollbar, and +    // make it overlap the content. (But we only do this if the scrollbar doesn't already+    // have a natural width. If the mouse is plugged in or the user sets the system pref+    // to always show scrollbars, the scrollbar shouldn't overlap.)+    if (mac_geLion) {+      scrollbar.className += (overlapScrollbars() ? " cm-sb-overlap" : " cm-sb-nonoverlap");+    } else if (ie_lt8) {+      // Need to set a minimum width to see the scrollbar on IE7 (but must not set it on IE8).+      scrollbar.className += " cm-sb-ie7";+    }++    // Check for problem with IE innerHTML not working when we have a+    // P (or similar) parent node.+    try { stringWidth("x"); }+    catch (e) {+      if (e.message.match(/runtime/i))+        e = new Error("A CodeMirror inside a P-style element does not work in Internet Explorer. (innerHTML bug)");+      throw e;+    }++    // Delayed object wrap timeouts, making sure only one is active. blinker holds an interval.+    var poll = new Delayed(), highlight = new Delayed(), blinker;++    // mode holds a mode API object. doc is the tree of Line objects,+    // work an array of lines that should be parsed, and history the+    // undo history (instance of History constructor).+    var mode, doc = new BranchChunk([new LeafChunk([new Line("")])]), work, focused;+    loadMode();+    // The selection. These are always maintained to point at valid+    // positions. Inverted is used to remember that the user is+    // selecting bottom-to-top.+    var sel = {from: {line: 0, ch: 0}, to: {line: 0, ch: 0}, inverted: false};+    // Selection-related flags. shiftSelecting obviously tracks+    // whether the user is holding shift.+    var shiftSelecting, lastClick, lastDoubleClick, lastScrollTop = 0, lastScrollLeft = 0, draggingText,+        overwrite = false, suppressEdits = false;+    // Variables used by startOperation/endOperation to track what+    // happened during the operation.+    var updateInput, userSelChange, changes, textChanged, selectionChanged, leaveInputAlone,+        gutterDirty, callbacks;+    // Current visible range (may be bigger than the view window).+    var displayOffset = 0, showingFrom = 0, showingTo = 0, lastSizeC = 0;+    // bracketHighlighted is used to remember that a bracket has been+    // marked.+    var bracketHighlighted;+    // Tracks the maximum line length so that the horizontal scrollbar+    // can be kept static when scrolling.+    var maxLine = "", updateMaxLine = false, maxLineChanged = true;+    var tabCache = {};++    // Initialize the content.+    operation(function(){setValue(options.value || ""); updateInput = false;})();+    var history = new History();++    // Register our event handlers.+    connect(scroller, "mousedown", operation(onMouseDown));+    connect(scroller, "dblclick", operation(onDoubleClick));+    connect(lineSpace, "selectstart", e_preventDefault);+    // Gecko browsers fire contextmenu *after* opening the menu, at+    // which point we can't mess with it anymore. Context menu is+    // handled in onMouseDown for Gecko.+    if (!gecko) connect(scroller, "contextmenu", onContextMenu);+    connect(scroller, "scroll", onScroll);+    connect(scrollbar, "scroll", onScroll);+    connect(scrollbar, "mousedown", function() {if (focused) setTimeout(focusInput, 0);});+    connect(scroller, "mousewheel", onMouseWheel);+    connect(scroller, "DOMMouseScroll", onMouseWheel);+    connect(window, "resize", function() {updateDisplay(true);});+    connect(input, "keyup", operation(onKeyUp));+    connect(input, "input", fastPoll);+    connect(input, "keydown", operation(onKeyDown));+    connect(input, "keypress", operation(onKeyPress));+    connect(input, "focus", onFocus);+    connect(input, "blur", onBlur);++    if (options.dragDrop) {+      connect(scroller, "dragstart", onDragStart);+      function drag_(e) {+        if (options.onDragEvent && options.onDragEvent(instance, addStop(e))) return;+        e_stop(e);+      }+      connect(scroller, "dragenter", drag_);+      connect(scroller, "dragover", drag_);+      connect(scroller, "drop", operation(onDrop));+    }+    connect(scroller, "paste", function(){focusInput(); fastPoll();});+    connect(input, "paste", fastPoll);+    connect(input, "cut", operation(function(){+      if (!options.readOnly) replaceSelection("");+    }));++    // Needed to handle Tab key in KHTML+    if (khtml) connect(code, "mouseup", function() {+        if (document.activeElement == input) input.blur();+        focusInput();+    });++    // IE throws unspecified error in certain cases, when+    // trying to access activeElement before onload+    var hasFocus; try { hasFocus = (document.activeElement == input); } catch(e) { }+    if (hasFocus || options.autofocus) setTimeout(onFocus, 20);+    else onBlur();++    function isLine(l) {return l >= 0 && l < doc.size;}+    // The instance object that we'll return. Mostly calls out to+    // local functions in the CodeMirror function. Some do some extra+    // range checking and/or clipping. operation is used to wrap the+    // call so that changes it makes are tracked, and the display is+    // updated afterwards.+    var instance = wrapper.CodeMirror = {+      getValue: getValue,+      setValue: operation(setValue),+      getSelection: getSelection,+      replaceSelection: operation(replaceSelection),+      focus: function(){window.focus(); focusInput(); onFocus(); fastPoll();},+      setOption: function(option, value) {+        var oldVal = options[option];+        options[option] = value;+        if (option == "mode" || option == "indentUnit") loadMode();+        else if (option == "readOnly" && value == "nocursor") {onBlur(); input.blur();}+        else if (option == "readOnly" && !value) {resetInput(true);}+        else if (option == "theme") themeChanged();+        else if (option == "lineWrapping" && oldVal != value) operation(wrappingChanged)();+        else if (option == "tabSize") updateDisplay(true);+        else if (option == "keyMap") keyMapChanged();+        if (option == "lineNumbers" || option == "gutter" || option == "firstLineNumber" || option == "theme") {+          gutterChanged();+          updateDisplay(true);+        }+      },+      getOption: function(option) {return options[option];},+      undo: operation(undo),+      redo: operation(redo),+      indentLine: operation(function(n, dir) {+        if (typeof dir != "string") {+          if (dir == null) dir = options.smartIndent ? "smart" : "prev";+          else dir = dir ? "add" : "subtract";+        }+        if (isLine(n)) indentLine(n, dir);+      }),+      indentSelection: operation(indentSelected),+      historySize: function() {return {undo: history.done.length, redo: history.undone.length};},+      clearHistory: function() {history = new History();},+      setHistory: function(histData) {+        history = new History();+        history.done = histData.done;+        history.undone = histData.undone;+      },+      getHistory: function() {+        history.time = 0;+        return {done: history.done.concat([]), undone: history.undone.concat([])};+      },+      matchBrackets: operation(function(){matchBrackets(true);}),+      getTokenAt: operation(function(pos) {+        pos = clipPos(pos);+        return getLine(pos.line).getTokenAt(mode, getStateBefore(pos.line), pos.ch);+      }),+      getStateAfter: function(line) {+        line = clipLine(line == null ? doc.size - 1: line);+        return getStateBefore(line + 1);+      },+      cursorCoords: function(start, mode) {+        if (start == null) start = sel.inverted;+        return this.charCoords(start ? sel.from : sel.to, mode);+      },+      charCoords: function(pos, mode) {+        pos = clipPos(pos);+        if (mode == "local") return localCoords(pos, false);+        if (mode == "div") return localCoords(pos, true);+        return pageCoords(pos);+      },+      coordsChar: function(coords) {+        var off = eltOffset(lineSpace);+        return coordsChar(coords.x - off.left, coords.y - off.top);+      },+      markText: operation(markText),+      setBookmark: setBookmark,+      findMarksAt: findMarksAt,+      setMarker: operation(addGutterMarker),+      clearMarker: operation(removeGutterMarker),+      setLineClass: operation(setLineClass),+      hideLine: operation(function(h) {return setLineHidden(h, true);}),+      showLine: operation(function(h) {return setLineHidden(h, false);}),+      onDeleteLine: function(line, f) {+        if (typeof line == "number") {+          if (!isLine(line)) return null;+          line = getLine(line);+        }+        (line.handlers || (line.handlers = [])).push(f);+        return line;+      },+      lineInfo: lineInfo,+      addWidget: function(pos, node, scroll, vert, horiz) {+        pos = localCoords(clipPos(pos));+        var top = pos.yBot, left = pos.x;+        node.style.position = "absolute";+        code.appendChild(node);+        if (vert == "over") top = pos.y;+        else if (vert == "near") {+          var vspace = Math.max(scroller.offsetHeight, doc.height * textHeight()),+              hspace = Math.max(code.clientWidth, lineSpace.clientWidth) - paddingLeft();+          if (pos.yBot + node.offsetHeight > vspace && pos.y > node.offsetHeight)+            top = pos.y - node.offsetHeight;+          if (left + node.offsetWidth > hspace)+            left = hspace - node.offsetWidth;+        }+        node.style.top = (top + paddingTop()) + "px";+        node.style.left = node.style.right = "";+        if (horiz == "right") {+          left = code.clientWidth - node.offsetWidth;+          node.style.right = "0px";+        } else {+          if (horiz == "left") left = 0;+          else if (horiz == "middle") left = (code.clientWidth - node.offsetWidth) / 2;+          node.style.left = (left + paddingLeft()) + "px";+        }+        if (scroll)+          scrollIntoView(left, top, left + node.offsetWidth, top + node.offsetHeight);+      },++      lineCount: function() {return doc.size;},+      clipPos: clipPos,+      getCursor: function(start) {+        if (start == null) start = sel.inverted;+        return copyPos(start ? sel.from : sel.to);+      },+      somethingSelected: function() {return !posEq(sel.from, sel.to);},+      setCursor: operation(function(line, ch, user) {+        if (ch == null && typeof line.line == "number") setCursor(line.line, line.ch, user);+        else setCursor(line, ch, user);+      }),+      setSelection: operation(function(from, to, user) {+        (user ? setSelectionUser : setSelection)(clipPos(from), clipPos(to || from));+      }),+      getLine: function(line) {if (isLine(line)) return getLine(line).text;},+      getLineHandle: function(line) {if (isLine(line)) return getLine(line);},+      setLine: operation(function(line, text) {+        if (isLine(line)) replaceRange(text, {line: line, ch: 0}, {line: line, ch: getLine(line).text.length});+      }),+      removeLine: operation(function(line) {+        if (isLine(line)) replaceRange("", {line: line, ch: 0}, clipPos({line: line+1, ch: 0}));+      }),+      replaceRange: operation(replaceRange),+      getRange: function(from, to, lineSep) {return getRange(clipPos(from), clipPos(to), lineSep);},++      triggerOnKeyDown: operation(onKeyDown),+      execCommand: function(cmd) {return commands[cmd](instance);},+      // Stuff used by commands, probably not much use to outside code.+      moveH: operation(moveH),+      deleteH: operation(deleteH),+      moveV: operation(moveV),+      toggleOverwrite: function() {+        if(overwrite){+          overwrite = false;+          cursor.className = cursor.className.replace(" CodeMirror-overwrite", "");+        } else {+          overwrite = true;+          cursor.className += " CodeMirror-overwrite";+        }+      },++      posFromIndex: function(off) {+        var lineNo = 0, ch;+        doc.iter(0, doc.size, function(line) {+          var sz = line.text.length + 1;+          if (sz > off) { ch = off; return true; }+          off -= sz;+          ++lineNo;+        });+        return clipPos({line: lineNo, ch: ch});+      },+      indexFromPos: function (coords) {+        if (coords.line < 0 || coords.ch < 0) return 0;+        var index = coords.ch;+        doc.iter(0, coords.line, function (line) {+          index += line.text.length + 1;+        });+        return index;+      },+      scrollTo: function(x, y) {+        if (x != null) scroller.scrollLeft = x;+        if (y != null) scrollbar.scrollTop = y;+        updateDisplay([]);+      },+      getScrollInfo: function() {+        return {x: scroller.scrollLeft, y: scrollbar.scrollTop,+                height: scrollbar.scrollHeight, width: scroller.scrollWidth};+      },+      setSize: function(width, height) {+        function interpret(val) {+          val = String(val);+          return /^\d+$/.test(val) ? val + "px" : val;+        }+        if (width != null) wrapper.style.width = interpret(width);+        if (height != null) scroller.style.height = interpret(height);+      },++      operation: function(f){return operation(f)();},+      compoundChange: function(f){return compoundChange(f);},+      refresh: function(){+        updateDisplay(true, null, lastScrollTop);+        if (scrollbar.scrollHeight > lastScrollTop)+          scrollbar.scrollTop = lastScrollTop;+      },+      getInputField: function(){return input;},+      getWrapperElement: function(){return wrapper;},+      getScrollerElement: function(){return scroller;},+      getGutterElement: function(){return gutter;}+    };++    function getLine(n) { return getLineAt(doc, n); }+    function updateLineHeight(line, height) {+      gutterDirty = true;+      var diff = height - line.height;+      for (var n = line; n; n = n.parent) n.height += diff;+    }++    function setValue(code) {+      var top = {line: 0, ch: 0};+      updateLines(top, {line: doc.size - 1, ch: getLine(doc.size-1).text.length},+                  splitLines(code), top, top);+      updateInput = true;+    }+    function getValue(lineSep) {+      var text = [];+      doc.iter(0, doc.size, function(line) { text.push(line.text); });+      return text.join(lineSep || "\n");+    }++    function onScroll(e) {+      if (scroller.scrollTop) {+        scrollbar.scrollTop += scroller.scrollTop;+        scroller.scrollTop = 0;+      }+      if (lastScrollTop != scrollbar.scrollTop || lastScrollLeft != scroller.scrollLeft) {+        lastScrollTop = scrollbar.scrollTop;+        lastScrollLeft = scroller.scrollLeft;+        updateDisplay([]);+        if (options.fixedGutter) gutter.style.left = scroller.scrollLeft + "px";+        if (options.onScroll) options.onScroll(instance);+      }+    }++    function onMouseDown(e) {+      setShift(e_prop(e, "shiftKey"));+      // Check whether this is a click in a widget+      for (var n = e_target(e); n != wrapper; n = n.parentNode)+        if (n.parentNode == code && n != mover) return;++      // See if this is a click in the gutter+      for (var n = e_target(e); n != wrapper; n = n.parentNode)+        if (n.parentNode == gutterText) {+          if (options.onGutterClick)+            options.onGutterClick(instance, indexOf(gutterText.childNodes, n) + showingFrom, e);+          return e_preventDefault(e);+        }++      var start = posFromMouse(e);++      switch (e_button(e)) {+      case 3:+        if (gecko) onContextMenu(e);+        return;+      case 2:+        if (start) setCursor(start.line, start.ch, true);+        setTimeout(focusInput, 20);+        e_preventDefault(e);+        return;+      }+      // For button 1, if it was clicked inside the editor+      // (posFromMouse returning non-null), we have to adjust the+      // selection.+      if (!start) {if (e_target(e) == scroller) e_preventDefault(e); return;}++      if (!focused) onFocus();++      var now = +new Date, type = "single";+      if (lastDoubleClick && lastDoubleClick.time > now - 400 && posEq(lastDoubleClick.pos, start)) {+        type = "triple";+        e_preventDefault(e);+        setTimeout(focusInput, 20);+        selectLine(start.line);+      } else if (lastClick && lastClick.time > now - 400 && posEq(lastClick.pos, start)) {+        type = "double";+        lastDoubleClick = {time: now, pos: start};+        e_preventDefault(e);+        var word = findWordAt(start);+        setSelectionUser(word.from, word.to);+      } else { lastClick = {time: now, pos: start}; }++      var last = start, going;+      if (options.dragDrop && dragAndDrop && !options.readOnly && !posEq(sel.from, sel.to) &&+          !posLess(start, sel.from) && !posLess(sel.to, start) && type == "single") {+        // Let the drag handler handle this.+        if (webkit) scroller.draggable = true;+        function dragEnd(e2) {+          if (webkit) scroller.draggable = false;+          draggingText = false;+          up(); drop();+          if (Math.abs(e.clientX - e2.clientX) + Math.abs(e.clientY - e2.clientY) < 10) {+            e_preventDefault(e2);+            setCursor(start.line, start.ch, true);+            focusInput();+          }+        }+        var up = connect(document, "mouseup", operation(dragEnd), true);+        var drop = connect(scroller, "drop", operation(dragEnd), true);+        draggingText = true;+        // IE's approach to draggable+        if (scroller.dragDrop) scroller.dragDrop();+        return;+      }+      e_preventDefault(e);+      if (type == "single") setCursor(start.line, start.ch, true);++      var startstart = sel.from, startend = sel.to;++      function doSelect(cur) {+        if (type == "single") {+          setSelectionUser(start, cur);+        } else if (type == "double") {+          var word = findWordAt(cur);+          if (posLess(cur, startstart)) setSelectionUser(word.from, startend);+          else setSelectionUser(startstart, word.to);+        } else if (type == "triple") {+          if (posLess(cur, startstart)) setSelectionUser(startend, clipPos({line: cur.line, ch: 0}));+          else setSelectionUser(startstart, clipPos({line: cur.line + 1, ch: 0}));+        }+      }++      function extend(e) {+        var cur = posFromMouse(e, true);+        if (cur && !posEq(cur, last)) {+          if (!focused) onFocus();+          last = cur;+          doSelect(cur);+          updateInput = false;+          var visible = visibleLines();+          if (cur.line >= visible.to || cur.line < visible.from)+            going = setTimeout(operation(function(){extend(e);}), 150);+        }+      }++      function done(e) {+        clearTimeout(going);+        var cur = posFromMouse(e);+        if (cur) doSelect(cur);+        e_preventDefault(e);+        focusInput();+        updateInput = true;+        move(); up();+      }+      var move = connect(document, "mousemove", operation(function(e) {+        clearTimeout(going);+        e_preventDefault(e);+        if (!ie && !e_button(e)) done(e);+        else extend(e);+      }), true);+      var up = connect(document, "mouseup", operation(done), true);+    }+    function onDoubleClick(e) {+      for (var n = e_target(e); n != wrapper; n = n.parentNode)+        if (n.parentNode == gutterText) return e_preventDefault(e);+      e_preventDefault(e);+    }+    function onDrop(e) {+      if (options.onDragEvent && options.onDragEvent(instance, addStop(e))) return;+      e.preventDefault();+      var pos = posFromMouse(e, true), files = e.dataTransfer.files;+      if (!pos || options.readOnly) return;+      if (files && files.length && window.FileReader && window.File) {+        function loadFile(file, i) {+          var reader = new FileReader;+          reader.onload = function() {+            text[i] = reader.result;+            if (++read == n) {+              pos = clipPos(pos);+              operation(function() {+                var end = replaceRange(text.join(""), pos, pos);+                setSelectionUser(pos, end);+              })();+            }+          };+          reader.readAsText(file);+        }+        var n = files.length, text = Array(n), read = 0;+        for (var i = 0; i < n; ++i) loadFile(files[i], i);+      } else {+        // Don't do a replace if the drop happened inside of the selected text.+        if (draggingText && !(posLess(pos, sel.from) || posLess(sel.to, pos))) return;+        try {+          var text = e.dataTransfer.getData("Text");+          if (text) {+            compoundChange(function() {+              var curFrom = sel.from, curTo = sel.to;+              setSelectionUser(pos, pos);+              if (draggingText) replaceRange("", curFrom, curTo);+              replaceSelection(text);+              focusInput();+            });+          }+        }+        catch(e){}+      }+    }+    function onDragStart(e) {+      var txt = getSelection();+      e.dataTransfer.setData("Text", txt);+      +      // Use dummy image instead of default browsers image.+      if (gecko || chrome || opera) {+        var img = document.createElement('img');+        img.scr = 'data:image/gif;base64,R0lGODdhAgACAIAAAAAAAP///ywAAAAAAgACAAACAoRRADs='; //1x1 image+        e.dataTransfer.setDragImage(img, 0, 0);+      }+    }++    function doHandleBinding(bound, dropShift) {+      if (typeof bound == "string") {+        bound = commands[bound];+        if (!bound) return false;+      }+      var prevShift = shiftSelecting;+      try {+        if (options.readOnly) suppressEdits = true;+        if (dropShift) shiftSelecting = null;+        bound(instance);+      } catch(e) {+        if (e != Pass) throw e;+        return false;+      } finally {+        shiftSelecting = prevShift;+        suppressEdits = false;+      }+      return true;+    }+    function handleKeyBinding(e) {+      // Handle auto keymap transitions+      var startMap = getKeyMap(options.keyMap), next = startMap.auto;+      clearTimeout(maybeTransition);+      if (next && !isModifierKey(e)) maybeTransition = setTimeout(function() {+        if (getKeyMap(options.keyMap) == startMap) {+          options.keyMap = (next.call ? next.call(null, instance) : next);+        }+      }, 50);++      var name = keyNames[e_prop(e, "keyCode")], handled = false;+      if (name == null || e.altGraphKey) return false;+      if (e_prop(e, "altKey")) name = "Alt-" + name;+      if (e_prop(e, "ctrlKey")) name = "Ctrl-" + name;+      if (e_prop(e, "metaKey")) name = "Cmd-" + name;++      var stopped = false;+      function stop() { stopped = true; }++      if (e_prop(e, "shiftKey")) {+        handled = lookupKey("Shift-" + name, options.extraKeys, options.keyMap,+                            function(b) {return doHandleBinding(b, true);}, stop)+               || lookupKey(name, options.extraKeys, options.keyMap, function(b) {+                 if (typeof b == "string" && /^go[A-Z]/.test(b)) return doHandleBinding(b);+               }, stop);+      } else {+        handled = lookupKey(name, options.extraKeys, options.keyMap, doHandleBinding, stop);+      }+      if (stopped) handled = false;+      if (handled) {+        e_preventDefault(e);+        restartBlink();+        if (ie) { e.oldKeyCode = e.keyCode; e.keyCode = 0; }+      }+      return handled;+    }+    function handleCharBinding(e, ch) {+      var handled = lookupKey("'" + ch + "'", options.extraKeys,+                              options.keyMap, function(b) { return doHandleBinding(b, true); });+      if (handled) {+        e_preventDefault(e);+        restartBlink();+      }+      return handled;+    }++    var lastStoppedKey = null, maybeTransition;+    function onKeyDown(e) {+      if (!focused) onFocus();+      if (ie && e.keyCode == 27) { e.returnValue = false; }+      if (pollingFast) { if (readInput()) pollingFast = false; }+      if (options.onKeyEvent && options.onKeyEvent(instance, addStop(e))) return;+      var code = e_prop(e, "keyCode");+      // IE does strange things with escape.+      setShift(code == 16 || e_prop(e, "shiftKey"));+      // First give onKeyEvent option a chance to handle this.+      var handled = handleKeyBinding(e);+      if (opera) {+        lastStoppedKey = handled ? code : null;+        // Opera has no cut event... we try to at least catch the key combo+        if (!handled && code == 88 && e_prop(e, mac ? "metaKey" : "ctrlKey"))+          replaceSelection("");+      }+    }+    function onKeyPress(e) {+      if (pollingFast) readInput();+      if (options.onKeyEvent && options.onKeyEvent(instance, addStop(e))) return;+      var keyCode = e_prop(e, "keyCode"), charCode = e_prop(e, "charCode");+      if (opera && keyCode == lastStoppedKey) {lastStoppedKey = null; e_preventDefault(e); return;}+      if (((opera && (!e.which || e.which < 10)) || khtml) && handleKeyBinding(e)) return;+      var ch = String.fromCharCode(charCode == null ? keyCode : charCode);+      if (options.electricChars && mode.electricChars && options.smartIndent && !options.readOnly) {+        if (mode.electricChars.indexOf(ch) > -1)+          setTimeout(operation(function() {indentLine(sel.to.line, "smart");}), 75);+      }+      if (handleCharBinding(e, ch)) return;+      fastPoll();+    }+    function onKeyUp(e) {+      if (options.onKeyEvent && options.onKeyEvent(instance, addStop(e))) return;+      if (e_prop(e, "keyCode") == 16) shiftSelecting = null;+    }++    function onFocus() {+      if (options.readOnly == "nocursor") return;+      if (!focused) {+        if (options.onFocus) options.onFocus(instance);+        focused = true;+        if (scroller.className.search(/\bCodeMirror-focused\b/) == -1)+          scroller.className += " CodeMirror-focused";+        if (!leaveInputAlone) resetInput(true);+      }+      slowPoll();+      restartBlink();+    }+    function onBlur() {+      if (focused) {+        if (options.onBlur) options.onBlur(instance);+        focused = false;+        if (bracketHighlighted)+          operation(function(){+            if (bracketHighlighted) { bracketHighlighted(); bracketHighlighted = null; }+          })();+        scroller.className = scroller.className.replace(" CodeMirror-focused", "");+      }+      clearInterval(blinker);+      setTimeout(function() {if (!focused) shiftSelecting = null;}, 150);+    }++    function chopDelta(delta) {+      // Make sure we always scroll a little bit for any nonzero delta.+      if (delta > 0.0 && delta < 1.0) return 1;+      else if (delta > -1.0 && delta < 0.0) return -1;+      else return Math.round(delta);+    }++    function onMouseWheel(e) {+      var deltaX = 0, deltaY = 0;+      if (e.type == "DOMMouseScroll") { // Firefox+        var delta = -e.detail * 8.0;+        if (e.axis == e.HORIZONTAL_AXIS) deltaX = delta;+        else if (e.axis == e.VERTICAL_AXIS) deltaY = delta;+      } else if (e.wheelDeltaX !== undefined && e.wheelDeltaY !== undefined) { // WebKit+        deltaX = e.wheelDeltaX / 3.0;+        deltaY = e.wheelDeltaY / 3.0;+      } else if (e.wheelDelta !== undefined) { // IE or Opera+        deltaY = e.wheelDelta / 3.0;+      }++      var scrolled = false;+      deltaX = chopDelta(deltaX);+      deltaY = chopDelta(deltaY);+      if ((deltaX > 0 && scroller.scrollLeft > 0) ||+          (deltaX < 0 && scroller.scrollLeft + scroller.clientWidth < scroller.scrollWidth)) {+        scroller.scrollLeft -= deltaX;+        scrolled = true;+      }+      if ((deltaY > 0 && scrollbar.scrollTop > 0) ||+          (deltaY < 0 && scrollbar.scrollTop + scrollbar.clientHeight < scrollbar.scrollHeight)) {+        scrollbar.scrollTop -= deltaY;+        scrolled = true;+      }+      if (scrolled) e_stop(e);+    }++    // Replace the range from from to to by the strings in newText.+    // Afterwards, set the selection to selFrom, selTo.+    function updateLines(from, to, newText, selFrom, selTo) {+      if (suppressEdits) return;+      if (history) {+        var old = [];+        doc.iter(from.line, to.line + 1, function(line) { old.push(line.text); });+        history.addChange(from.line, newText.length, old);+        while (history.done.length > options.undoDepth) history.done.shift();+      }+      updateLinesNoUndo(from, to, newText, selFrom, selTo);+    }+    function unredoHelper(from, to) {+      if (!from.length) return;+      var set = from.pop(), out = [];+      for (var i = set.length - 1; i >= 0; i -= 1) {+        var change = set[i];+        var replaced = [], end = change.start + change.added;+        doc.iter(change.start, end, function(line) { replaced.push(line.text); });+        out.push({start: change.start, added: change.old.length, old: replaced});+        var pos = {line: change.start + change.old.length - 1,+                   ch: editEnd(replaced[replaced.length-1], change.old[change.old.length-1])};+        updateLinesNoUndo({line: change.start, ch: 0}, {line: end - 1, ch: getLine(end-1).text.length}, change.old, pos, pos);+      }+      updateInput = true;+      to.push(out);+    }+    function undo() {unredoHelper(history.done, history.undone);}+    function redo() {unredoHelper(history.undone, history.done);}++    function updateLinesNoUndo(from, to, newText, selFrom, selTo) {+      if (suppressEdits) return;+      var recomputeMaxLength = false, maxLineLength = maxLine.length;+      if (!options.lineWrapping)+        doc.iter(from.line, to.line + 1, function(line) {+          if (!line.hidden && line.text.length == maxLineLength) {recomputeMaxLength = true; return true;}+        });+      if (from.line != to.line || newText.length > 1) gutterDirty = true;++      var nlines = to.line - from.line, firstLine = getLine(from.line), lastLine = getLine(to.line);+      // First adjust the line structure, taking some care to leave highlighting intact.+      if (from.ch == 0 && to.ch == 0 && newText[newText.length - 1] == "") {+        // This is a whole-line replace. Treated specially to make+        // sure line objects move the way they are supposed to.+        var added = [], prevLine = null;+        if (from.line) {+          prevLine = getLine(from.line - 1);+          prevLine.fixMarkEnds(lastLine);+        } else lastLine.fixMarkStarts();+        for (var i = 0, e = newText.length - 1; i < e; ++i)+          added.push(Line.inheritMarks(newText[i], prevLine));+        if (nlines) doc.remove(from.line, nlines, callbacks);+        if (added.length) doc.insert(from.line, added);+      } else if (firstLine == lastLine) {+        if (newText.length == 1)+          firstLine.replace(from.ch, to.ch, newText[0]);+        else {+          lastLine = firstLine.split(to.ch, newText[newText.length-1]);+          firstLine.replace(from.ch, null, newText[0]);+          firstLine.fixMarkEnds(lastLine);+          var added = [];+          for (var i = 1, e = newText.length - 1; i < e; ++i)+            added.push(Line.inheritMarks(newText[i], firstLine));+          added.push(lastLine);+          doc.insert(from.line + 1, added);+        }+      } else if (newText.length == 1) {+        firstLine.replace(from.ch, null, newText[0]);+        lastLine.replace(null, to.ch, "");+        firstLine.append(lastLine);+        doc.remove(from.line + 1, nlines, callbacks);+      } else {+        var added = [];+        firstLine.replace(from.ch, null, newText[0]);+        lastLine.replace(null, to.ch, newText[newText.length-1]);+        firstLine.fixMarkEnds(lastLine);+        for (var i = 1, e = newText.length - 1; i < e; ++i)+          added.push(Line.inheritMarks(newText[i], firstLine));+        if (nlines > 1) doc.remove(from.line + 1, nlines - 1, callbacks);+        doc.insert(from.line + 1, added);+      }+      if (options.lineWrapping) {+        var perLine = Math.max(5, scroller.clientWidth / charWidth() - 3);+        doc.iter(from.line, from.line + newText.length, function(line) {+          if (line.hidden) return;+          var guess = Math.ceil(line.text.length / perLine) || 1;+          if (guess != line.height) updateLineHeight(line, guess);+        });+      } else {+        doc.iter(from.line, from.line + newText.length, function(line) {+          var l = line.text;+          if (!line.hidden && l.length > maxLineLength) {+            maxLine = l; maxLineLength = l.length; maxLineChanged = true;+            recomputeMaxLength = false;+          }+        });+        if (recomputeMaxLength) updateMaxLine = true;+      }++      // Add these lines to the work array, so that they will be+      // highlighted. Adjust work lines if lines were added/removed.+      var newWork = [], lendiff = newText.length - nlines - 1;+      for (var i = 0, l = work.length; i < l; ++i) {+        var task = work[i];+        if (task < from.line) newWork.push(task);+        else if (task > to.line) newWork.push(task + lendiff);+      }+      var hlEnd = from.line + Math.min(newText.length, 500);+      highlightLines(from.line, hlEnd);+      newWork.push(hlEnd);+      work = newWork;+      startWorker(100);+      // Remember that these lines changed, for updating the display+      changes.push({from: from.line, to: to.line + 1, diff: lendiff});+      var changeObj = {from: from, to: to, text: newText};+      if (textChanged) {+        for (var cur = textChanged; cur.next; cur = cur.next) {}+        cur.next = changeObj;+      } else textChanged = changeObj;++      // Update the selection+      function updateLine(n) {return n <= Math.min(to.line, to.line + lendiff) ? n : n + lendiff;}+      setSelection(clipPos(selFrom), clipPos(selTo),+                   updateLine(sel.from.line), updateLine(sel.to.line));+    }++    function needsScrollbar() {+      var realHeight = doc.height * textHeight() + 2 * paddingTop();+      return realHeight - 1 > scroller.offsetHeight ? realHeight : false;+    }++    function updateVerticalScroll(scrollTop) {+      var scrollHeight = needsScrollbar();+      scrollbar.style.display = scrollHeight ? "block" : "none";+      if (scrollHeight) {+        scrollbarInner.style.height = scrollHeight + "px";+        scrollbar.style.height = scroller.offsetHeight + "px";+        if (scrollTop != null) scrollbar.scrollTop = scrollTop;+      }+      // Position the mover div to align with the current virtual scroll position+      mover.style.top = (displayOffset * textHeight() - scrollbar.scrollTop) + "px";+    }+  +    // On Mac OS X Lion and up, detect whether the mouse is plugged in by measuring +    // the width of a div with a scrollbar in it. If the width is <= 1, then+    // the mouse isn't plugged in and scrollbars should overlap the content.+    function overlapScrollbars() {+      var tmpSb = document.createElement('div'),+          tmpSbInner = document.createElement('div');+      tmpSb.className = "CodeMirror-scrollbar";+      tmpSb.style.cssText = "position: absolute; left: -9999px; height: 100px;";+      tmpSbInner.className = "CodeMirror-scrollbar-inner";+      tmpSbInner.style.height = "200px";+      tmpSb.appendChild(tmpSbInner);++      document.body.appendChild(tmpSb);+      var result = (tmpSb.offsetWidth <= 1);+      document.body.removeChild(tmpSb);+      return result;+    }++    function computeMaxLength() {+      var maxLineLength = 0; +      maxLine = ""; maxLineChanged = true;+      doc.iter(0, doc.size, function(line) {+        var l = line.text;+        if (!line.hidden && l.length > maxLineLength) {+          maxLineLength = l.length; maxLine = l;+        }+      });+      updateMaxLine = false;+    }++    function replaceRange(code, from, to) {+      from = clipPos(from);+      if (!to) to = from; else to = clipPos(to);+      code = splitLines(code);+      function adjustPos(pos) {+        if (posLess(pos, from)) return pos;+        if (!posLess(to, pos)) return end;+        var line = pos.line + code.length - (to.line - from.line) - 1;+        var ch = pos.ch;+        if (pos.line == to.line)+          ch += code[code.length-1].length - (to.ch - (to.line == from.line ? from.ch : 0));+        return {line: line, ch: ch};+      }+      var end;+      replaceRange1(code, from, to, function(end1) {+        end = end1;+        return {from: adjustPos(sel.from), to: adjustPos(sel.to)};+      });+      return end;+    }+    function replaceSelection(code, collapse) {+      replaceRange1(splitLines(code), sel.from, sel.to, function(end) {+        if (collapse == "end") return {from: end, to: end};+        else if (collapse == "start") return {from: sel.from, to: sel.from};+        else return {from: sel.from, to: end};+      });+    }+    function replaceRange1(code, from, to, computeSel) {+      var endch = code.length == 1 ? code[0].length + from.ch : code[code.length-1].length;+      var newSel = computeSel({line: from.line + code.length - 1, ch: endch});+      updateLines(from, to, code, newSel.from, newSel.to);+    }++    function getRange(from, to, lineSep) {+      var l1 = from.line, l2 = to.line;+      if (l1 == l2) return getLine(l1).text.slice(from.ch, to.ch);+      var code = [getLine(l1).text.slice(from.ch)];+      doc.iter(l1 + 1, l2, function(line) { code.push(line.text); });+      code.push(getLine(l2).text.slice(0, to.ch));+      return code.join(lineSep || "\n");+    }+    function getSelection(lineSep) {+      return getRange(sel.from, sel.to, lineSep);+    }++    var pollingFast = false; // Ensures slowPoll doesn't cancel fastPoll+    function slowPoll() {+      if (pollingFast) return;+      poll.set(options.pollInterval, function() {+        startOperation();+        readInput();+        if (focused) slowPoll();+        endOperation();+      });+    }+    function fastPoll() {+      var missed = false;+      pollingFast = true;+      function p() {+        startOperation();+        var changed = readInput();+        if (!changed && !missed) {missed = true; poll.set(60, p);}+        else {pollingFast = false; slowPoll();}+        endOperation();+      }+      poll.set(20, p);+    }++    // Previnput is a hack to work with IME. If we reset the textarea+    // on every change, that breaks IME. So we look for changes+    // compared to the previous content instead. (Modern browsers have+    // events that indicate IME taking place, but these are not widely+    // supported or compatible enough yet to rely on.)+    var prevInput = "";+    function readInput() {+      if (leaveInputAlone || !focused || hasSelection(input) || options.readOnly) return false;+      var text = input.value;+      if (text == prevInput) return false;+      shiftSelecting = null;+      var same = 0, l = Math.min(prevInput.length, text.length);+      while (same < l && prevInput[same] == text[same]) ++same;+      if (same < prevInput.length)+        sel.from = {line: sel.from.line, ch: sel.from.ch - (prevInput.length - same)};+      else if (overwrite && posEq(sel.from, sel.to))+        sel.to = {line: sel.to.line, ch: Math.min(getLine(sel.to.line).text.length, sel.to.ch + (text.length - same))};+      replaceSelection(text.slice(same), "end");+      if (text.length > 1000) { input.value = prevInput = ""; }+      else prevInput = text;+      return true;+    }+    function resetInput(user) {+      if (!posEq(sel.from, sel.to)) {+        prevInput = "";+        input.value = getSelection();+        selectInput(input);+      } else if (user) prevInput = input.value = "";+    }++    function focusInput() {+      if (options.readOnly != "nocursor") input.focus();+    }++    function scrollEditorIntoView() {+      var rect = cursor.getBoundingClientRect();+      // IE returns bogus coordinates when the instance sits inside of an iframe and the cursor is hidden+      if (ie && rect.top == rect.bottom) return;+      var winH = window.innerHeight || Math.max(document.body.offsetHeight, document.documentElement.offsetHeight);+      if (rect.top < 0 || rect.bottom > winH) scrollCursorIntoView();+    }+    function scrollCursorIntoView() {+      var coords = calculateCursorCoords();+      return scrollIntoView(coords.x, coords.y, coords.x, coords.yBot);+    }+    function calculateCursorCoords() {+      var cursor = localCoords(sel.inverted ? sel.from : sel.to);+      var x = options.lineWrapping ? Math.min(cursor.x, lineSpace.offsetWidth) : cursor.x;+      return {x: x, y: cursor.y, yBot: cursor.yBot};+    }+    function scrollIntoView(x1, y1, x2, y2) {+      var scrollPos = calculateScrollPos(x1, y1, x2, y2), scrolled = false;+      if (scrollPos.scrollLeft != null) {scroller.scrollLeft = scrollPos.scrollLeft; scrolled = true;}+      if (scrollPos.scrollTop != null) {scrollbar.scrollTop = scrollPos.scrollTop; scrolled = true;}+      if (scrolled && options.onScroll) options.onScroll(instance);+    }+    function calculateScrollPos(x1, y1, x2, y2) {+      var pl = paddingLeft(), pt = paddingTop();+      y1 += pt; y2 += pt; x1 += pl; x2 += pl;+      var screen = scroller.clientHeight, screentop = scrollbar.scrollTop, result = {};+      var docBottom = scroller.scrollHeight;+      var atTop = y1 < pt + 10, atBottom = y2 + pt > docBottom - 10;;+      if (y1 < screentop) result.scrollTop = atTop ? 0 : Math.max(0, y1);+      else if (y2 > screentop + screen) result.scrollTop = (atBottom ? docBottom : y2) - screen;++      var screenw = scroller.clientWidth, screenleft = scroller.scrollLeft;+      var gutterw = options.fixedGutter ? gutter.clientWidth : 0;+      var atLeft = x1 < gutterw + pl + 10;+      if (x1 < screenleft + gutterw || atLeft) {+        if (atLeft) x1 = 0;+        result.scrollLeft = Math.max(0, x1 - 10 - gutterw);+      } else if (x2 > screenw + screenleft - 3) {+        result.scrollLeft = x2 + 10 - screenw;+      }+      return result;+    }++    function visibleLines(scrollTop) {+      var lh = textHeight(), top = (scrollTop != null ? scrollTop : scrollbar.scrollTop) - paddingTop();+      var fromHeight = Math.max(0, Math.floor(top / lh));+      var toHeight = Math.ceil((top + scroller.clientHeight) / lh);+      return {from: lineAtHeight(doc, fromHeight),+              to: lineAtHeight(doc, toHeight)};+    }+    // Uses a set of changes plus the current scroll position to+    // determine which DOM updates have to be made, and makes the+    // updates.+    function updateDisplay(changes, suppressCallback, scrollTop) {+      if (!scroller.clientWidth) {+        showingFrom = showingTo = displayOffset = 0;+        return;+      }+      // Compute the new visible window+      // If scrollTop is specified, use that to determine which lines+      // to render instead of the current scrollbar position.+      var visible = visibleLines(scrollTop);+      // Bail out if the visible area is already rendered and nothing changed.+      if (changes !== true && changes.length == 0 && visible.from > showingFrom && visible.to < showingTo) {+        updateVerticalScroll(scrollTop);+        return;+      }+      var from = Math.max(visible.from - 100, 0), to = Math.min(doc.size, visible.to + 100);+      if (showingFrom < from && from - showingFrom < 20) from = showingFrom;+      if (showingTo > to && showingTo - to < 20) to = Math.min(doc.size, showingTo);++      // Create a range of theoretically intact lines, and punch holes+      // in that using the change info.+      var intact = changes === true ? [] :+        computeIntact([{from: showingFrom, to: showingTo, domStart: 0}], changes);+      // Clip off the parts that won't be visible+      var intactLines = 0;+      for (var i = 0; i < intact.length; ++i) {+        var range = intact[i];+        if (range.from < from) {range.domStart += (from - range.from); range.from = from;}+        if (range.to > to) range.to = to;+        if (range.from >= range.to) intact.splice(i--, 1);+        else intactLines += range.to - range.from;+      }+      if (intactLines == to - from && from == showingFrom && to == showingTo) {+        updateVerticalScroll(scrollTop);+        return;+      }+      intact.sort(function(a, b) {return a.domStart - b.domStart;});++      var th = textHeight(), gutterDisplay = gutter.style.display;+      lineDiv.style.display = "none";+      patchDisplay(from, to, intact);+      lineDiv.style.display = gutter.style.display = "";++      var different = from != showingFrom || to != showingTo || lastSizeC != scroller.clientHeight + th;+      // This is just a bogus formula that detects when the editor is+      // resized or the font size changes.+      if (different) lastSizeC = scroller.clientHeight + th;+      showingFrom = from; showingTo = to;+      displayOffset = heightAtLine(doc, from);++      // Since this is all rather error prone, it is honoured with the+      // only assertion in the whole file.+      if (lineDiv.childNodes.length != showingTo - showingFrom)+        throw new Error("BAD PATCH! " + JSON.stringify(intact) + " size=" + (showingTo - showingFrom) ++                        " nodes=" + lineDiv.childNodes.length);++      function checkHeights() {+        var curNode = lineDiv.firstChild, heightChanged = false;+        doc.iter(showingFrom, showingTo, function(line) {+          if (!line.hidden) {+            var height = Math.round(curNode.offsetHeight / th) || 1;+            if (line.height != height) {+              updateLineHeight(line, height);+              gutterDirty = heightChanged = true;+            }+          }+          curNode = curNode.nextSibling;+        });+        return heightChanged;+      }++      if (options.lineWrapping) {+        checkHeights();+        var scrollHeight = needsScrollbar();+        var shouldHaveScrollbar = scrollHeight ? "block" : "none";+        if (scrollbar.style.display != shouldHaveScrollbar) {+          scrollbar.style.display = shouldHaveScrollbar;+          if (scrollHeight) scrollbarInner.style.height = scrollHeight + "px";+          checkHeights();+        }+      }++      gutter.style.display = gutterDisplay;+      if (different || gutterDirty) {+        // If the gutter grew in size, re-check heights. If those changed, re-draw gutter.+        updateGutter() && options.lineWrapping && checkHeights() && updateGutter();+      }+      updateVerticalScroll(scrollTop);+      updateSelection();+      if (!suppressCallback && options.onUpdate) options.onUpdate(instance);+      return true;+    }++    function computeIntact(intact, changes) {+      for (var i = 0, l = changes.length || 0; i < l; ++i) {+        var change = changes[i], intact2 = [], diff = change.diff || 0;+        for (var j = 0, l2 = intact.length; j < l2; ++j) {+          var range = intact[j];+          if (change.to <= range.from && change.diff)+            intact2.push({from: range.from + diff, to: range.to + diff,+                          domStart: range.domStart});+          else if (change.to <= range.from || change.from >= range.to)+            intact2.push(range);+          else {+            if (change.from > range.from)+              intact2.push({from: range.from, to: change.from, domStart: range.domStart});+            if (change.to < range.to)+              intact2.push({from: change.to + diff, to: range.to + diff,+                            domStart: range.domStart + (change.to - range.from)});+          }+        }+        intact = intact2;+      }+      return intact;+    }++    function patchDisplay(from, to, intact) {+      // The first pass removes the DOM nodes that aren't intact.+      if (!intact.length) lineDiv.innerHTML = "";+      else {+        function killNode(node) {+          var tmp = node.nextSibling;+          node.parentNode.removeChild(node);+          return tmp;+        }+        var domPos = 0, curNode = lineDiv.firstChild, n;+        for (var i = 0; i < intact.length; ++i) {+          var cur = intact[i];+          while (cur.domStart > domPos) {curNode = killNode(curNode); domPos++;}+          for (var j = 0, e = cur.to - cur.from; j < e; ++j) {curNode = curNode.nextSibling; domPos++;}+        }+        while (curNode) curNode = killNode(curNode);+      }+      // This pass fills in the lines that actually changed.+      var nextIntact = intact.shift(), curNode = lineDiv.firstChild, j = from;+      var scratch = document.createElement("div");+      doc.iter(from, to, function(line) {+        if (nextIntact && nextIntact.to == j) nextIntact = intact.shift();+        if (!nextIntact || nextIntact.from > j) {+          if (line.hidden) var html = scratch.innerHTML = "<pre></pre>";+          else {+            var html = '<pre' + (line.className ? ' class="' + line.className + '"' : '') + '>'+              + line.getHTML(makeTab) + '</pre>';+            // Kludge to make sure the styled element lies behind the selection (by z-index)+            if (line.bgClassName)+              html = '<div style="position: relative"><pre class="' + line.bgClassName ++              '" style="position: absolute; left: 0; right: 0; top: 0; bottom: 0; z-index: -2">&#160;</pre>' + html + "</div>";+          }+          scratch.innerHTML = html;+          lineDiv.insertBefore(scratch.firstChild, curNode);+        } else {+          curNode = curNode.nextSibling;+        }+        ++j;+      });+    }++    function updateGutter() {+      if (!options.gutter && !options.lineNumbers) return;+      var hText = mover.offsetHeight, hEditor = scroller.clientHeight;+      gutter.style.height = (hText - hEditor < 2 ? hEditor : hText) + "px";+      var html = [], i = showingFrom, normalNode;+      doc.iter(showingFrom, Math.max(showingTo, showingFrom + 1), function(line) {+        if (line.hidden) {+          html.push("<pre></pre>");+        } else {+          var marker = line.gutterMarker;+          var text = options.lineNumbers ? options.lineNumberFormatter(i + options.firstLineNumber) : null;+          if (marker && marker.text)+            text = marker.text.replace("%N%", text != null ? text : "");+          else if (text == null)+            text = "\u00a0";+          html.push((marker && marker.style ? '<pre class="' + marker.style + '">' : "<pre>"), text);+          for (var j = 1; j < line.height; ++j) html.push("<br/>&#160;");+          html.push("</pre>");+          if (!marker) normalNode = i;+        }+        ++i;+      });+      gutter.style.display = "none";+      gutterText.innerHTML = html.join("");+      // Make sure scrolling doesn't cause number gutter size to pop+      if (normalNode != null && options.lineNumbers) {+        var node = gutterText.childNodes[normalNode - showingFrom];+        var minwidth = String(doc.size).length, val = eltText(node.firstChild), pad = "";+        while (val.length + pad.length < minwidth) pad += "\u00a0";+        if (pad) node.insertBefore(document.createTextNode(pad), node.firstChild);+      }+      gutter.style.display = "";+      var resized = Math.abs((parseInt(lineSpace.style.marginLeft) || 0) - gutter.offsetWidth) > 2;+      lineSpace.style.marginLeft = gutter.offsetWidth + "px";+      gutterDirty = false;+      return resized;+    }+    function updateSelection() {+      var collapsed = posEq(sel.from, sel.to);+      var fromPos = localCoords(sel.from, true);+      var toPos = collapsed ? fromPos : localCoords(sel.to, true);+      var headPos = sel.inverted ? fromPos : toPos, th = textHeight();+      var wrapOff = eltOffset(wrapper), lineOff = eltOffset(lineDiv);+      inputDiv.style.top = Math.max(0, Math.min(scroller.offsetHeight, headPos.y + lineOff.top - wrapOff.top)) + "px";+      inputDiv.style.left = Math.max(0, Math.min(scroller.offsetWidth, headPos.x + lineOff.left - wrapOff.left)) + "px";+      if (collapsed) {+        cursor.style.top = headPos.y + "px";+        cursor.style.left = (options.lineWrapping ? Math.min(headPos.x, lineSpace.offsetWidth) : headPos.x) + "px";+        cursor.style.display = "";+        selectionDiv.style.display = "none";+      } else {+        var sameLine = fromPos.y == toPos.y, html = "";+        var clientWidth = lineSpace.clientWidth || lineSpace.offsetWidth;+        var clientHeight = lineSpace.clientHeight || lineSpace.offsetHeight;+        function add(left, top, right, height) {+          var rstyle = quirksMode ? "width: " + (!right ? clientWidth : clientWidth - right - left) + "px"+                                  : "right: " + right + "px";+          html += '<div class="CodeMirror-selected" style="position: absolute; left: ' + left ++            'px; top: ' + top + 'px; ' + rstyle + '; height: ' + height + 'px"></div>';+        }+        if (sel.from.ch && fromPos.y >= 0) {+          var right = sameLine ? clientWidth - toPos.x : 0;+          add(fromPos.x, fromPos.y, right, th);+        }+        var middleStart = Math.max(0, fromPos.y + (sel.from.ch ? th : 0));+        var middleHeight = Math.min(toPos.y, clientHeight) - middleStart;+        if (middleHeight > 0.2 * th)+          add(0, middleStart, 0, middleHeight);+        if ((!sameLine || !sel.from.ch) && toPos.y < clientHeight - .5 * th)+          add(0, toPos.y, clientWidth - toPos.x, th);+        selectionDiv.innerHTML = html;+        cursor.style.display = "none";+        selectionDiv.style.display = "";+      }+    }++    function setShift(val) {+      if (val) shiftSelecting = shiftSelecting || (sel.inverted ? sel.to : sel.from);+      else shiftSelecting = null;+    }+    function setSelectionUser(from, to) {+      var sh = shiftSelecting && clipPos(shiftSelecting);+      if (sh) {+        if (posLess(sh, from)) from = sh;+        else if (posLess(to, sh)) to = sh;+      }+      setSelection(from, to);+      userSelChange = true;+    }+    // Update the selection. Last two args are only used by+    // updateLines, since they have to be expressed in the line+    // numbers before the update.+    function setSelection(from, to, oldFrom, oldTo) {+      goalColumn = null;+      if (oldFrom == null) {oldFrom = sel.from.line; oldTo = sel.to.line;}+      if (posEq(sel.from, from) && posEq(sel.to, to)) return;+      if (posLess(to, from)) {var tmp = to; to = from; from = tmp;}++      // Skip over hidden lines.+      if (from.line != oldFrom) {+        var from1 = skipHidden(from, oldFrom, sel.from.ch);+        // If there is no non-hidden line left, force visibility on current line+        if (!from1) setLineHidden(from.line, false);+        else from = from1;+      }+      if (to.line != oldTo) to = skipHidden(to, oldTo, sel.to.ch);++      if (posEq(from, to)) sel.inverted = false;+      else if (posEq(from, sel.to)) sel.inverted = false;+      else if (posEq(to, sel.from)) sel.inverted = true;++      if (options.autoClearEmptyLines && posEq(sel.from, sel.to)) {+        var head = sel.inverted ? from : to;+        if (head.line != sel.from.line && sel.from.line < doc.size) {+          var oldLine = getLine(sel.from.line);+          if (/^\s+$/.test(oldLine.text))+            setTimeout(operation(function() {+              if (oldLine.parent && /^\s+$/.test(oldLine.text)) {+                var no = lineNo(oldLine);+                replaceRange("", {line: no, ch: 0}, {line: no, ch: oldLine.text.length});+              }+            }, 10));+        }+      }++      sel.from = from; sel.to = to;+      selectionChanged = true;+    }+    function skipHidden(pos, oldLine, oldCh) {+      function getNonHidden(dir) {+        var lNo = pos.line + dir, end = dir == 1 ? doc.size : -1;+        while (lNo != end) {+          var line = getLine(lNo);+          if (!line.hidden) {+            var ch = pos.ch;+            if (toEnd || ch > oldCh || ch > line.text.length) ch = line.text.length;+            return {line: lNo, ch: ch};+          }+          lNo += dir;+        }+      }+      var line = getLine(pos.line);+      var toEnd = pos.ch == line.text.length && pos.ch != oldCh;+      if (!line.hidden) return pos;+      if (pos.line >= oldLine) return getNonHidden(1) || getNonHidden(-1);+      else return getNonHidden(-1) || getNonHidden(1);+    }+    function setCursor(line, ch, user) {+      var pos = clipPos({line: line, ch: ch || 0});+      (user ? setSelectionUser : setSelection)(pos, pos);+    }++    function clipLine(n) {return Math.max(0, Math.min(n, doc.size-1));}+    function clipPos(pos) {+      if (pos.line < 0) return {line: 0, ch: 0};+      if (pos.line >= doc.size) return {line: doc.size-1, ch: getLine(doc.size-1).text.length};+      var ch = pos.ch, linelen = getLine(pos.line).text.length;+      if (ch == null || ch > linelen) return {line: pos.line, ch: linelen};+      else if (ch < 0) return {line: pos.line, ch: 0};+      else return pos;+    }++    function findPosH(dir, unit) {+      var end = sel.inverted ? sel.from : sel.to, line = end.line, ch = end.ch;+      var lineObj = getLine(line);+      function findNextLine() {+        for (var l = line + dir, e = dir < 0 ? -1 : doc.size; l != e; l += dir) {+          var lo = getLine(l);+          if (!lo.hidden) { line = l; lineObj = lo; return true; }+        }+      }+      function moveOnce(boundToLine) {+        if (ch == (dir < 0 ? 0 : lineObj.text.length)) {+          if (!boundToLine && findNextLine()) ch = dir < 0 ? lineObj.text.length : 0;+          else return false;+        } else ch += dir;+        return true;+      }+      if (unit == "char") moveOnce();+      else if (unit == "column") moveOnce(true);+      else if (unit == "word") {+        var sawWord = false;+        for (;;) {+          if (dir < 0) if (!moveOnce()) break;+          if (isWordChar(lineObj.text.charAt(ch))) sawWord = true;+          else if (sawWord) {if (dir < 0) {dir = 1; moveOnce();} break;}+          if (dir > 0) if (!moveOnce()) break;+        }+      }+      return {line: line, ch: ch};+    }+    function moveH(dir, unit) {+      var pos = dir < 0 ? sel.from : sel.to;+      if (shiftSelecting || posEq(sel.from, sel.to)) pos = findPosH(dir, unit);+      setCursor(pos.line, pos.ch, true);+    }+    function deleteH(dir, unit) {+      if (!posEq(sel.from, sel.to)) replaceRange("", sel.from, sel.to);+      else if (dir < 0) replaceRange("", findPosH(dir, unit), sel.to);+      else replaceRange("", sel.from, findPosH(dir, unit));+      userSelChange = true;+    }+    var goalColumn = null;+    function moveV(dir, unit) {+      var dist = 0, pos = localCoords(sel.inverted ? sel.from : sel.to, true);+      if (goalColumn != null) pos.x = goalColumn;+      if (unit == "page") dist = Math.min(scroller.clientHeight, window.innerHeight || document.documentElement.clientHeight);+      else if (unit == "line") dist = textHeight();+      var target = coordsChar(pos.x, pos.y + dist * dir + 2);+      if (unit == "page") scrollbar.scrollTop += localCoords(target, true).y - pos.y;+      setCursor(target.line, target.ch, true);+      goalColumn = pos.x;+    }++    function findWordAt(pos) {+      var line = getLine(pos.line).text;+      var start = pos.ch, end = pos.ch;+      var check = isWordChar(line.charAt(start < line.length ? start : start - 1)) ?+        isWordChar : function(ch) {return !isWordChar(ch);};+      while (start > 0 && check(line.charAt(start - 1))) --start;+      while (end < line.length && check(line.charAt(end))) ++end;+      return {from: {line: pos.line, ch: start}, to: {line: pos.line, ch: end}};+    }+    function selectLine(line) {+      setSelectionUser({line: line, ch: 0}, clipPos({line: line + 1, ch: 0}));+    }+    function indentSelected(mode) {+      if (posEq(sel.from, sel.to)) return indentLine(sel.from.line, mode);+      var e = sel.to.line - (sel.to.ch ? 0 : 1);+      for (var i = sel.from.line; i <= e; ++i) indentLine(i, mode);+    }++    function indentLine(n, how) {+      if (!how) how = "add";+      if (how == "smart") {+        if (!mode.indent) how = "prev";+        else var state = getStateBefore(n);+      }++      var line = getLine(n), curSpace = line.indentation(options.tabSize),+          curSpaceString = line.text.match(/^\s*/)[0], indentation;+      if (how == "smart") {+        indentation = mode.indent(state, line.text.slice(curSpaceString.length), line.text);+        if (indentation == Pass) how = "prev";+      }+      if (how == "prev") {+        if (n) indentation = getLine(n-1).indentation(options.tabSize);+        else indentation = 0;+      }+      else if (how == "add") indentation = curSpace + options.indentUnit;+      else if (how == "subtract") indentation = curSpace - options.indentUnit;+      indentation = Math.max(0, indentation);+      var diff = indentation - curSpace;++      var indentString = "", pos = 0;+      if (options.indentWithTabs)+        for (var i = Math.floor(indentation / options.tabSize); i; --i) {pos += options.tabSize; indentString += "\t";}+      while (pos < indentation) {++pos; indentString += " ";}++      replaceRange(indentString, {line: n, ch: 0}, {line: n, ch: curSpaceString.length});+    }++    function loadMode() {+      mode = CodeMirror.getMode(options, options.mode);+      doc.iter(0, doc.size, function(line) { line.stateAfter = null; });+      work = [0];+      startWorker();+    }+    function gutterChanged() {+      var visible = options.gutter || options.lineNumbers;+      gutter.style.display = visible ? "" : "none";+      if (visible) gutterDirty = true;+      else lineDiv.parentNode.style.marginLeft = 0;+    }+    function wrappingChanged(from, to) {+      if (options.lineWrapping) {+        wrapper.className += " CodeMirror-wrap";+        var perLine = scroller.clientWidth / charWidth() - 3;+        doc.iter(0, doc.size, function(line) {+          if (line.hidden) return;+          var guess = Math.ceil(line.text.length / perLine) || 1;+          if (guess != 1) updateLineHeight(line, guess);+        });+        lineSpace.style.width = code.style.width = "";+        widthForcer.style.left = "";+      } else {+        wrapper.className = wrapper.className.replace(" CodeMirror-wrap", "");+        maxLine = ""; maxLineChanged = true;+        doc.iter(0, doc.size, function(line) {+          if (line.height != 1 && !line.hidden) updateLineHeight(line, 1);+          if (line.text.length > maxLine.length) maxLine = line.text;+        });+      }+      changes.push({from: 0, to: doc.size});+    }+    function makeTab(col) {+      var w = options.tabSize - col % options.tabSize, cached = tabCache[w];+      if (cached) return cached;+      for (var str = '<span class="cm-tab">', i = 0; i < w; ++i) str += " ";+      return (tabCache[w] = {html: str + "</span>", width: w});+    }+    function themeChanged() {+      scroller.className = scroller.className.replace(/\s*cm-s-\S+/g, "") ++        options.theme.replace(/(^|\s)\s*/g, " cm-s-");+    }+    function keyMapChanged() {+      var style = keyMap[options.keyMap].style;+      wrapper.className = wrapper.className.replace(/\s*cm-keymap-\S+/g, "") ++        (style ? " cm-keymap-" + style : "");+    }++    function TextMarker() { this.set = []; }+    TextMarker.prototype.clear = operation(function() {+      var min = Infinity, max = -Infinity;+      for (var i = 0, e = this.set.length; i < e; ++i) {+        var line = this.set[i], mk = line.marked;+        if (!mk || !line.parent) continue;+        var lineN = lineNo(line);+        min = Math.min(min, lineN); max = Math.max(max, lineN);+        for (var j = 0; j < mk.length; ++j)+          if (mk[j].marker == this) mk.splice(j--, 1);+      }+      if (min != Infinity)+        changes.push({from: min, to: max + 1});+    });+    TextMarker.prototype.find = function() {+      var from, to;+      for (var i = 0, e = this.set.length; i < e; ++i) {+        var line = this.set[i], mk = line.marked;+        for (var j = 0; j < mk.length; ++j) {+          var mark = mk[j];+          if (mark.marker == this) {+            if (mark.from != null || mark.to != null) {+              var found = lineNo(line);+              if (found != null) {+                if (mark.from != null) from = {line: found, ch: mark.from};+                if (mark.to != null) to = {line: found, ch: mark.to};+              }+            }+          }+        }+      }+      return {from: from, to: to};+    };++    function markText(from, to, className) {+      from = clipPos(from); to = clipPos(to);+      var tm = new TextMarker();+      if (!posLess(from, to)) return tm;+      function add(line, from, to, className) {+        getLine(line).addMark(new MarkedText(from, to, className, tm));+      }+      if (from.line == to.line) add(from.line, from.ch, to.ch, className);+      else {+        add(from.line, from.ch, null, className);+        for (var i = from.line + 1, e = to.line; i < e; ++i)+          add(i, null, null, className);+        add(to.line, null, to.ch, className);+      }+      changes.push({from: from.line, to: to.line + 1});+      return tm;+    }++    function setBookmark(pos) {+      pos = clipPos(pos);+      var bm = new Bookmark(pos.ch);+      getLine(pos.line).addMark(bm);+      return bm;+    }++    function findMarksAt(pos) {+      pos = clipPos(pos);+      var markers = [], marked = getLine(pos.line).marked;+      if (!marked) return markers;+      for (var i = 0, e = marked.length; i < e; ++i) {+        var m = marked[i];+        if ((m.from == null || m.from <= pos.ch) &&+            (m.to == null || m.to >= pos.ch))+          markers.push(m.marker || m);+      }+      return markers;+    }++    function addGutterMarker(line, text, className) {+      if (typeof line == "number") line = getLine(clipLine(line));+      line.gutterMarker = {text: text, style: className};+      gutterDirty = true;+      return line;+    }+    function removeGutterMarker(line) {+      if (typeof line == "number") line = getLine(clipLine(line));+      line.gutterMarker = null;+      gutterDirty = true;+    }++    function changeLine(handle, op) {+      var no = handle, line = handle;+      if (typeof handle == "number") line = getLine(clipLine(handle));+      else no = lineNo(handle);+      if (no == null) return null;+      if (op(line, no)) changes.push({from: no, to: no + 1});+      else return null;+      return line;+    }+    function setLineClass(handle, className, bgClassName) {+      return changeLine(handle, function(line) {+        if (line.className != className || line.bgClassName != bgClassName) {+          line.className = className;+          line.bgClassName = bgClassName;+          return true;+        }+      });+    }+    function setLineHidden(handle, hidden) {+      return changeLine(handle, function(line, no) {+        if (line.hidden != hidden) {+          line.hidden = hidden;+          if (!options.lineWrapping) {+            var l = line.text;+            if (hidden && l.length == maxLine.length) {+              updateMaxLine = true;+            } else if (!hidden && l.length > maxLine.length) {+              maxLine = l; updateMaxLine = false;+            }+          }+          updateLineHeight(line, hidden ? 0 : 1);+          var fline = sel.from.line, tline = sel.to.line;+          if (hidden && (fline == no || tline == no)) {+            var from = fline == no ? skipHidden({line: fline, ch: 0}, fline, 0) : sel.from;+            var to = tline == no ? skipHidden({line: tline, ch: 0}, tline, 0) : sel.to;+            // Can't hide the last visible line, we'd have no place to put the cursor+            if (!to) return;+            setSelection(from, to);+          }+          return (gutterDirty = true);+        }+      });+    }++    function lineInfo(line) {+      if (typeof line == "number") {+        if (!isLine(line)) return null;+        var n = line;+        line = getLine(line);+        if (!line) return null;+      } else {+        var n = lineNo(line);+        if (n == null) return null;+      }+      var marker = line.gutterMarker;+      return {line: n, handle: line, text: line.text, markerText: marker && marker.text,+              markerClass: marker && marker.style, lineClass: line.className, bgClass: line.bgClassName};+    }++    function stringWidth(str) {+      measure.innerHTML = "<pre><span>x</span></pre>";+      measure.firstChild.firstChild.firstChild.nodeValue = str;+      return measure.firstChild.firstChild.offsetWidth || 10;+    }+    // These are used to go from pixel positions to character+    // positions, taking varying character widths into account.+    function charFromX(line, x) {+      if (x <= 0) return 0;+      var lineObj = getLine(line), text = lineObj.text;+      function getX(len) {+        return measureLine(lineObj, len).left;+      }+      var from = 0, fromX = 0, to = text.length, toX;+      // Guess a suitable upper bound for our search.+      var estimated = Math.min(to, Math.ceil(x / charWidth()));+      for (;;) {+        var estX = getX(estimated);+        if (estX <= x && estimated < to) estimated = Math.min(to, Math.ceil(estimated * 1.2));+        else {toX = estX; to = estimated; break;}+      }+      if (x > toX) return to;+      // Try to guess a suitable lower bound as well.+      estimated = Math.floor(to * 0.8); estX = getX(estimated);+      if (estX < x) {from = estimated; fromX = estX;}+      // Do a binary search between these bounds.+      for (;;) {+        if (to - from <= 1) return (toX - x > x - fromX) ? from : to;+        var middle = Math.ceil((from + to) / 2), middleX = getX(middle);+        if (middleX > x) {to = middle; toX = middleX;}+        else {from = middle; fromX = middleX;}+      }+    }++    var tempId = "CodeMirror-temp-" + Math.floor(Math.random() * 0xffffff).toString(16);+    function measureLine(line, ch) {+      if (ch == 0) return {top: 0, left: 0};+      var wbr = options.lineWrapping && ch < line.text.length &&+                spanAffectsWrapping.test(line.text.slice(ch - 1, ch + 1));+      measure.innerHTML = "<pre>" + line.getHTML(makeTab, ch, tempId, wbr) + "</pre>";+      var elt = document.getElementById(tempId);+      var top = elt.offsetTop, left = elt.offsetLeft;+      // Older IEs report zero offsets for spans directly after a wrap+      if (ie && top == 0 && left == 0) {+        var backup = document.createElement("span");+        backup.innerHTML = "x";+        elt.parentNode.insertBefore(backup, elt.nextSibling);+        top = backup.offsetTop;+      }+      return {top: top, left: left};+    }+    function localCoords(pos, inLineWrap) {+      var x, lh = textHeight(), y = lh * (heightAtLine(doc, pos.line) - (inLineWrap ? displayOffset : 0));+      if (pos.ch == 0) x = 0;+      else {+        var sp = measureLine(getLine(pos.line), pos.ch);+        x = sp.left;+        if (options.lineWrapping) y += Math.max(0, sp.top);+      }+      return {x: x, y: y, yBot: y + lh};+    }+    // Coords must be lineSpace-local+    function coordsChar(x, y) {+      if (y < 0) y = 0;+      var th = textHeight(), cw = charWidth(), heightPos = displayOffset + Math.floor(y / th);+      var lineNo = lineAtHeight(doc, heightPos);+      if (lineNo >= doc.size) return {line: doc.size - 1, ch: getLine(doc.size - 1).text.length};+      var lineObj = getLine(lineNo), text = lineObj.text;+      var tw = options.lineWrapping, innerOff = tw ? heightPos - heightAtLine(doc, lineNo) : 0;+      if (x <= 0 && innerOff == 0) return {line: lineNo, ch: 0};+      function getX(len) {+        var sp = measureLine(lineObj, len);+        if (tw) {+          var off = Math.round(sp.top / th);+          return Math.max(0, sp.left + (off - innerOff) * scroller.clientWidth);+        }+        return sp.left;+      }+      var from = 0, fromX = 0, to = text.length, toX;+      // Guess a suitable upper bound for our search.+      var estimated = Math.min(to, Math.ceil((x + innerOff * scroller.clientWidth * .9) / cw));+      for (;;) {+        var estX = getX(estimated);+        if (estX <= x && estimated < to) estimated = Math.min(to, Math.ceil(estimated * 1.2));+        else {toX = estX; to = estimated; break;}+      }+      if (x > toX) return {line: lineNo, ch: to};+      // Try to guess a suitable lower bound as well.+      estimated = Math.floor(to * 0.8); estX = getX(estimated);+      if (estX < x) {from = estimated; fromX = estX;}+      // Do a binary search between these bounds.+      for (;;) {+        if (to - from <= 1) return {line: lineNo, ch: (toX - x > x - fromX) ? from : to};+        var middle = Math.ceil((from + to) / 2), middleX = getX(middle);+        if (middleX > x) {to = middle; toX = middleX;}+        else {from = middle; fromX = middleX;}+      }+    }+    function pageCoords(pos) {+      var local = localCoords(pos, true), off = eltOffset(lineSpace);+      return {x: off.left + local.x, y: off.top + local.y, yBot: off.top + local.yBot};+    }++    var cachedHeight, cachedHeightFor, measureText;+    function textHeight() {+      if (measureText == null) {+        measureText = "<pre>";+        for (var i = 0; i < 49; ++i) measureText += "x<br/>";+        measureText += "x</pre>";+      }+      var offsetHeight = lineDiv.clientHeight;+      if (offsetHeight == cachedHeightFor) return cachedHeight;+      cachedHeightFor = offsetHeight;+      measure.innerHTML = measureText;+      cachedHeight = measure.firstChild.offsetHeight / 50 || 1;+      measure.innerHTML = "";+      return cachedHeight;+    }+    var cachedWidth, cachedWidthFor = 0;+    function charWidth() {+      if (scroller.clientWidth == cachedWidthFor) return cachedWidth;+      cachedWidthFor = scroller.clientWidth;+      return (cachedWidth = stringWidth("x"));+    }+    function paddingTop() {return lineSpace.offsetTop;}+    function paddingLeft() {return lineSpace.offsetLeft;}++    function posFromMouse(e, liberal) {+      var offW = eltOffset(scroller, true), x, y;+      // Fails unpredictably on IE[67] when mouse is dragged around quickly.+      try { x = e.clientX; y = e.clientY; } catch (e) { return null; }+      // This is a mess of a heuristic to try and determine whether a+      // scroll-bar was clicked or not, and to return null if one was+      // (and !liberal).+      if (!liberal && (x - offW.left > scroller.clientWidth || y - offW.top > scroller.clientHeight))+        return null;+      var offL = eltOffset(lineSpace, true);+      return coordsChar(x - offL.left, y - offL.top);+    }+    function onContextMenu(e) {+      var pos = posFromMouse(e), scrollPos = scrollbar.scrollTop;+      if (!pos || opera) return; // Opera is difficult.+      if (posEq(sel.from, sel.to) || posLess(pos, sel.from) || !posLess(pos, sel.to))+        operation(setCursor)(pos.line, pos.ch);++      var oldCSS = input.style.cssText;+      inputDiv.style.position = "absolute";+      input.style.cssText = "position: fixed; width: 30px; height: 30px; top: " + (e.clientY - 5) ++        "px; left: " + (e.clientX - 5) + "px; z-index: 1000; background: white; " ++        "border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";+      leaveInputAlone = true;+      var val = input.value = getSelection();+      focusInput();+      selectInput(input);+      function rehide() {+        var newVal = splitLines(input.value).join("\n");+        if (newVal != val && !options.readOnly) operation(replaceSelection)(newVal, "end");+        inputDiv.style.position = "relative";+        input.style.cssText = oldCSS;+        if (ie_lt9) scrollbar.scrollTop = scrollPos;+        leaveInputAlone = false;+        resetInput(true);+        slowPoll();+      }++      if (gecko) {+        e_stop(e);+        var mouseup = connect(window, "mouseup", function() {+          mouseup();+          setTimeout(rehide, 20);+        }, true);+      } else {+        setTimeout(rehide, 50);+      }+    }++    // Cursor-blinking+    function restartBlink() {+      clearInterval(blinker);+      var on = true;+      cursor.style.visibility = "";+      blinker = setInterval(function() {+        cursor.style.visibility = (on = !on) ? "" : "hidden";+      }, 650);+    }++    var matching = {"(": ")>", ")": "(<", "[": "]>", "]": "[<", "{": "}>", "}": "{<"};+    function matchBrackets(autoclear) {+      var head = sel.inverted ? sel.from : sel.to, line = getLine(head.line), pos = head.ch - 1;+      var match = (pos >= 0 && matching[line.text.charAt(pos)]) || matching[line.text.charAt(++pos)];+      if (!match) return;+      var ch = match.charAt(0), forward = match.charAt(1) == ">", d = forward ? 1 : -1, st = line.styles;+      for (var off = pos + 1, i = 0, e = st.length; i < e; i+=2)+        if ((off -= st[i].length) <= 0) {var style = st[i+1]; break;}++      var stack = [line.text.charAt(pos)], re = /[(){}[\]]/;+      function scan(line, from, to) {+        if (!line.text) return;+        var st = line.styles, pos = forward ? 0 : line.text.length - 1, cur;+        for (var i = forward ? 0 : st.length - 2, e = forward ? st.length : -2; i != e; i += 2*d) {+          var text = st[i];+          if (st[i+1] != style) {pos += d * text.length; continue;}+          for (var j = forward ? 0 : text.length - 1, te = forward ? text.length : -1; j != te; j += d, pos+=d) {+            if (pos >= from && pos < to && re.test(cur = text.charAt(j))) {+              var match = matching[cur];+              if (match.charAt(1) == ">" == forward) stack.push(cur);+              else if (stack.pop() != match.charAt(0)) return {pos: pos, match: false};+              else if (!stack.length) return {pos: pos, match: true};+            }+          }+        }+      }+      for (var i = head.line, e = forward ? Math.min(i + 100, doc.size) : Math.max(-1, i - 100); i != e; i+=d) {+        var line = getLine(i), first = i == head.line;+        var found = scan(line, first && forward ? pos + 1 : 0, first && !forward ? pos : line.text.length);+        if (found) break;+      }+      if (!found) found = {pos: null, match: false};+      var style = found.match ? "CodeMirror-matchingbracket" : "CodeMirror-nonmatchingbracket";+      var one = markText({line: head.line, ch: pos}, {line: head.line, ch: pos+1}, style),+          two = found.pos != null && markText({line: i, ch: found.pos}, {line: i, ch: found.pos + 1}, style);+      var clear = operation(function(){one.clear(); two && two.clear();});+      if (autoclear) setTimeout(clear, 800);+      else bracketHighlighted = clear;+    }++    // Finds the line to start with when starting a parse. Tries to+    // find a line with a stateAfter, so that it can start with a+    // valid state. If that fails, it returns the line with the+    // smallest indentation, which tends to need the least context to+    // parse correctly.+    function findStartLine(n) {+      var minindent, minline;+      for (var search = n, lim = n - 40; search > lim; --search) {+        if (search == 0) return 0;+        var line = getLine(search-1);+        if (line.stateAfter) return search;+        var indented = line.indentation(options.tabSize);+        if (minline == null || minindent > indented) {+          minline = search - 1;+          minindent = indented;+        }+      }+      return minline;+    }+    function getStateBefore(n) {+      var start = findStartLine(n), state = start && getLine(start-1).stateAfter;+      if (!state) state = startState(mode);+      else state = copyState(mode, state);+      doc.iter(start, n, function(line) {+        line.highlight(mode, state, options.tabSize);+        line.stateAfter = copyState(mode, state);+      });+      if (start < n) changes.push({from: start, to: n});+      if (n < doc.size && !getLine(n).stateAfter) work.push(n);+      return state;+    }+    function highlightLines(start, end) {+      var state = getStateBefore(start);+      doc.iter(start, end, function(line) {+        line.highlight(mode, state, options.tabSize);+        line.stateAfter = copyState(mode, state);+      });+    }+    function highlightWorker() {+      var end = +new Date + options.workTime;+      var foundWork = work.length;+      while (work.length) {+        if (!getLine(showingFrom).stateAfter) var task = showingFrom;+        else var task = work.pop();+        if (task >= doc.size) continue;+        var start = findStartLine(task), state = start && getLine(start-1).stateAfter;+        if (state) state = copyState(mode, state);+        else state = startState(mode);++        var unchanged = 0, compare = mode.compareStates, realChange = false,+            i = start, bail = false;+        doc.iter(i, doc.size, function(line) {+          var hadState = line.stateAfter;+          if (+new Date > end) {+            work.push(i);+            startWorker(options.workDelay);+            if (realChange) changes.push({from: task, to: i + 1});+            return (bail = true);+          }+          var changed = line.highlight(mode, state, options.tabSize);+          if (changed) realChange = true;+          line.stateAfter = copyState(mode, state);+          var done = null;+          if (compare) {+            var same = hadState && compare(hadState, state);+            if (same != Pass) done = !!same;+          }+          if (done == null) {+            if (changed !== false || !hadState) unchanged = 0;+            else if (++unchanged > 3 && (!mode.indent || mode.indent(hadState, "") == mode.indent(state, "")))+              done = true;+          }+          if (done) return true;+          ++i;+        });+        if (bail) return;+        if (realChange) changes.push({from: task, to: i + 1});+      }+      if (foundWork && options.onHighlightComplete)+        options.onHighlightComplete(instance);+    }+    function startWorker(time) {+      if (!work.length) return;+      highlight.set(time, operation(highlightWorker));+    }++    // Operations are used to wrap changes in such a way that each+    // change won't have to update the cursor and display (which would+    // be awkward, slow, and error-prone), but instead updates are+    // batched and then all combined and executed at once.+    function startOperation() {+      updateInput = userSelChange = textChanged = null;+      changes = []; selectionChanged = false; callbacks = [];+    }+    function endOperation() {+      if (updateMaxLine) computeMaxLength();+      if (maxLineChanged && !options.lineWrapping) {+        var cursorWidth = widthForcer.offsetWidth, left = stringWidth(maxLine);+        widthForcer.style.left = left + "px";+        lineSpace.style.minWidth = (left + cursorWidth) + "px";+        maxLineChanged = false;+      }+      var newScrollPos, updated;+      if (selectionChanged) {+        var coords = calculateCursorCoords();+        newScrollPos = calculateScrollPos(coords.x, coords.y, coords.x, coords.yBot);+      }+      if (changes.length) updated = updateDisplay(changes, true, (newScrollPos ? newScrollPos.scrollTop : null));+      else {+        if (selectionChanged) updateSelection();+        if (gutterDirty) updateGutter();+      }+      if (newScrollPos) scrollCursorIntoView();+      if (selectionChanged) {scrollEditorIntoView(); restartBlink();}++      if (focused && !leaveInputAlone &&+          (updateInput === true || (updateInput !== false && selectionChanged)))+        resetInput(userSelChange);++      if (selectionChanged && options.matchBrackets)+        setTimeout(operation(function() {+          if (bracketHighlighted) {bracketHighlighted(); bracketHighlighted = null;}+          if (posEq(sel.from, sel.to)) matchBrackets(false);+        }), 20);+      var sc = selectionChanged, cbs = callbacks; // these can be reset by callbacks+      if (textChanged && options.onChange && instance)+        options.onChange(instance, textChanged);+      if (sc && options.onCursorActivity)+        options.onCursorActivity(instance);+      for (var i = 0; i < cbs.length; ++i) cbs[i](instance);+      if (updated && options.onUpdate) options.onUpdate(instance);+    }+    var nestedOperation = 0;+    function operation(f) {+      return function() {+        if (!nestedOperation++) startOperation();+        try {var result = f.apply(this, arguments);}+        finally {if (!--nestedOperation) endOperation();}+        return result;+      };+    }++    function compoundChange(f) {+      history.startCompound();+      try { return f(); } finally { history.endCompound(); }+    }++    for (var ext in extensions)+      if (extensions.propertyIsEnumerable(ext) &&+          !instance.propertyIsEnumerable(ext))+        instance[ext] = extensions[ext];+    return instance;+  } // (end of function CodeMirror)++  // The default configuration options.+  CodeMirror.defaults = {+    value: "",+    mode: null,+    theme: "default",+    indentUnit: 2,+    indentWithTabs: false,+    smartIndent: true,+    tabSize: 4,+    keyMap: "default",+    extraKeys: null,+    electricChars: true,+    autoClearEmptyLines: false,+    onKeyEvent: null,+    onDragEvent: null,+    lineWrapping: false,+    lineNumbers: false,+    gutter: false,+    fixedGutter: false,+    firstLineNumber: 1,+    readOnly: false,+    dragDrop: true,+    onChange: null,+    onCursorActivity: null,+    onGutterClick: null,+    onHighlightComplete: null,+    onUpdate: null,+    onFocus: null, onBlur: null, onScroll: null,+    matchBrackets: false,+    workTime: 100,+    workDelay: 200,+    pollInterval: 100,+    undoDepth: 40,+    tabindex: null,+    autofocus: null,+    lineNumberFormatter: function(integer) { return integer; }+  };++  var ios = /AppleWebKit/.test(navigator.userAgent) && /Mobile\/\w+/.test(navigator.userAgent);+  var mac = ios || /Mac/.test(navigator.platform);+  var win = /Win/.test(navigator.platform);++  // Known modes, by name and by MIME+  var modes = CodeMirror.modes = {}, mimeModes = CodeMirror.mimeModes = {};+  CodeMirror.defineMode = function(name, mode) {+    if (!CodeMirror.defaults.mode && name != "null") CodeMirror.defaults.mode = name;+    if (arguments.length > 2) {+      mode.dependencies = [];+      for (var i = 2; i < arguments.length; ++i) mode.dependencies.push(arguments[i]);+    }+    modes[name] = mode;+  };+  CodeMirror.defineMIME = function(mime, spec) {+    mimeModes[mime] = spec;+  };+  CodeMirror.resolveMode = function(spec) {+    if (typeof spec == "string" && mimeModes.hasOwnProperty(spec))+      spec = mimeModes[spec];+    else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+xml$/.test(spec))+      return CodeMirror.resolveMode("application/xml");+    if (typeof spec == "string") return {name: spec};+    else return spec || {name: "null"};+  };+  CodeMirror.getMode = function(options, spec) {+    var spec = CodeMirror.resolveMode(spec);+    var mfactory = modes[spec.name];+    if (!mfactory) return CodeMirror.getMode(options, "text/plain");+    return mfactory(options, spec);+  };+  CodeMirror.listModes = function() {+    var list = [];+    for (var m in modes)+      if (modes.propertyIsEnumerable(m)) list.push(m);+    return list;+  };+  CodeMirror.listMIMEs = function() {+    var list = [];+    for (var m in mimeModes)+      if (mimeModes.propertyIsEnumerable(m)) list.push({mime: m, mode: mimeModes[m]});+    return list;+  };++  var extensions = CodeMirror.extensions = {};+  CodeMirror.defineExtension = function(name, func) {+    extensions[name] = func;+  };++  var commands = CodeMirror.commands = {+    selectAll: function(cm) {cm.setSelection({line: 0, ch: 0}, {line: cm.lineCount() - 1});},+    killLine: function(cm) {+      var from = cm.getCursor(true), to = cm.getCursor(false), sel = !posEq(from, to);+      if (!sel && cm.getLine(from.line).length == from.ch) cm.replaceRange("", from, {line: from.line + 1, ch: 0});+      else cm.replaceRange("", from, sel ? to : {line: from.line});+    },+    deleteLine: function(cm) {var l = cm.getCursor().line; cm.replaceRange("", {line: l, ch: 0}, {line: l});},+    undo: function(cm) {cm.undo();},+    redo: function(cm) {cm.redo();},+    goDocStart: function(cm) {cm.setCursor(0, 0, true);},+    goDocEnd: function(cm) {cm.setSelection({line: cm.lineCount() - 1}, null, true);},+    goLineStart: function(cm) {cm.setCursor(cm.getCursor().line, 0, true);},+    goLineStartSmart: function(cm) {+      var cur = cm.getCursor();+      var text = cm.getLine(cur.line), firstNonWS = Math.max(0, text.search(/\S/));+      cm.setCursor(cur.line, cur.ch <= firstNonWS && cur.ch ? 0 : firstNonWS, true);+    },+    goLineEnd: function(cm) {cm.setSelection({line: cm.getCursor().line}, null, true);},+    goLineUp: function(cm) {cm.moveV(-1, "line");},+    goLineDown: function(cm) {cm.moveV(1, "line");},+    goPageUp: function(cm) {cm.moveV(-1, "page");},+    goPageDown: function(cm) {cm.moveV(1, "page");},+    goCharLeft: function(cm) {cm.moveH(-1, "char");},+    goCharRight: function(cm) {cm.moveH(1, "char");},+    goColumnLeft: function(cm) {cm.moveH(-1, "column");},+    goColumnRight: function(cm) {cm.moveH(1, "column");},+    goWordLeft: function(cm) {cm.moveH(-1, "word");},+    goWordRight: function(cm) {cm.moveH(1, "word");},+    delCharLeft: function(cm) {cm.deleteH(-1, "char");},+    delCharRight: function(cm) {cm.deleteH(1, "char");},+    delWordLeft: function(cm) {cm.deleteH(-1, "word");},+    delWordRight: function(cm) {cm.deleteH(1, "word");},+    indentAuto: function(cm) {cm.indentSelection("smart");},+    indentMore: function(cm) {cm.indentSelection("add");},+    indentLess: function(cm) {cm.indentSelection("subtract");},+    insertTab: function(cm) {cm.replaceSelection("\t", "end");},+    defaultTab: function(cm) {+      if (cm.somethingSelected()) cm.indentSelection("add");+      else cm.replaceSelection("\t", "end");+    },+    transposeChars: function(cm) {+      var cur = cm.getCursor(), line = cm.getLine(cur.line);+      if (cur.ch > 0 && cur.ch < line.length - 1)+        cm.replaceRange(line.charAt(cur.ch) + line.charAt(cur.ch - 1),+                        {line: cur.line, ch: cur.ch - 1}, {line: cur.line, ch: cur.ch + 1});+    },+    newlineAndIndent: function(cm) {+      cm.replaceSelection("\n", "end");+      cm.indentLine(cm.getCursor().line);+    },+    toggleOverwrite: function(cm) {cm.toggleOverwrite();}+  };++  var keyMap = CodeMirror.keyMap = {};+  keyMap.basic = {+    "Left": "goCharLeft", "Right": "goCharRight", "Up": "goLineUp", "Down": "goLineDown",+    "End": "goLineEnd", "Home": "goLineStartSmart", "PageUp": "goPageUp", "PageDown": "goPageDown",+    "Delete": "delCharRight", "Backspace": "delCharLeft", "Tab": "defaultTab", "Shift-Tab": "indentAuto",+    "Enter": "newlineAndIndent", "Insert": "toggleOverwrite"+  };+  // Note that the save and find-related commands aren't defined by+  // default. Unknown commands are simply ignored.+  keyMap.pcDefault = {+    "Ctrl-A": "selectAll", "Ctrl-D": "deleteLine", "Ctrl-Z": "undo", "Shift-Ctrl-Z": "redo", "Ctrl-Y": "redo",+    "Ctrl-Home": "goDocStart", "Alt-Up": "goDocStart", "Ctrl-End": "goDocEnd", "Ctrl-Down": "goDocEnd",+    "Ctrl-Left": "goWordLeft", "Ctrl-Right": "goWordRight", "Alt-Left": "goLineStart", "Alt-Right": "goLineEnd",+    "Ctrl-Backspace": "delWordLeft", "Ctrl-Delete": "delWordRight", "Ctrl-S": "save", "Ctrl-F": "find",+    "Ctrl-G": "findNext", "Shift-Ctrl-G": "findPrev", "Shift-Ctrl-F": "replace", "Shift-Ctrl-R": "replaceAll",+    "Ctrl-[": "indentLess", "Ctrl-]": "indentMore",+    fallthrough: "basic"+  };+  keyMap.macDefault = {+    "Cmd-A": "selectAll", "Cmd-D": "deleteLine", "Cmd-Z": "undo", "Shift-Cmd-Z": "redo", "Cmd-Y": "redo",+    "Cmd-Up": "goDocStart", "Cmd-End": "goDocEnd", "Cmd-Down": "goDocEnd", "Alt-Left": "goWordLeft",+    "Alt-Right": "goWordRight", "Cmd-Left": "goLineStart", "Cmd-Right": "goLineEnd", "Alt-Backspace": "delWordLeft",+    "Ctrl-Alt-Backspace": "delWordRight", "Alt-Delete": "delWordRight", "Cmd-S": "save", "Cmd-F": "find",+    "Cmd-G": "findNext", "Shift-Cmd-G": "findPrev", "Cmd-Alt-F": "replace", "Shift-Cmd-Alt-F": "replaceAll",+    "Cmd-[": "indentLess", "Cmd-]": "indentMore",+    fallthrough: ["basic", "emacsy"]+  };+  keyMap["default"] = mac ? keyMap.macDefault : keyMap.pcDefault;+  keyMap.emacsy = {+    "Ctrl-F": "goCharRight", "Ctrl-B": "goCharLeft", "Ctrl-P": "goLineUp", "Ctrl-N": "goLineDown",+    "Alt-F": "goWordRight", "Alt-B": "goWordLeft", "Ctrl-A": "goLineStart", "Ctrl-E": "goLineEnd",+    "Ctrl-V": "goPageUp", "Shift-Ctrl-V": "goPageDown", "Ctrl-D": "delCharRight", "Ctrl-H": "delCharLeft",+    "Alt-D": "delWordRight", "Alt-Backspace": "delWordLeft", "Ctrl-K": "killLine", "Ctrl-T": "transposeChars"+  };++  function getKeyMap(val) {+    if (typeof val == "string") return keyMap[val];+    else return val;+  }+  function lookupKey(name, extraMap, map, handle, stop) {+    function lookup(map) {+      map = getKeyMap(map);+      var found = map[name];+      if (found != null && handle(found)) return true;+      if (map.nofallthrough) {+        if (stop) stop();+        return true;+      }+      var fallthrough = map.fallthrough;+      if (fallthrough == null) return false;+      if (Object.prototype.toString.call(fallthrough) != "[object Array]")+        return lookup(fallthrough);+      for (var i = 0, e = fallthrough.length; i < e; ++i) {+        if (lookup(fallthrough[i])) return true;+      }+      return false;+    }+    if (extraMap && lookup(extraMap)) return true;+    return lookup(map);+  }+  function isModifierKey(event) {+    var name = keyNames[e_prop(event, "keyCode")];+    return name == "Ctrl" || name == "Alt" || name == "Shift" || name == "Mod";+  }++  CodeMirror.fromTextArea = function(textarea, options) {+    if (!options) options = {};+    options.value = textarea.value;+    if (!options.tabindex && textarea.tabindex)+      options.tabindex = textarea.tabindex;+    if (options.autofocus == null && textarea.getAttribute("autofocus") != null)+      options.autofocus = true;++    function save() {textarea.value = instance.getValue();}+    if (textarea.form) {+      // Deplorable hack to make the submit method do the right thing.+      var rmSubmit = connect(textarea.form, "submit", save, true);+      if (typeof textarea.form.submit == "function") {+        var realSubmit = textarea.form.submit;+        function wrappedSubmit() {+          save();+          textarea.form.submit = realSubmit;+          textarea.form.submit();+          textarea.form.submit = wrappedSubmit;+        }+        textarea.form.submit = wrappedSubmit;+      }+    }++    textarea.style.display = "none";+    var instance = CodeMirror(function(node) {+      textarea.parentNode.insertBefore(node, textarea.nextSibling);+    }, options);+    instance.save = save;+    instance.getTextArea = function() { return textarea; };+    instance.toTextArea = function() {+      save();+      textarea.parentNode.removeChild(instance.getWrapperElement());+      textarea.style.display = "";+      if (textarea.form) {+        rmSubmit();+        if (typeof textarea.form.submit == "function")+          textarea.form.submit = realSubmit;+      }+    };+    return instance;+  };++  // Utility functions for working with state. Exported because modes+  // sometimes need to do this.+  function copyState(mode, state) {+    if (state === true) return state;+    if (mode.copyState) return mode.copyState(state);+    var nstate = {};+    for (var n in state) {+      var val = state[n];+      if (val instanceof Array) val = val.concat([]);+      nstate[n] = val;+    }+    return nstate;+  }+  CodeMirror.copyState = copyState;+  function startState(mode, a1, a2) {+    return mode.startState ? mode.startState(a1, a2) : true;+  }+  CodeMirror.startState = startState;++  // The character stream used by a mode's parser.+  function StringStream(string, tabSize) {+    this.pos = this.start = 0;+    this.string = string;+    this.tabSize = tabSize || 8;+  }+  StringStream.prototype = {+    eol: function() {return this.pos >= this.string.length;},+    sol: function() {return this.pos == 0;},+    peek: function() {return this.string.charAt(this.pos);},+    next: function() {+      if (this.pos < this.string.length)+        return this.string.charAt(this.pos++);+    },+    eat: function(match) {+      var ch = this.string.charAt(this.pos);+      if (typeof match == "string") var ok = ch == match;+      else var ok = ch && (match.test ? match.test(ch) : match(ch));+      if (ok) {++this.pos; return ch;}+    },+    eatWhile: function(match) {+      var start = this.pos;+      while (this.eat(match)){}+      return this.pos > start;+    },+    eatSpace: function() {+      var start = this.pos;+      while (/[\s\u00a0]/.test(this.string.charAt(this.pos))) ++this.pos;+      return this.pos > start;+    },+    skipToEnd: function() {this.pos = this.string.length;},+    skipTo: function(ch) {+      var found = this.string.indexOf(ch, this.pos);+      if (found > -1) {this.pos = found; return true;}+    },+    backUp: function(n) {this.pos -= n;},+    column: function() {return countColumn(this.string, this.start, this.tabSize);},+    indentation: function() {return countColumn(this.string, null, this.tabSize);},+    match: function(pattern, consume, caseInsensitive) {+      if (typeof pattern == "string") {+        function cased(str) {return caseInsensitive ? str.toLowerCase() : str;}+        if (cased(this.string).indexOf(cased(pattern), this.pos) == this.pos) {+          if (consume !== false) this.pos += pattern.length;+          return true;+        }+      } else {+        var match = this.string.slice(this.pos).match(pattern);+        if (match && consume !== false) this.pos += match[0].length;+        return match;+      }+    },+    current: function(){return this.string.slice(this.start, this.pos);}+  };+  CodeMirror.StringStream = StringStream;++  function MarkedText(from, to, className, marker) {+    this.from = from; this.to = to; this.style = className; this.marker = marker;+  }+  MarkedText.prototype = {+    attach: function(line) { this.marker.set.push(line); },+    detach: function(line) {+      var ix = indexOf(this.marker.set, line);+      if (ix > -1) this.marker.set.splice(ix, 1);+    },+    split: function(pos, lenBefore) {+      if (this.to <= pos && this.to != null) return null;+      var from = this.from < pos || this.from == null ? null : this.from - pos + lenBefore;+      var to = this.to == null ? null : this.to - pos + lenBefore;+      return new MarkedText(from, to, this.style, this.marker);+    },+    dup: function() { return new MarkedText(null, null, this.style, this.marker); },+    clipTo: function(fromOpen, from, toOpen, to, diff) {+      if (fromOpen && to > this.from && (to < this.to || this.to == null))+        this.from = null;+      else if (this.from != null && this.from >= from)+        this.from = Math.max(to, this.from) + diff;+      if (toOpen && (from < this.to || this.to == null) && (from > this.from || this.from == null))+        this.to = null;+      else if (this.to != null && this.to > from)+        this.to = to < this.to ? this.to + diff : from;+    },+    isDead: function() { return this.from != null && this.to != null && this.from >= this.to; },+    sameSet: function(x) { return this.marker == x.marker; }+  };++  function Bookmark(pos) {+    this.from = pos; this.to = pos; this.line = null;+  }+  Bookmark.prototype = {+    attach: function(line) { this.line = line; },+    detach: function(line) { if (this.line == line) this.line = null; },+    split: function(pos, lenBefore) {+      if (pos < this.from) {+        this.from = this.to = (this.from - pos) + lenBefore;+        return this;+      }+    },+    isDead: function() { return this.from > this.to; },+    clipTo: function(fromOpen, from, toOpen, to, diff) {+      if ((fromOpen || from < this.from) && (toOpen || to > this.to)) {+        this.from = 0; this.to = -1;+      } else if (this.from > from) {+        this.from = this.to = Math.max(to, this.from) + diff;+      }+    },+    sameSet: function(x) { return false; },+    find: function() {+      if (!this.line || !this.line.parent) return null;+      return {line: lineNo(this.line), ch: this.from};+    },+    clear: function() {+      if (this.line) {+        var found = indexOf(this.line.marked, this);+        if (found != -1) this.line.marked.splice(found, 1);+        this.line = null;+      }+    }+  };++  // Line objects. These hold state related to a line, including+  // highlighting info (the styles array).+  function Line(text, styles) {+    this.styles = styles || [text, null];+    this.text = text;+    this.height = 1;+    this.marked = this.gutterMarker = this.className = this.bgClassName = this.handlers = null;+    this.stateAfter = this.parent = this.hidden = null;+  }+  Line.inheritMarks = function(text, orig) {+    var ln = new Line(text), mk = orig && orig.marked;+    if (mk) {+      for (var i = 0; i < mk.length; ++i) {+        if (mk[i].to == null && mk[i].style) {+          var newmk = ln.marked || (ln.marked = []), mark = mk[i];+          var nmark = mark.dup(); newmk.push(nmark); nmark.attach(ln);+        }+      }+    }+    return ln;+  }+  Line.prototype = {+    // Replace a piece of a line, keeping the styles around it intact.+    replace: function(from, to_, text) {+      var st = [], mk = this.marked, to = to_ == null ? this.text.length : to_;+      copyStyles(0, from, this.styles, st);+      if (text) st.push(text, null);+      copyStyles(to, this.text.length, this.styles, st);+      this.styles = st;+      this.text = this.text.slice(0, from) + text + this.text.slice(to);+      this.stateAfter = null;+      if (mk) {+        var diff = text.length - (to - from);+        for (var i = 0; i < mk.length; ++i) {+          var mark = mk[i];+          mark.clipTo(from == null, from || 0, to_ == null, to, diff);+          if (mark.isDead()) {mark.detach(this); mk.splice(i--, 1);}+        }+      }+    },+    // Split a part off a line, keeping styles and markers intact.+    split: function(pos, textBefore) {+      var st = [textBefore, null], mk = this.marked;+      copyStyles(pos, this.text.length, this.styles, st);+      var taken = new Line(textBefore + this.text.slice(pos), st);+      if (mk) {+        for (var i = 0; i < mk.length; ++i) {+          var mark = mk[i];+          var newmark = mark.split(pos, textBefore.length);+          if (newmark) {+            if (!taken.marked) taken.marked = [];+            taken.marked.push(newmark); newmark.attach(taken);+            if (newmark == mark) mk.splice(i--, 1);+          }+        }+      }+      return taken;+    },+    append: function(line) {+      var mylen = this.text.length, mk = line.marked, mymk = this.marked;+      this.text += line.text;+      copyStyles(0, line.text.length, line.styles, this.styles);+      if (mymk) {+        for (var i = 0; i < mymk.length; ++i)+          if (mymk[i].to == null) mymk[i].to = mylen;+      }+      if (mk && mk.length) {+        if (!mymk) this.marked = mymk = [];+        outer: for (var i = 0; i < mk.length; ++i) {+          var mark = mk[i];+          if (!mark.from) {+            for (var j = 0; j < mymk.length; ++j) {+              var mymark = mymk[j];+              if (mymark.to == mylen && mymark.sameSet(mark)) {+                mymark.to = mark.to == null ? null : mark.to + mylen;+                if (mymark.isDead()) {+                  mymark.detach(this);+                  mk.splice(i--, 1);+                }+                continue outer;+              }+            }+          }+          mymk.push(mark);+          mark.attach(this);+          mark.from += mylen;+          if (mark.to != null) mark.to += mylen;+        }+      }+    },+    fixMarkEnds: function(other) {+      var mk = this.marked, omk = other.marked;+      if (!mk) return;+      outer: for (var i = 0; i < mk.length; ++i) {+        var mark = mk[i], close = mark.to == null;+        if (close && omk) {+          for (var j = 0; j < omk.length; ++j) {+            var om = omk[j];+            if (!om.sameSet(mark) || om.from != null) continue+            if (mark.from == this.text.length && om.to == 0) {+              omk.splice(j, 1);+              mk.splice(i--, 1);+              continue outer;+            } else {+              close = false; break;+            }+          }+        }+        if (close) mark.to = this.text.length;+      }+    },+    fixMarkStarts: function() {+      var mk = this.marked;+      if (!mk) return;+      for (var i = 0; i < mk.length; ++i)+        if (mk[i].from == null) mk[i].from = 0;+    },+    addMark: function(mark) {+      mark.attach(this);+      if (this.marked == null) this.marked = [];+      this.marked.push(mark);+      this.marked.sort(function(a, b){return (a.from || 0) - (b.from || 0);});+    },+    // Run the given mode's parser over a line, update the styles+    // array, which contains alternating fragments of text and CSS+    // classes.+    highlight: function(mode, state, tabSize) {+      var stream = new StringStream(this.text, tabSize), st = this.styles, pos = 0;+      var changed = false, curWord = st[0], prevWord;+      if (this.text == "" && mode.blankLine) mode.blankLine(state);+      while (!stream.eol()) {+        var style = mode.token(stream, state);+        var substr = this.text.slice(stream.start, stream.pos);+        stream.start = stream.pos;+        if (pos && st[pos-1] == style)+          st[pos-2] += substr;+        else if (substr) {+          if (!changed && (st[pos+1] != style || (pos && st[pos-2] != prevWord))) changed = true;+          st[pos++] = substr; st[pos++] = style;+          prevWord = curWord; curWord = st[pos];+        }+        // Give up when line is ridiculously long+        if (stream.pos > 5000) {+          st[pos++] = this.text.slice(stream.pos); st[pos++] = null;+          break;+        }+      }+      if (st.length != pos) {st.length = pos; changed = true;}+      if (pos && st[pos-2] != prevWord) changed = true;+      // Short lines with simple highlights return null, and are+      // counted as changed by the driver because they are likely to+      // highlight the same way in various contexts.+      return changed || (st.length < 5 && this.text.length < 10 ? null : false);+    },+    // Fetch the parser token for a given character. Useful for hacks+    // that want to inspect the mode state (say, for completion).+    getTokenAt: function(mode, state, ch) {+      var txt = this.text, stream = new StringStream(txt);+      while (stream.pos < ch && !stream.eol()) {+        stream.start = stream.pos;+        var style = mode.token(stream, state);+      }+      return {start: stream.start,+              end: stream.pos,+              string: stream.current(),+              className: style || null,+              state: state};+    },+    indentation: function(tabSize) {return countColumn(this.text, null, tabSize);},+    // Produces an HTML fragment for the line, taking selection,+    // marking, and highlighting into account.+    getHTML: function(makeTab, wrapAt, wrapId, wrapWBR) {+      var html = [], first = true, col = 0;+      function span_(text, style) {+        if (!text) return;+        // Work around a bug where, in some compat modes, IE ignores leading spaces+        if (first && ie && text.charAt(0) == " ") text = "\u00a0" + text.slice(1);+        first = false;+        if (text.indexOf("\t") == -1) {+          col += text.length;+          var escaped = htmlEscape(text);+        } else {+          var escaped = "";+          for (var pos = 0;;) {+            var idx = text.indexOf("\t", pos);+            if (idx == -1) {+              escaped += htmlEscape(text.slice(pos));+              col += text.length - pos;+              break;+            } else {+              col += idx - pos;+              var tab = makeTab(col);+              escaped += htmlEscape(text.slice(pos, idx)) + tab.html;+              col += tab.width;+              pos = idx + 1;+            }+          }+        }+        if (style) html.push('<span class="', style, '">', escaped, "</span>");+        else html.push(escaped);+      }+      var span = span_;+      if (wrapAt != null) {+        var outPos = 0, open = "<span id=\"" + wrapId + "\">";+        span = function(text, style) {+          var l = text.length;+          if (wrapAt >= outPos && wrapAt < outPos + l) {+            if (wrapAt > outPos) {+              span_(text.slice(0, wrapAt - outPos), style);+              // See comment at the definition of spanAffectsWrapping+              if (wrapWBR) html.push("<wbr>");+            }+            html.push(open);+            var cut = wrapAt - outPos;+            span_(opera ? text.slice(cut, cut + 1) : text.slice(cut), style);+            html.push("</span>");+            if (opera) span_(text.slice(cut + 1), style);+            wrapAt--;+            outPos += l;+          } else {+            outPos += l;+            span_(text, style);+            // Output empty wrapper when at end of line+            // (Gecko and IE8+ do strange wrapping when adding a space+            // to the end of the line. Other browsers don't react well+            // to zero-width spaces. So we do hideous browser sniffing+            // to determine which to use.)+            if (outPos == wrapAt && outPos == len)+              html.push(open + (gecko || (ie && !ie_lt8) ? "&#x200b;" : " ") + "</span>");+            // Stop outputting HTML when gone sufficiently far beyond measure+            else if (outPos > wrapAt + 10 && /\s/.test(text)) span = function(){};+          }+        }+      }++      var st = this.styles, allText = this.text, marked = this.marked;+      var len = allText.length;+      function styleToClass(style) {+        if (!style) return null;+        return "cm-" + style.replace(/ +/g, " cm-");+      }++      if (!allText && wrapAt == null) {+        span(" ");+      } else if (!marked || !marked.length) {+        for (var i = 0, ch = 0; ch < len; i+=2) {+          var str = st[i], style = st[i+1], l = str.length;+          if (ch + l > len) str = str.slice(0, len - ch);+          ch += l;+          span(str, styleToClass(style));+        }+      } else {+        var pos = 0, i = 0, text = "", style, sg = 0;+        var nextChange = marked[0].from || 0, marks = [], markpos = 0;+        function advanceMarks() {+          var m;+          while (markpos < marked.length &&+                 ((m = marked[markpos]).from == pos || m.from == null)) {+            if (m.style != null) marks.push(m);+            ++markpos;+          }+          nextChange = markpos < marked.length ? marked[markpos].from : Infinity;+          for (var i = 0; i < marks.length; ++i) {+            var to = marks[i].to;+            if (to == null) to = Infinity;+            if (to == pos) marks.splice(i--, 1);+            else nextChange = Math.min(to, nextChange);+          }+        }+        var m = 0;+        while (pos < len) {+          if (nextChange == pos) advanceMarks();+          var upto = Math.min(len, nextChange);+          while (true) {+            if (text) {+              var end = pos + text.length;+              var appliedStyle = style;+              for (var j = 0; j < marks.length; ++j)+                appliedStyle = (appliedStyle ? appliedStyle + " " : "") + marks[j].style;+              span(end > upto ? text.slice(0, upto - pos) : text, appliedStyle);+              if (end >= upto) {text = text.slice(upto - pos); pos = upto; break;}+              pos = end;+            }+            text = st[i++]; style = styleToClass(st[i++]);+          }+        }+      }+      return html.join("");+    },+    cleanUp: function() {+      this.parent = null;+      if (this.marked)+        for (var i = 0, e = this.marked.length; i < e; ++i) this.marked[i].detach(this);+    }+  };+  // Utility used by replace and split above+  function copyStyles(from, to, source, dest) {+    for (var i = 0, pos = 0, state = 0; pos < to; i+=2) {+      var part = source[i], end = pos + part.length;+      if (state == 0) {+        if (end > from) dest.push(part.slice(from - pos, Math.min(part.length, to - pos)), source[i+1]);+        if (end >= from) state = 1;+      } else if (state == 1) {+        if (end > to) dest.push(part.slice(0, to - pos), source[i+1]);+        else dest.push(part, source[i+1]);+      }+      pos = end;+    }+  }++  // Data structure that holds the sequence of lines.+  function LeafChunk(lines) {+    this.lines = lines;+    this.parent = null;+    for (var i = 0, e = lines.length, height = 0; i < e; ++i) {+      lines[i].parent = this;+      height += lines[i].height;+    }+    this.height = height;+  }+  LeafChunk.prototype = {+    chunkSize: function() { return this.lines.length; },+    remove: function(at, n, callbacks) {+      for (var i = at, e = at + n; i < e; ++i) {+        var line = this.lines[i];+        this.height -= line.height;+        line.cleanUp();+        if (line.handlers)+          for (var j = 0; j < line.handlers.length; ++j) callbacks.push(line.handlers[j]);+      }+      this.lines.splice(at, n);+    },+    collapse: function(lines) {+      lines.splice.apply(lines, [lines.length, 0].concat(this.lines));+    },+    insertHeight: function(at, lines, height) {+      this.height += height;+      this.lines = this.lines.slice(0, at).concat(lines).concat(this.lines.slice(at));+      for (var i = 0, e = lines.length; i < e; ++i) lines[i].parent = this;+    },+    iterN: function(at, n, op) {+      for (var e = at + n; at < e; ++at)+        if (op(this.lines[at])) return true;+    }+  };+  function BranchChunk(children) {+    this.children = children;+    var size = 0, height = 0;+    for (var i = 0, e = children.length; i < e; ++i) {+      var ch = children[i];+      size += ch.chunkSize(); height += ch.height;+      ch.parent = this;+    }+    this.size = size;+    this.height = height;+    this.parent = null;+  }+  BranchChunk.prototype = {+    chunkSize: function() { return this.size; },+    remove: function(at, n, callbacks) {+      this.size -= n;+      for (var i = 0; i < this.children.length; ++i) {+        var child = this.children[i], sz = child.chunkSize();+        if (at < sz) {+          var rm = Math.min(n, sz - at), oldHeight = child.height;+          child.remove(at, rm, callbacks);+          this.height -= oldHeight - child.height;+          if (sz == rm) { this.children.splice(i--, 1); child.parent = null; }+          if ((n -= rm) == 0) break;+          at = 0;+        } else at -= sz;+      }+      if (this.size - n < 25) {+        var lines = [];+        this.collapse(lines);+        this.children = [new LeafChunk(lines)];+        this.children[0].parent = this;+      }+    },+    collapse: function(lines) {+      for (var i = 0, e = this.children.length; i < e; ++i) this.children[i].collapse(lines);+    },+    insert: function(at, lines) {+      var height = 0;+      for (var i = 0, e = lines.length; i < e; ++i) height += lines[i].height;+      this.insertHeight(at, lines, height);+    },+    insertHeight: function(at, lines, height) {+      this.size += lines.length;+      this.height += height;+      for (var i = 0, e = this.children.length; i < e; ++i) {+        var child = this.children[i], sz = child.chunkSize();+        if (at <= sz) {+          child.insertHeight(at, lines, height);+          if (child.lines && child.lines.length > 50) {+            while (child.lines.length > 50) {+              var spilled = child.lines.splice(child.lines.length - 25, 25);+              var newleaf = new LeafChunk(spilled);+              child.height -= newleaf.height;+              this.children.splice(i + 1, 0, newleaf);+              newleaf.parent = this;+            }+            this.maybeSpill();+          }+          break;+        }+        at -= sz;+      }+    },+    maybeSpill: function() {+      if (this.children.length <= 10) return;+      var me = this;+      do {+        var spilled = me.children.splice(me.children.length - 5, 5);+        var sibling = new BranchChunk(spilled);+        if (!me.parent) { // Become the parent node+          var copy = new BranchChunk(me.children);+          copy.parent = me;+          me.children = [copy, sibling];+          me = copy;+        } else {+          me.size -= sibling.size;+          me.height -= sibling.height;+          var myIndex = indexOf(me.parent.children, me);+          me.parent.children.splice(myIndex + 1, 0, sibling);+        }+        sibling.parent = me.parent;+      } while (me.children.length > 10);+      me.parent.maybeSpill();+    },+    iter: function(from, to, op) { this.iterN(from, to - from, op); },+    iterN: function(at, n, op) {+      for (var i = 0, e = this.children.length; i < e; ++i) {+        var child = this.children[i], sz = child.chunkSize();+        if (at < sz) {+          var used = Math.min(n, sz - at);+          if (child.iterN(at, used, op)) return true;+          if ((n -= used) == 0) break;+          at = 0;+        } else at -= sz;+      }+    }+  };++  function getLineAt(chunk, n) {+    while (!chunk.lines) {+      for (var i = 0;; ++i) {+        var child = chunk.children[i], sz = child.chunkSize();+        if (n < sz) { chunk = child; break; }+        n -= sz;+      }+    }+    return chunk.lines[n];+  }+  function lineNo(line) {+    if (line.parent == null) return null;+    var cur = line.parent, no = indexOf(cur.lines, line);+    for (var chunk = cur.parent; chunk; cur = chunk, chunk = chunk.parent) {+      for (var i = 0, e = chunk.children.length; ; ++i) {+        if (chunk.children[i] == cur) break;+        no += chunk.children[i].chunkSize();+      }+    }+    return no;+  }+  function lineAtHeight(chunk, h) {+    var n = 0;+    outer: do {+      for (var i = 0, e = chunk.children.length; i < e; ++i) {+        var child = chunk.children[i], ch = child.height;+        if (h < ch) { chunk = child; continue outer; }+        h -= ch;+        n += child.chunkSize();+      }+      return n;+    } while (!chunk.lines);+    for (var i = 0, e = chunk.lines.length; i < e; ++i) {+      var line = chunk.lines[i], lh = line.height;+      if (h < lh) break;+      h -= lh;+    }+    return n + i;+  }+  function heightAtLine(chunk, n) {+    var h = 0;+    outer: do {+      for (var i = 0, e = chunk.children.length; i < e; ++i) {+        var child = chunk.children[i], sz = child.chunkSize();+        if (n < sz) { chunk = child; continue outer; }+        n -= sz;+        h += child.height;+      }+      return h;+    } while (!chunk.lines);+    for (var i = 0; i < n; ++i) h += chunk.lines[i].height;+    return h;+  }++  // The history object 'chunks' changes that are made close together+  // and at almost the same time into bigger undoable units.+  function History() {+    this.time = 0;+    this.done = []; this.undone = [];+    this.compound = 0;+    this.closed = false;+  }+  History.prototype = {+    addChange: function(start, added, old) {+      this.undone.length = 0;+      var time = +new Date, cur = this.done[this.done.length - 1], last = cur && cur[cur.length - 1];+      var dtime = time - this.time;++      if (this.compound && cur && !this.closed) {+        cur.push({start: start, added: added, old: old});+      } else if (dtime > 400 || !last || this.closed ||+                 last.start > start + old.length || last.start + last.added < start) {+        this.done.push([{start: start, added: added, old: old}]);+        this.closed = false;+      } else {+        var startBefore = Math.max(0, last.start - start),+            endAfter = Math.max(0, (start + old.length) - (last.start + last.added));+        for (var i = startBefore; i > 0; --i) last.old.unshift(old[i - 1]);+        for (var i = endAfter; i > 0; --i) last.old.push(old[old.length - i]);+        if (startBefore) last.start = start;+        last.added += added - (old.length - startBefore - endAfter);+      }+      this.time = time;+    },+    startCompound: function() {+      if (!this.compound++) this.closed = true;+    },+    endCompound: function() {+      if (!--this.compound) this.closed = true;+    }+  };++  function stopMethod() {e_stop(this);}+  // Ensure an event has a stop method.+  function addStop(event) {+    if (!event.stop) event.stop = stopMethod;+    return event;+  }++  function e_preventDefault(e) {+    if (e.preventDefault) e.preventDefault();+    else e.returnValue = false;+  }+  function e_stopPropagation(e) {+    if (e.stopPropagation) e.stopPropagation();+    else e.cancelBubble = true;+  }+  function e_stop(e) {e_preventDefault(e); e_stopPropagation(e);}+  CodeMirror.e_stop = e_stop;+  CodeMirror.e_preventDefault = e_preventDefault;+  CodeMirror.e_stopPropagation = e_stopPropagation;++  function e_target(e) {return e.target || e.srcElement;}+  function e_button(e) {+    var b = e.which;+    if (b == null) {+      if (e.button & 1) b = 1;+      else if (e.button & 2) b = 3;+      else if (e.button & 4) b = 2;+    }+    if (mac && e.ctrlKey && b == 1) b = 3;+    return b;+  }++  // Allow 3rd-party code to override event properties by adding an override+  // object to an event object.+  function e_prop(e, prop) {+    var overridden = e.override && e.override.hasOwnProperty(prop);+    return overridden ? e.override[prop] : e[prop];+  }++  // Event handler registration. If disconnect is true, it'll return a+  // function that unregisters the handler.+  function connect(node, type, handler, disconnect) {+    if (typeof node.addEventListener == "function") {+      node.addEventListener(type, handler, false);+      if (disconnect) return function() {node.removeEventListener(type, handler, false);};+    } else {+      var wrapHandler = function(event) {handler(event || window.event);};+      node.attachEvent("on" + type, wrapHandler);+      if (disconnect) return function() {node.detachEvent("on" + type, wrapHandler);};+    }+  }+  CodeMirror.connect = connect;++  function Delayed() {this.id = null;}+  Delayed.prototype = {set: function(ms, f) {clearTimeout(this.id); this.id = setTimeout(f, ms);}};++  var Pass = CodeMirror.Pass = {toString: function(){return "CodeMirror.Pass";}};++  var gecko = /gecko\/\d{7}/i.test(navigator.userAgent);+  var ie = /MSIE \d/.test(navigator.userAgent);+  var ie_lt8 = /MSIE [1-7]\b/.test(navigator.userAgent);+  var ie_lt9 = /MSIE [1-8]\b/.test(navigator.userAgent);+  var quirksMode = ie && document.documentMode == 5;+  var webkit = /WebKit\//.test(navigator.userAgent);+  var chrome = /Chrome\//.test(navigator.userAgent);+  var opera = /Opera\//.test(navigator.userAgent);+  var safari = /Apple Computer/.test(navigator.vendor);+  var khtml = /KHTML\//.test(navigator.userAgent);+  var mac_geLion = /Mac OS X 10\D([7-9]|\d\d)\D/.test(navigator.userAgent);++  // Detect drag-and-drop+  var dragAndDrop = function() {+    // There is *some* kind of drag-and-drop support in IE6-8, but I+    // couldn't get it to work yet.+    if (ie_lt9) return false;+    var div = document.createElement('div');+    return "draggable" in div || "dragDrop" in div;+  }();++  // Feature-detect whether newlines in textareas are converted to \r\n+  var lineSep = function () {+    var te = document.createElement("textarea");+    te.value = "foo\nbar";+    if (te.value.indexOf("\r") > -1) return "\r\n";+    return "\n";+  }();++  // For a reason I have yet to figure out, some browsers disallow+  // word wrapping between certain characters *only* if a new inline+  // element is started between them. This makes it hard to reliably+  // measure the position of things, since that requires inserting an+  // extra span. This terribly fragile set of regexps matches the+  // character combinations that suffer from this phenomenon on the+  // various browsers.+  var spanAffectsWrapping = /^$/; // Won't match any two-character string+  if (gecko) spanAffectsWrapping = /$'/;+  else if (safari) spanAffectsWrapping = /\-[^ \-?]|\?[^ !'\"\),.\-\/:;\?\]\}]/;+  else if (chrome) spanAffectsWrapping = /\-[^ \-\.?]|\?[^ \-\.?\]\}:;!'\"\),\/]|[\.!\"#&%\)*+,:;=>\]|\}~][\(\{\[<]|\$'/;++  // Counts the column offset in a string, taking tabs into account.+  // Used mostly to find indentation.+  function countColumn(string, end, tabSize) {+    if (end == null) {+      end = string.search(/[^\s\u00a0]/);+      if (end == -1) end = string.length;+    }+    for (var i = 0, n = 0; i < end; ++i) {+      if (string.charAt(i) == "\t") n += tabSize - (n % tabSize);+      else ++n;+    }+    return n;+  }++  function computedStyle(elt) {+    if (elt.currentStyle) return elt.currentStyle;+    return window.getComputedStyle(elt, null);+  }++  function eltOffset(node, screen) {+    // Take the parts of bounding client rect that we are interested in so we are able to edit if need be,+    // since the returned value cannot be changed externally (they are kept in sync as the element moves within the page)+    try { var box = node.getBoundingClientRect(); box = { top: box.top, left: box.left }; }+    catch(e) { box = {top: 0, left: 0}; }+    if (!screen) {+      // Get the toplevel scroll, working around browser differences.+      if (window.pageYOffset == null) {+        var t = document.documentElement || document.body.parentNode;+        if (t.scrollTop == null) t = document.body;+        box.top += t.scrollTop; box.left += t.scrollLeft;+      } else {+        box.top += window.pageYOffset; box.left += window.pageXOffset;+      }+    }+    return box;+  }++  // Get a node's text content.+  function eltText(node) {+    return node.textContent || node.innerText || node.nodeValue || "";+  }+  function selectInput(node) {+    if (ios) { // Mobile Safari apparently has a bug where select() is broken.+      node.selectionStart = 0;+      node.selectionEnd = node.value.length;+    } else node.select();+  }++  // Operations on {line, ch} objects.+  function posEq(a, b) {return a.line == b.line && a.ch == b.ch;}+  function posLess(a, b) {return a.line < b.line || (a.line == b.line && a.ch < b.ch);}+  function copyPos(x) {return {line: x.line, ch: x.ch};}++  var escapeElement = document.createElement("pre");+  function htmlEscape(str) {+    escapeElement.textContent = str;+    return escapeElement.innerHTML;+  }+  // Recent (late 2011) Opera betas insert bogus newlines at the start+  // of the textContent, so we strip those.+  if (htmlEscape("a") == "\na") {+    htmlEscape = function(str) {+      escapeElement.textContent = str;+      return escapeElement.innerHTML.slice(1);+    };+  // Some IEs don't preserve tabs through innerHTML+  } else if (htmlEscape("\t") != "\t") {+    htmlEscape = function(str) {+      escapeElement.innerHTML = "";+      escapeElement.appendChild(document.createTextNode(str));+      return escapeElement.innerHTML;+    };+  }+  CodeMirror.htmlEscape = htmlEscape;++  // Used to position the cursor after an undo/redo by finding the+  // last edited character.+  function editEnd(from, to) {+    if (!to) return 0;+    if (!from) return to.length;+    for (var i = from.length, j = to.length; i >= 0 && j >= 0; --i, --j)+      if (from.charAt(i) != to.charAt(j)) break;+    return j + 1;+  }++  function indexOf(collection, elt) {+    if (collection.indexOf) return collection.indexOf(elt);+    for (var i = 0, e = collection.length; i < e; ++i)+      if (collection[i] == elt) return i;+    return -1;+  }+  function isWordChar(ch) {+    return /\w/.test(ch) || ch.toUpperCase() != ch.toLowerCase();+  }++  // See if "".split is the broken IE version, if so, provide an+  // alternative way to split lines.+  var splitLines = "\n\nb".split(/\n/).length != 3 ? function(string) {+    var pos = 0, result = [], l = string.length;+    while (pos <= l) {+      var nl = string.indexOf("\n", pos);+      if (nl == -1) nl = string.length;+      var line = string.slice(pos, string.charAt(nl - 1) == "\r" ? nl - 1 : nl);+      var rt = line.indexOf("\r");+      if (rt != -1) {+        result.push(line.slice(0, rt));+        pos += rt + 1;+      } else {+        result.push(line);+        pos = nl + 1;+      }+    }+    return result;+  } : function(string){return string.split(/\r\n?|\n/);};+  CodeMirror.splitLines = splitLines;++  var hasSelection = window.getSelection ? function(te) {+    try { return te.selectionStart != te.selectionEnd; }+    catch(e) { return false; }+  } : function(te) {+    try {var range = te.ownerDocument.selection.createRange();}+    catch(e) {}+    if (!range || range.parentElement() != te) return false;+    return range.compareEndPoints("StartToEnd", range) != 0;+  };++  CodeMirror.defineMode("null", function() {+    return {token: function(stream) {stream.skipToEnd();}};+  });+  CodeMirror.defineMIME("text/plain", "null");++  var keyNames = {3: "Enter", 8: "Backspace", 9: "Tab", 13: "Enter", 16: "Shift", 17: "Ctrl", 18: "Alt",+                  19: "Pause", 20: "CapsLock", 27: "Esc", 32: "Space", 33: "PageUp", 34: "PageDown", 35: "End",+                  36: "Home", 37: "Left", 38: "Up", 39: "Right", 40: "Down", 44: "PrintScrn", 45: "Insert",+                  46: "Delete", 59: ";", 91: "Mod", 92: "Mod", 93: "Mod", 109: "-", 107: "=", 127: "Delete",+                  186: ";", 187: "=", 188: ",", 189: "-", 190: ".", 191: "/", 192: "`", 219: "[", 220: "\\",+                  221: "]", 222: "'", 63276: "PageUp", 63277: "PageDown", 63275: "End", 63273: "Home",+                  63234: "Left", 63232: "Up", 63235: "Right", 63233: "Down", 63302: "Insert", 63272: "Delete"};+  CodeMirror.keyNames = keyNames;+  (function() {+    // Number keys+    for (var i = 0; i < 10; i++) keyNames[i + 48] = String(i);+    // Alphabetic keys+    for (var i = 65; i <= 90; i++) keyNames[i] = String.fromCharCode(i);+    // Function keys+    for (var i = 1; i <= 12; i++) keyNames[i + 111] = keyNames[i + 63235] = "F" + i;+  })();++  return CodeMirror;+})();
+ static/codemirror/lib/util/closetag.js view
@@ -0,0 +1,164 @@+/**
+ * Tag-closer extension for CodeMirror.
+ *
+ * This extension adds a "closeTag" utility function that can be used with key bindings to 
+ * insert a matching end tag after the ">" character of a start tag has been typed.  It can
+ * also complete "</" if a matching start tag is found.  It will correctly ignore signal
+ * characters for empty tags, comments, CDATA, etc.
+ *
+ * The function depends on internal parser state to identify tags.  It is compatible with the
+ * following CodeMirror modes and will ignore all others:
+ * - htmlmixed
+ * - xml
+ *
+ * See demos/closetag.html for a usage example.
+ * 
+ * @author Nathan Williams <nathan@nlwillia.net>
+ * Contributed under the same license terms as CodeMirror.
+ */
+(function() {
+	/** Option that allows tag closing behavior to be toggled.  Default is true. */
+	CodeMirror.defaults['closeTagEnabled'] = true;
+	
+	/** Array of tag names to add indentation after the start tag for.  Default is the list of block-level html tags. */
+	CodeMirror.defaults['closeTagIndent'] = ['applet', 'blockquote', 'body', 'button', 'div', 'dl', 'fieldset', 'form', 'frameset', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'html', 'iframe', 'layer', 'legend', 'object', 'ol', 'p', 'select', 'table', 'ul'];
+
+	/** Array of tag names where an end tag is forbidden. */
+	CodeMirror.defaults['closeTagVoid'] = ['area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr'];
+
+	/**
+	 * Call during key processing to close tags.  Handles the key event if the tag is closed, otherwise throws CodeMirror.Pass.
+	 * - cm: The editor instance.
+	 * - ch: The character being processed.
+	 * - indent: Optional.  An array of tag names to indent when closing.  Omit or pass true to use the default indentation tag list defined in the 'closeTagIndent' option.
+	 *   Pass false to disable indentation.  Pass an array to override the default list of tag names.
+	 * - vd: Optional.  An array of tag names that should not be closed.  Omit to use the default void (end tag forbidden) tag list defined in the 'closeTagVoid' option.  Ignored in xml mode.
+	 */
+	CodeMirror.defineExtension("closeTag", function(cm, ch, indent, vd) {
+		if (!cm.getOption('closeTagEnabled')) {
+			throw CodeMirror.Pass;
+		}
+		
+		var mode = cm.getOption('mode');
+		
+		if (mode == 'text/html' || mode == 'xml') {
+		
+			/*
+			 * Relevant structure of token:
+			 *
+			 * htmlmixed
+			 * 		className
+			 * 		state
+			 * 			htmlState
+			 * 				type
+			 *				tagName
+			 * 				context
+			 * 					tagName
+			 * 			mode
+			 * 
+			 * xml
+			 * 		className
+			 * 		state
+			 * 			tagName
+			 * 			type
+			 */
+		
+			var pos = cm.getCursor();
+			var tok = cm.getTokenAt(pos);
+			var state = tok.state;
+			
+			if (state.mode && state.mode != 'html') {
+				throw CodeMirror.Pass; // With htmlmixed, we only care about the html sub-mode.
+			}
+			
+			if (ch == '>') {
+				var type = state.htmlState ? state.htmlState.type : state.type; // htmlmixed : xml
+				
+				if (tok.className == 'tag' && type == 'closeTag') {
+					throw CodeMirror.Pass; // Don't process the '>' at the end of an end-tag.
+				}
+			
+				cm.replaceSelection('>'); // Mode state won't update until we finish the tag.
+				pos = {line: pos.line, ch: pos.ch + 1};
+				cm.setCursor(pos);
+		
+				tok = cm.getTokenAt(cm.getCursor());
+				state = tok.state;
+				type = state.htmlState ? state.htmlState.type : state.type; // htmlmixed : xml
+
+				if (tok.className == 'tag' && type != 'selfcloseTag') {
+					var tagName = state.htmlState ? state.htmlState.tagName : state.tagName; // htmlmixed : xml
+					if (tagName.length > 0 && shouldClose(cm, vd, tagName)) {
+						insertEndTag(cm, indent, pos, tagName);
+					}
+					return;
+				}
+				
+				// Undo the '>' insert and allow cm to handle the key instead.
+				cm.setSelection({line: pos.line, ch: pos.ch - 1}, pos);
+				cm.replaceSelection("");
+			
+			} else if (ch == '/') {
+				if (tok.className == 'tag' && tok.string == '<') {
+					var tagName = state.htmlState ? (state.htmlState.context ? state.htmlState.context.tagName : '') : (state.context ? state.context.tagName : ''); // htmlmixed : xml
+					if (tagName.length > 0) {
+						completeEndTag(cm, pos, tagName);
+						return;
+					}
+				}
+			}
+		
+		}
+		
+		throw CodeMirror.Pass; // Bubble if not handled
+	});
+
+	function insertEndTag(cm, indent, pos, tagName) {
+		if (shouldIndent(cm, indent, tagName)) {
+			cm.replaceSelection('\n\n</' + tagName + '>', 'end');
+			cm.indentLine(pos.line + 1);
+			cm.indentLine(pos.line + 2);
+			cm.setCursor({line: pos.line + 1, ch: cm.getLine(pos.line + 1).length});
+		} else {
+			cm.replaceSelection('</' + tagName + '>');
+			cm.setCursor(pos);
+		}
+	}
+	
+	function shouldIndent(cm, indent, tagName) {
+		if (typeof indent == 'undefined' || indent == null || indent == true) {
+			indent = cm.getOption('closeTagIndent');
+		}
+		if (!indent) {
+			indent = [];
+		}
+		return indexOf(indent, tagName.toLowerCase()) != -1;
+	}
+	
+	function shouldClose(cm, vd, tagName) {
+		if (cm.getOption('mode') == 'xml') {
+			return true; // always close xml tags
+		}
+		if (typeof vd == 'undefined' || vd == null) {
+			vd = cm.getOption('closeTagVoid');
+		}
+		if (!vd) {
+			vd = [];
+		}
+		return indexOf(vd, tagName.toLowerCase()) == -1;
+	}
+	
+	// C&P from codemirror.js...would be nice if this were visible to utilities.
+	function indexOf(collection, elt) {
+		if (collection.indexOf) return collection.indexOf(elt);
+		for (var i = 0, e = collection.length; i < e; ++i)
+			if (collection[i] == elt) return i;
+		return -1;
+	}
+
+	function completeEndTag(cm, pos, tagName) {
+		cm.replaceSelection('/' + tagName + '>');
+		cm.setCursor({line: pos.line, ch: pos.ch + tagName.length + 2 });
+	}
+	
+})();
+ static/codemirror/lib/util/dialog.css view
@@ -0,0 +1,27 @@+.CodeMirror-dialog {+  position: relative;+}++.CodeMirror-dialog > div {+  position: absolute;+  top: 0; left: 0; right: 0;+  background: white;+  border-bottom: 1px solid #eee;+  z-index: 15;+  padding: .1em .8em;+  overflow: hidden;+  color: #333;+}++.CodeMirror-dialog input {+  border: none;+  outline: none;+  background: transparent;+  width: 20em;+  color: inherit;+  font-family: monospace;+}++.CodeMirror-dialog button {+  font-size: 70%;+}
+ static/codemirror/lib/util/dialog.js view
@@ -0,0 +1,67 @@+// Open simple dialogs on top of an editor. Relies on dialog.css.++(function() {+  function dialogDiv(cm, template) {+    var wrap = cm.getWrapperElement();+    var dialog = wrap.insertBefore(document.createElement("div"), wrap.firstChild);+    dialog.className = "CodeMirror-dialog";+    dialog.innerHTML = '<div>' + template + '</div>';+    return dialog;+  }++  CodeMirror.defineExtension("openDialog", function(template, callback) {+    var dialog = dialogDiv(this, template);+    var closed = false, me = this;+    function close() {+      if (closed) return;+      closed = true;+      dialog.parentNode.removeChild(dialog);+    }+    var inp = dialog.getElementsByTagName("input")[0], button;+    if (inp) {+      CodeMirror.connect(inp, "keydown", function(e) {+        if (e.keyCode == 13 || e.keyCode == 27) {+          CodeMirror.e_stop(e);+          close();+          me.focus();+          if (e.keyCode == 13) callback(inp.value);+        }+      });+      inp.focus();+      CodeMirror.connect(inp, "blur", close);+    } else if (button = dialog.getElementsByTagName("button")[0]) {+      CodeMirror.connect(button, "click", close);+      button.focus();+      CodeMirror.connect(button, "blur", close);+    }+    return close;+  });++  CodeMirror.defineExtension("openConfirm", function(template, callbacks) {+    var dialog = dialogDiv(this, template);+    var buttons = dialog.getElementsByTagName("button");+    var closed = false, me = this, blurring = 1;+    function close() {+      if (closed) return;+      closed = true;+      dialog.parentNode.removeChild(dialog);+      me.focus();+    }+    buttons[0].focus();+    for (var i = 0; i < buttons.length; ++i) {+      var b = buttons[i];+      (function(callback) {+        CodeMirror.connect(b, "click", function(e) {+          CodeMirror.e_preventDefault(e);+          close();+          if (callback) callback(me);+        });+      })(callbacks[i]);+      CodeMirror.connect(b, "blur", function() {+        --blurring;+        setTimeout(function() { if (blurring <= 0) close(); }, 200);+      });+      CodeMirror.connect(b, "focus", function() { ++blurring; });+    }+  });+})();
+ static/codemirror/lib/util/foldcode.js view
@@ -0,0 +1,196 @@+// the tagRangeFinder function is+//   Copyright (C) 2011 by Daniel Glazman <daniel@glazman.org>+// released under the MIT license (../../LICENSE) like the rest of CodeMirror+CodeMirror.tagRangeFinder = function(cm, line, hideEnd) {+  var nameStartChar = "A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD";+  var nameChar = nameStartChar + "\-\:\.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040";+  var xmlNAMERegExp = new RegExp("^[" + nameStartChar + "][" + nameChar + "]*");++  var lineText = cm.getLine(line);+  var found = false;+  var tag = null;+  var pos = 0;+  while (!found) {+    pos = lineText.indexOf("<", pos);+    if (-1 == pos) // no tag on line+      return;+    if (pos + 1 < lineText.length && lineText[pos + 1] == "/") { // closing tag+      pos++;+      continue;+    }+    // ok we weem to have a start tag+    if (!lineText.substr(pos + 1).match(xmlNAMERegExp)) { // not a tag name...+      pos++;+      continue;+    }+    var gtPos = lineText.indexOf(">", pos + 1);+    if (-1 == gtPos) { // end of start tag not in line+      var l = line + 1;+      var foundGt = false;+      var lastLine = cm.lineCount();+      while (l < lastLine && !foundGt) {+        var lt = cm.getLine(l);+        var gt = lt.indexOf(">");+        if (-1 != gt) { // found a >+          foundGt = true;+          var slash = lt.lastIndexOf("/", gt);+          if (-1 != slash && slash < gt) {+            var str = lineText.substr(slash, gt - slash + 1);+            if (!str.match( /\/\s*\>/ )) { // yep, that's the end of empty tag+              if (hideEnd === true) l++;+              return l;+            }+          }+        }+        l++;+      }+      found = true;+    }+    else {+      var slashPos = lineText.lastIndexOf("/", gtPos);+      if (-1 == slashPos) { // cannot be empty tag+        found = true;+        // don't continue+      }+      else { // empty tag?+        // check if really empty tag+        var str = lineText.substr(slashPos, gtPos - slashPos + 1);+        if (!str.match( /\/\s*\>/ )) { // finally not empty+          found = true;+          // don't continue+        }+      }+    }+    if (found) {+      var subLine = lineText.substr(pos + 1);+      tag = subLine.match(xmlNAMERegExp);+      if (tag) {+        // we have an element name, wooohooo !+        tag = tag[0];+        // do we have the close tag on same line ???+        if (-1 != lineText.indexOf("</" + tag + ">", pos)) // yep+        {+          found = false;+        }+        // we don't, so we have a candidate...+      }+      else+        found = false;+    }+    if (!found)+      pos++;+  }++  if (found) {+    var startTag = "(\\<\\/" + tag + "\\>)|(\\<" + tag + "\\>)|(\\<" + tag + "\\s)|(\\<" + tag + "$)";+    var startTagRegExp = new RegExp(startTag, "g");+    var endTag = "</" + tag + ">";+    var depth = 1;+    var l = line + 1;+    var lastLine = cm.lineCount();+    while (l < lastLine) {+      lineText = cm.getLine(l);+      var match = lineText.match(startTagRegExp);+      if (match) {+        for (var i = 0; i < match.length; i++) {+          if (match[i] == endTag)+            depth--;+          else+            depth++;+          if (!depth) {+            if (hideEnd === true) l++;+            return l;+          }+        }+      }+      l++;+    }+    return;+  }+};++CodeMirror.braceRangeFinder = function(cm, line, hideEnd) {+  var lineText = cm.getLine(line), at = lineText.length, startChar, tokenType;+  for (;;) {+    var found = lineText.lastIndexOf("{", at);+    if (found < 0) break;+    tokenType = cm.getTokenAt({line: line, ch: found}).className;+    if (!/^(comment|string)/.test(tokenType)) { startChar = found; break; }+    at = found - 1;+  }+  if (startChar == null || lineText.lastIndexOf("}") > startChar) return;+  var count = 1, lastLine = cm.lineCount(), end;+  outer: for (var i = line + 1; i < lastLine; ++i) {+    var text = cm.getLine(i), pos = 0;+    for (;;) {+      var nextOpen = text.indexOf("{", pos), nextClose = text.indexOf("}", pos);+      if (nextOpen < 0) nextOpen = text.length;+      if (nextClose < 0) nextClose = text.length;+      pos = Math.min(nextOpen, nextClose);+      if (pos == text.length) break;+      if (cm.getTokenAt({line: i, ch: pos + 1}).className == tokenType) {+        if (pos == nextOpen) ++count;+        else if (!--count) { end = i; break outer; }+      }+      ++pos;+    }+  }+  if (end == null || end == line + 1) return;+  if (hideEnd === true) end++;+  return end;+};++CodeMirror.indentRangeFinder = function(cm, line) {+  var tabSize = cm.getOption("tabSize");+  var myIndent = cm.getLineHandle(line).indentation(tabSize), last;+  for (var i = line + 1, end = cm.lineCount(); i < end; ++i) {+    var handle = cm.getLineHandle(i);+    if (!/^\s*$/.test(handle.text)) {+      if (handle.indentation(tabSize) <= myIndent) break;+      last = i;+    }+  }+  if (!last) return null;+  return last + 1;+};++CodeMirror.newFoldFunction = function(rangeFinder, markText, hideEnd) {+  var folded = [];+  if (markText == null) markText = '<div style="position: absolute; left: 2px; color:#600">&#x25bc;</div>%N%';++  function isFolded(cm, n) {+    for (var i = 0; i < folded.length; ++i) {+      var start = cm.lineInfo(folded[i].start);+      if (!start) folded.splice(i--, 1);+      else if (start.line == n) return {pos: i, region: folded[i]};+    }+  }++  function expand(cm, region) {+    cm.clearMarker(region.start);+    for (var i = 0; i < region.hidden.length; ++i)+      cm.showLine(region.hidden[i]);+  }++  return function(cm, line) {+    cm.operation(function() {+      var known = isFolded(cm, line);+      if (known) {+        folded.splice(known.pos, 1);+        expand(cm, known.region);+      } else {+        var end = rangeFinder(cm, line, hideEnd);+        if (end == null) return;+        var hidden = [];+        for (var i = line + 1; i < end; ++i) {+          var handle = cm.hideLine(i);+          if (handle) hidden.push(handle);+        }+        var first = cm.setMarker(line, markText);+        var region = {start: first, hidden: hidden};+        cm.onDeleteLine(first, function() { expand(cm, region); });+        folded.push(region);+      }+    });+  };+};
+ static/codemirror/lib/util/formatting.js view
@@ -0,0 +1,299 @@+// ============== Formatting extensions ============================+// A common storage for all mode-specific formatting features+if (!CodeMirror.modeExtensions) CodeMirror.modeExtensions = {};++// Returns the extension of the editor's current mode+CodeMirror.defineExtension("getModeExt", function () {+  var mname = CodeMirror.resolveMode(this.getOption("mode")).name;+  var ext = CodeMirror.modeExtensions[mname];+  if (!ext) throw new Error("No extensions found for mode " + mname);+  return ext;+});++// If the current mode is 'htmlmixed', returns the extension of a mode located at+// the specified position (can be htmlmixed, css or javascript). Otherwise, simply+// returns the extension of the editor's current mode.+CodeMirror.defineExtension("getModeExtAtPos", function (pos) {+  var token = this.getTokenAt(pos);+  if (token && token.state && token.state.mode)+    return CodeMirror.modeExtensions[token.state.mode == "html" ? "htmlmixed" : token.state.mode];+  else+    return this.getModeExt();+});++// Comment/uncomment the specified range+CodeMirror.defineExtension("commentRange", function (isComment, from, to) {+  var curMode = this.getModeExtAtPos(this.getCursor());+  if (isComment) { // Comment range+    var commentedText = this.getRange(from, to);+    this.replaceRange(curMode.commentStart + this.getRange(from, to) + curMode.commentEnd+      , from, to);+    if (from.line == to.line && from.ch == to.ch) { // An empty comment inserted - put cursor inside+      this.setCursor(from.line, from.ch + curMode.commentStart.length);+    }+  }+  else { // Uncomment range+    var selText = this.getRange(from, to);+    var startIndex = selText.indexOf(curMode.commentStart);+    var endIndex = selText.lastIndexOf(curMode.commentEnd);+    if (startIndex > -1 && endIndex > -1 && endIndex > startIndex) {+      // Take string till comment start+      selText = selText.substr(0, startIndex)+      // From comment start till comment end+        + selText.substring(startIndex + curMode.commentStart.length, endIndex)+      // From comment end till string end+        + selText.substr(endIndex + curMode.commentEnd.length);+    }+    this.replaceRange(selText, from, to);+  }+});++// Applies automatic mode-aware indentation to the specified range+CodeMirror.defineExtension("autoIndentRange", function (from, to) {+  var cmInstance = this;+  this.operation(function () {+    for (var i = from.line; i <= to.line; i++) {+      cmInstance.indentLine(i, "smart");+    }+  });+});++// Applies automatic formatting to the specified range+CodeMirror.defineExtension("autoFormatRange", function (from, to) {+  var absStart = this.indexFromPos(from);+  var absEnd = this.indexFromPos(to);+  // Insert additional line breaks where necessary according to the+  // mode's syntax+  var res = this.getModeExt().autoFormatLineBreaks(this.getValue(), absStart, absEnd);+  var cmInstance = this;++  // Replace and auto-indent the range+  this.operation(function () {+    cmInstance.replaceRange(res, from, to);+    var startLine = cmInstance.posFromIndex(absStart).line;+    var endLine = cmInstance.posFromIndex(absStart + res.length).line;+    for (var i = startLine; i <= endLine; i++) {+      cmInstance.indentLine(i, "smart");+    }+  });+});++// Define extensions for a few modes++CodeMirror.modeExtensions["css"] = {+  commentStart: "/*",+  commentEnd: "*/",+  wordWrapChars: [";", "\\{", "\\}"],+  autoFormatLineBreaks: function (text, startPos, endPos) {+    text = text.substring(startPos, endPos);+    return text.replace(new RegExp("(;|\\{|\\})([^\r\n])", "g"), "$1\n$2");+  }+};++CodeMirror.modeExtensions["javascript"] = {+  commentStart: "/*",+  commentEnd: "*/",+  wordWrapChars: [";", "\\{", "\\}"],++  getNonBreakableBlocks: function (text) {+    var nonBreakableRegexes = [+        new RegExp("for\\s*?\\(([\\s\\S]*?)\\)"),+        new RegExp("\\\\\"([\\s\\S]*?)(\\\\\"|$)"),+        new RegExp("\\\\\'([\\s\\S]*?)(\\\\\'|$)"),+        new RegExp("'([\\s\\S]*?)('|$)"),+        new RegExp("\"([\\s\\S]*?)(\"|$)"),+        new RegExp("//.*([\r\n]|$)")+      ];+    var nonBreakableBlocks = new Array();+    for (var i = 0; i < nonBreakableRegexes.length; i++) {+      var curPos = 0;+      while (curPos < text.length) {+        var m = text.substr(curPos).match(nonBreakableRegexes[i]);+        if (m != null) {+          nonBreakableBlocks.push({+            start: curPos + m.index,+            end: curPos + m.index + m[0].length+          });+          curPos += m.index + Math.max(1, m[0].length);+        }+        else { // No more matches+          break;+        }+      }+    }+    nonBreakableBlocks.sort(function (a, b) {+      return a.start - b.start;+    });++    return nonBreakableBlocks;+  },++  autoFormatLineBreaks: function (text, startPos, endPos) {+    text = text.substring(startPos, endPos);+    var curPos = 0;+    var reLinesSplitter = new RegExp("(;|\\{|\\})([^\r\n])", "g");+    var nonBreakableBlocks = this.getNonBreakableBlocks(text);+    if (nonBreakableBlocks != null) {+      var res = "";+      for (var i = 0; i < nonBreakableBlocks.length; i++) {+        if (nonBreakableBlocks[i].start > curPos) { // Break lines till the block+          res += text.substring(curPos, nonBreakableBlocks[i].start).replace(reLinesSplitter, "$1\n$2");+          curPos = nonBreakableBlocks[i].start;+        }+        if (nonBreakableBlocks[i].start <= curPos+          && nonBreakableBlocks[i].end >= curPos) { // Skip non-breakable block+          res += text.substring(curPos, nonBreakableBlocks[i].end);+          curPos = nonBreakableBlocks[i].end;+        }+      }+      if (curPos < text.length - 1) {+        res += text.substr(curPos).replace(reLinesSplitter, "$1\n$2");+      }+      return res;+    }+    else {+      return text.replace(reLinesSplitter, "$1\n$2");+    }+  }+};++CodeMirror.modeExtensions["xml"] = {+  commentStart: "<!--",+  commentEnd: "-->",+  wordWrapChars: [">"],++  autoFormatLineBreaks: function (text, startPos, endPos) {+    text = text.substring(startPos, endPos);+    var lines = text.split("\n");+    var reProcessedPortion = new RegExp("(^\\s*?<|^[^<]*?)(.+)(>\\s*?$|[^>]*?$)");+    var reOpenBrackets = new RegExp("<", "g");+    var reCloseBrackets = new RegExp("(>)([^\r\n])", "g");+    for (var i = 0; i < lines.length; i++) {+      var mToProcess = lines[i].match(reProcessedPortion);+      if (mToProcess != null && mToProcess.length > 3) { // The line starts with whitespaces and ends with whitespaces+        lines[i] = mToProcess[1]+            + mToProcess[2].replace(reOpenBrackets, "\n$&").replace(reCloseBrackets, "$1\n$2")+            + mToProcess[3];+        continue;+      }+    }++    return lines.join("\n");+  }+};++CodeMirror.modeExtensions["htmlmixed"] = {+  commentStart: "<!--",+  commentEnd: "-->",+  wordWrapChars: [">", ";", "\\{", "\\}"],++  getModeInfos: function (text, absPos) {+    var modeInfos = new Array();+    modeInfos[0] =+      {+        pos: 0,+        modeExt: CodeMirror.modeExtensions["xml"],+        modeName: "xml"+      };++    var modeMatchers = new Array();+    modeMatchers[0] =+      {+        regex: new RegExp("<style[^>]*>([\\s\\S]*?)(</style[^>]*>|$)", "i"),+        modeExt: CodeMirror.modeExtensions["css"],+        modeName: "css"+      };+    modeMatchers[1] =+      {+        regex: new RegExp("<script[^>]*>([\\s\\S]*?)(</script[^>]*>|$)", "i"),+        modeExt: CodeMirror.modeExtensions["javascript"],+        modeName: "javascript"+      };++    var lastCharPos = (typeof (absPos) !== "undefined" ? absPos : text.length - 1);+    // Detect modes for the entire text+    for (var i = 0; i < modeMatchers.length; i++) {+      var curPos = 0;+      while (curPos <= lastCharPos) {+        var m = text.substr(curPos).match(modeMatchers[i].regex);+        if (m != null) {+          if (m.length > 1 && m[1].length > 0) {+            // Push block begin pos+            var blockBegin = curPos + m.index + m[0].indexOf(m[1]);+            modeInfos.push(+              {+                pos: blockBegin,+                modeExt: modeMatchers[i].modeExt,+                modeName: modeMatchers[i].modeName+              });+            // Push block end pos+            modeInfos.push(+              {+                pos: blockBegin + m[1].length,+                modeExt: modeInfos[0].modeExt,+                modeName: modeInfos[0].modeName+              });+            curPos += m.index + m[0].length;+            continue;+          }+          else {+            curPos += m.index + Math.max(m[0].length, 1);+          }+        }+        else { // No more matches+          break;+        }+      }+    }+    // Sort mode infos+    modeInfos.sort(function sortModeInfo(a, b) {+      return a.pos - b.pos;+    });++    return modeInfos;+  },++  autoFormatLineBreaks: function (text, startPos, endPos) {+    var modeInfos = this.getModeInfos(text);+    var reBlockStartsWithNewline = new RegExp("^\\s*?\n");+    var reBlockEndsWithNewline = new RegExp("\n\\s*?$");+    var res = "";+    // Use modes info to break lines correspondingly+    if (modeInfos.length > 1) { // Deal with multi-mode text+      for (var i = 1; i <= modeInfos.length; i++) {+        var selStart = modeInfos[i - 1].pos;+        var selEnd = (i < modeInfos.length ? modeInfos[i].pos : endPos);++        if (selStart >= endPos) { // The block starts later than the needed fragment+          break;+        }+        if (selStart < startPos) {+          if (selEnd <= startPos) { // The block starts earlier than the needed fragment+            continue;+          }+          selStart = startPos;+        }+        if (selEnd > endPos) {+          selEnd = endPos;+        }+        var textPortion = text.substring(selStart, selEnd);+        if (modeInfos[i - 1].modeName != "xml") { // Starting a CSS or JavaScript block+          if (!reBlockStartsWithNewline.test(textPortion)+              && selStart > 0) { // The block does not start with a line break+            textPortion = "\n" + textPortion;+          }+          if (!reBlockEndsWithNewline.test(textPortion)+              && selEnd < text.length - 1) { // The block does not end with a line break+            textPortion += "\n";+          }+        }+        res += modeInfos[i - 1].modeExt.autoFormatLineBreaks(textPortion);+      }+    }+    else { // Single-mode text+      res = modeInfos[0].modeExt.autoFormatLineBreaks(text.substring(startPos, endPos));+    }++    return res;+  }+};
+ static/codemirror/lib/util/javascript-hint.js view
@@ -0,0 +1,134 @@+(function () {+  function forEach(arr, f) {+    for (var i = 0, e = arr.length; i < e; ++i) f(arr[i]);+  }+  +  function arrayContains(arr, item) {+    if (!Array.prototype.indexOf) {+      var i = arr.length;+      while (i--) {+        if (arr[i] === item) {+          return true;+        }+      }+      return false;+    }+    return arr.indexOf(item) != -1;+  }++  function scriptHint(editor, keywords, getToken) {+    // Find the token at the cursor+    var cur = editor.getCursor(), token = getToken(editor, cur), tprop = token;+    // If it's not a 'word-style' token, ignore the token.+		if (!/^[\w$_]*$/.test(token.string)) {+      token = tprop = {start: cur.ch, end: cur.ch, string: "", state: token.state,+                       className: token.string == "." ? "property" : null};+    }+    // If it is a property, find out what it is a property of.+    while (tprop.className == "property") {+      tprop = getToken(editor, {line: cur.line, ch: tprop.start});+      if (tprop.string != ".") return;+      tprop = getToken(editor, {line: cur.line, ch: tprop.start});+      if (tprop.string == ')') {+        var level = 1;+        do {+          tprop = getToken(editor, {line: cur.line, ch: tprop.start});+          switch (tprop.string) {+          case ')': level++; break;+          case '(': level--; break;+          default: break;+          }+        } while (level > 0)+        tprop = getToken(editor, {line: cur.line, ch: tprop.start});+				if (tprop.className == 'variable')+					tprop.className = 'function';+				else return; // no clue+      }+      if (!context) var context = [];+      context.push(tprop);+    }+    return {list: getCompletions(token, context, keywords),+            from: {line: cur.line, ch: token.start},+            to: {line: cur.line, ch: token.end}};+  }++  CodeMirror.javascriptHint = function(editor) {+    return scriptHint(editor, javascriptKeywords,+                      function (e, cur) {return e.getTokenAt(cur);});+  }++  function getCoffeeScriptToken(editor, cur) {+  // This getToken, it is for coffeescript, imitates the behavior of+  // getTokenAt method in javascript.js, that is, returning "property"+  // type and treat "." as indepenent token.+    var token = editor.getTokenAt(cur);+    if (cur.ch == token.start + 1 && token.string.charAt(0) == '.') {+      token.end = token.start;+      token.string = '.';+      token.className = "property";+    }+    else if (/^\.[\w$_]*$/.test(token.string)) {+      token.className = "property";+      token.start++;+      token.string = token.string.replace(/\./, '');+    }+    return token;+  }++  CodeMirror.coffeescriptHint = function(editor) {+    return scriptHint(editor, coffeescriptKeywords, getCoffeeScriptToken);+  }++  var stringProps = ("charAt charCodeAt indexOf lastIndexOf substring substr slice trim trimLeft trimRight " ++                     "toUpperCase toLowerCase split concat match replace search").split(" ");+  var arrayProps = ("length concat join splice push pop shift unshift slice reverse sort indexOf " ++                    "lastIndexOf every some filter forEach map reduce reduceRight ").split(" ");+  var funcProps = "prototype apply call bind".split(" ");+  var javascriptKeywords = ("break case catch continue debugger default delete do else false finally for function " ++                  "if in instanceof new null return switch throw true try typeof var void while with").split(" ");+  var coffeescriptKeywords = ("and break catch class continue delete do else extends false finally for " ++                  "if in instanceof isnt new no not null of off on or return switch then throw true try typeof until void while with yes").split(" ");++  function getCompletions(token, context, keywords) {+    var found = [], start = token.string;+    function maybeAdd(str) {+      if (str.indexOf(start) == 0 && !arrayContains(found, str)) found.push(str);+    }+    function gatherCompletions(obj) {+      if (typeof obj == "string") forEach(stringProps, maybeAdd);+      else if (obj instanceof Array) forEach(arrayProps, maybeAdd);+      else if (obj instanceof Function) forEach(funcProps, maybeAdd);+      for (var name in obj) maybeAdd(name);+    }++    if (context) {+      // If this is a property, see if it belongs to some object we can+      // find in the current environment.+      var obj = context.pop(), base;+      if (obj.className == "variable")+        base = window[obj.string];+      else if (obj.className == "string")+        base = "";+      else if (obj.className == "atom")+        base = 1;+      else if (obj.className == "function") {+        if (window.jQuery != null && (obj.string == '$' || obj.string == 'jQuery') &&+            (typeof window.jQuery == 'function'))+          base = window.jQuery();+        else if (window._ != null && (obj.string == '_') && (typeof window._ == 'function'))+          base = window._();+      }+      while (base != null && context.length)+        base = base[context.pop().string];+      if (base != null) gatherCompletions(base);+    }+    else {+      // If not, just look in the window object and any local scope+      // (reading into JS mode internals to get at the local variables)+      for (var v = token.state.localVars; v; v = v.next) maybeAdd(v.name);+      gatherCompletions(window);+      forEach(keywords, maybeAdd);+    }+    return found;+  }+})();
+ static/codemirror/lib/util/loadmode.js view
@@ -0,0 +1,51 @@+(function() {+  if (!CodeMirror.modeURL) CodeMirror.modeURL = "../mode/%N/%N.js";++  var loading = {};+  function splitCallback(cont, n) {+    var countDown = n;+    return function() { if (--countDown == 0) cont(); }+  }+  function ensureDeps(mode, cont) {+    var deps = CodeMirror.modes[mode].dependencies;+    if (!deps) return cont();+    var missing = [];+    for (var i = 0; i < deps.length; ++i) {+      if (!CodeMirror.modes.hasOwnProperty(deps[i]))+        missing.push(deps[i]);+    }+    if (!missing.length) return cont();+    var split = splitCallback(cont, missing.length);+    for (var i = 0; i < missing.length; ++i)+      CodeMirror.requireMode(missing[i], split);+  }++  CodeMirror.requireMode = function(mode, cont) {+    if (typeof mode != "string") mode = mode.name;+    if (CodeMirror.modes.hasOwnProperty(mode)) return ensureDeps(mode, cont);+    if (loading.hasOwnProperty(mode)) return loading[mode].push(cont);++    var script = document.createElement("script");+    script.src = CodeMirror.modeURL.replace(/%N/g, mode);+    var others = document.getElementsByTagName("script")[0];+    others.parentNode.insertBefore(script, others);+    var list = loading[mode] = [cont];+    var count = 0, poll = setInterval(function() {+      if (++count > 100) return clearInterval(poll);+      if (CodeMirror.modes.hasOwnProperty(mode)) {+        clearInterval(poll);+        loading[mode] = null;+        ensureDeps(mode, function() {+          for (var i = 0; i < list.length; ++i) list[i]();+        });+      }+    }, 200);+  };++  CodeMirror.autoLoadMode = function(instance, mode) {+    if (!CodeMirror.modes.hasOwnProperty(mode))+      CodeMirror.requireMode(mode, function() {+        instance.setOption("mode", instance.getOption("mode"));+      });+  };+}());
+ static/codemirror/lib/util/match-highlighter.js view
@@ -0,0 +1,44 @@+// Define match-highlighter commands. Depends on searchcursor.js+// Use by attaching the following function call to the onCursorActivity event:+	//myCodeMirror.matchHighlight(minChars);+// And including a special span.CodeMirror-matchhighlight css class (also optionally a separate one for .CodeMirror-focused -- see demo matchhighlighter.html)++(function() {+  var DEFAULT_MIN_CHARS = 2;+  +  function MatchHighlightState() {+	this.marked = [];+  }+  function getMatchHighlightState(cm) {+	return cm._matchHighlightState || (cm._matchHighlightState = new MatchHighlightState());+  }+  +  function clearMarks(cm) {+	var state = getMatchHighlightState(cm);+	for (var i = 0; i < state.marked.length; ++i)+		state.marked[i].clear();+	state.marked = [];+  }+  +  function markDocument(cm, className, minChars) {+    clearMarks(cm);+	minChars = (typeof minChars !== 'undefined' ? minChars : DEFAULT_MIN_CHARS);+	if (cm.somethingSelected() && cm.getSelection().replace(/^\s+|\s+$/g, "").length >= minChars) {+		var state = getMatchHighlightState(cm);+		var query = cm.getSelection();+		cm.operation(function() {+			if (cm.lineCount() < 2000) { // This is too expensive on big documents.+			  for (var cursor = cm.getSearchCursor(query); cursor.findNext();) {+				//Only apply matchhighlight to the matches other than the one actually selected+				if (!(cursor.from().line === cm.getCursor(true).line && cursor.from().ch === cm.getCursor(true).ch))+					state.marked.push(cm.markText(cursor.from(), cursor.to(), className));+			  }+			}+		  });+	}+  }++  CodeMirror.defineExtension("matchHighlight", function(className, minChars) {+    markDocument(this, className, minChars);+  });+})();
+ static/codemirror/lib/util/multiplex.js view
@@ -0,0 +1,81 @@+CodeMirror.multiplexingMode = function(outer /*, others */) {+  // Others should be {open, close, mode [, delimStyle]} objects+  var others = Array.prototype.slice.call(arguments, 1);+  var n_others = others.length;++  function indexOf(string, pattern, from) {+    if (typeof pattern == "string") return string.indexOf(pattern, from);+    var m = pattern.exec(from ? string.slice(from) : string);+    return m ? m.index + from : -1;+  }++  return {+    startState: function() {+      return {+        outer: CodeMirror.startState(outer),+        innerActive: null,+        inner: null+      };+    },++    copyState: function(state) {+      return {+        outer: CodeMirror.copyState(outer, state.outer),+        innerActive: state.innerActive,+        inner: state.innerActive && CodeMirror.copyState(state.innerActive.mode, state.inner)+      };+    },++    token: function(stream, state) {+      if (!state.innerActive) {+        var cutOff = Infinity, oldContent = stream.string;+        for (var i = 0; i < n_others; ++i) {+          var other = others[i];+          var found = indexOf(oldContent, other.open, stream.pos);+          if (found == stream.pos) {+            stream.match(other.open);+            state.innerActive = other;+            state.inner = CodeMirror.startState(other.mode, outer.indent(state.outer, ""));+            return other.delimStyle;+          } else if (found != -1 && found < cutOff) {+            cutOff = found;+          }+        }+        if (cutOff != Infinity) stream.string = oldContent.slice(0, cutOff);+        var outerToken = outer.token(stream, state.outer);+        if (cutOff != Infinity) stream.string = oldContent;+        return outerToken;+      } else {+        var curInner = state.innerActive, oldContent = stream.string;+        var found = indexOf(oldContent, curInner.close, stream.pos);+        if (found == stream.pos) {+          stream.match(curInner.close);+          state.innerActive = state.inner = null;+          return curInner.delimStyle;+        }+        if (found > -1) stream.string = oldContent.slice(0, found);+        var innerToken = curInner.mode.token(stream, state.inner);+        if (found > -1) stream.string = oldContent;+        var cur = stream.current(), found = cur.indexOf(curInner.close);+        if (found > -1) stream.backUp(cur.length - found);+        return innerToken;+      }+    },+    +    indent: function(state, textAfter) {+      var mode = state.innerActive ? state.innerActive.mode : outer;+      if (!mode.indent) return CodeMirror.Pass;+      return mode.indent(state.innerActive ? state.inner : state.outer, textAfter);+    },++    compareStates: function(a, b) {+      if (a.innerActive != b.innerActive) return false;+      var mode = a.innerActive || outer;+      if (!mode.compareStates) return CodeMirror.Pass;+      return mode.compareStates(a.innerActive ? a.inner : a.outer,+                                b.innerActive ? b.inner : b.outer);+    },++    electricChars: outer.electricChars+  };+};
+ static/codemirror/lib/util/overlay.js view
@@ -0,0 +1,52 @@+// Utility function that allows modes to be combined. The mode given+// as the base argument takes care of most of the normal mode+// functionality, but a second (typically simple) mode is used, which+// can override the style of text. Both modes get to parse all of the+// text, but when both assign a non-null style to a piece of code, the+// overlay wins, unless the combine argument was true, in which case+// the styles are combined.++// overlayParser is the old, deprecated name+CodeMirror.overlayMode = CodeMirror.overlayParser = function(base, overlay, combine) {+  return {+    startState: function() {+      return {+        base: CodeMirror.startState(base),+        overlay: CodeMirror.startState(overlay),+        basePos: 0, baseCur: null,+        overlayPos: 0, overlayCur: null+      };+    },+    copyState: function(state) {+      return {+        base: CodeMirror.copyState(base, state.base),+        overlay: CodeMirror.copyState(overlay, state.overlay),+        basePos: state.basePos, baseCur: null,+        overlayPos: state.overlayPos, overlayCur: null+      };+    },++    token: function(stream, state) {+      if (stream.start == state.basePos) {+        state.baseCur = base.token(stream, state.base);+        state.basePos = stream.pos;+      }+      if (stream.start == state.overlayPos) {+        stream.pos = stream.start;+        state.overlayCur = overlay.token(stream, state.overlay);+        state.overlayPos = stream.pos;+      }+      stream.pos = Math.min(state.basePos, state.overlayPos);+      if (stream.eol()) state.basePos = state.overlayPos = 0;++      if (state.overlayCur == null) return state.baseCur;+      if (state.baseCur != null && combine) return state.baseCur + " " + state.overlayCur;+      else return state.overlayCur;+    },+    +    indent: base.indent && function(state, textAfter) {+      return base.indent(state.base, textAfter);+    },+    electricChars: base.electricChars+  };+};
+ static/codemirror/lib/util/pig-hint.js view
@@ -0,0 +1,123 @@+(function () {+  function forEach(arr, f) {+    for (var i = 0, e = arr.length; i < e; ++i) f(arr[i]);+  }+  +  function arrayContains(arr, item) {+    if (!Array.prototype.indexOf) {+      var i = arr.length;+      while (i--) {+        if (arr[i] === item) {+          return true;+        }+      }+      return false;+    }+    return arr.indexOf(item) != -1;+  }++  function scriptHint(editor, keywords, getToken) {+    // Find the token at the cursor+    var cur = editor.getCursor(), token = getToken(editor, cur), tprop = token;+    // If it's not a 'word-style' token, ignore the token.++    if (!/^[\w$_]*$/.test(token.string)) {+        token = tprop = {start: cur.ch, end: cur.ch, string: "", state: token.state,+                         className: token.string == ":" ? "pig-type" : null};+    }+      +    if (!context) var context = [];+    context.push(tprop);+    +    var completionList = getCompletions(token, context); +    completionList = completionList.sort();+    //prevent autocomplete for last word, instead show dropdown with one word+    if(completionList.length == 1) {+      completionList.push(" ");+    }++    return {list: completionList,+              from: {line: cur.line, ch: token.start},+              to: {line: cur.line, ch: token.end}};+  }+  +  CodeMirror.pigHint = function(editor) {+    return scriptHint(editor, pigKeywordsU, function (e, cur) {return e.getTokenAt(cur);});+  }+ + function toTitleCase(str) {+    return str.replace(/(?:^|\s)\w/g, function(match) {+        return match.toUpperCase();+    });+ }+  +  var pigKeywords = "VOID IMPORT RETURNS DEFINE LOAD FILTER FOREACH ORDER CUBE DISTINCT COGROUP "+  + "JOIN CROSS UNION SPLIT INTO IF OTHERWISE ALL AS BY USING INNER OUTER ONSCHEMA PARALLEL "+  + "PARTITION GROUP AND OR NOT GENERATE FLATTEN ASC DESC IS STREAM THROUGH STORE MAPREDUCE "+  + "SHIP CACHE INPUT OUTPUT STDERROR STDIN STDOUT LIMIT SAMPLE LEFT RIGHT FULL EQ GT LT GTE LTE " +  + "NEQ MATCHES TRUE FALSE";+  var pigKeywordsU = pigKeywords.split(" ");+  var pigKeywordsL = pigKeywords.toLowerCase().split(" ");+  +  var pigTypes = "BOOLEAN INT LONG FLOAT DOUBLE CHARARRAY BYTEARRAY BAG TUPLE MAP";+  var pigTypesU = pigTypes.split(" ");+  var pigTypesL = pigTypes.toLowerCase().split(" ");+  +  var pigBuiltins = "ABS ACOS ARITY ASIN ATAN AVG BAGSIZE BINSTORAGE BLOOM BUILDBLOOM CBRT CEIL " +  + "CONCAT COR COS COSH COUNT COUNT_STAR COV CONSTANTSIZE CUBEDIMENSIONS DIFF DISTINCT DOUBLEABS "+  + "DOUBLEAVG DOUBLEBASE DOUBLEMAX DOUBLEMIN DOUBLEROUND DOUBLESUM EXP FLOOR FLOATABS FLOATAVG "+  + "FLOATMAX FLOATMIN FLOATROUND FLOATSUM GENERICINVOKER INDEXOF INTABS INTAVG INTMAX INTMIN "+  + "INTSUM INVOKEFORDOUBLE INVOKEFORFLOAT INVOKEFORINT INVOKEFORLONG INVOKEFORSTRING INVOKER "+  + "ISEMPTY JSONLOADER JSONMETADATA JSONSTORAGE LAST_INDEX_OF LCFIRST LOG LOG10 LOWER LONGABS "+  + "LONGAVG LONGMAX LONGMIN LONGSUM MAX MIN MAPSIZE MONITOREDUDF NONDETERMINISTIC OUTPUTSCHEMA  "+  + "PIGSTORAGE PIGSTREAMING RANDOM REGEX_EXTRACT REGEX_EXTRACT_ALL REPLACE ROUND SIN SINH SIZE "+  + "SQRT STRSPLIT SUBSTRING SUM STRINGCONCAT STRINGMAX STRINGMIN STRINGSIZE TAN TANH TOBAG "+  + "TOKENIZE TOMAP TOP TOTUPLE TRIM TEXTLOADER TUPLESIZE UCFIRST UPPER UTF8STORAGECONVERTER";  +  var pigBuiltinsU = pigBuiltins.split(" ").join("() ").split(" ");  +  var pigBuiltinsL = pigBuiltins.toLowerCase().split(" ").join("() ").split(" ");   +  var pigBuiltinsC = ("BagSize BinStorage Bloom BuildBloom ConstantSize CubeDimensions DoubleAbs "+  + "DoubleAvg DoubleBase DoubleMax DoubleMin DoubleRound DoubleSum FloatAbs FloatAvg FloatMax "+  + "FloatMin FloatRound FloatSum GenericInvoker IntAbs IntAvg IntMax IntMin IntSum "+  + "InvokeForDouble InvokeForFloat InvokeForInt InvokeForLong InvokeForString Invoker "+  + "IsEmpty JsonLoader JsonMetadata JsonStorage LongAbs LongAvg LongMax LongMin LongSum MapSize "+  + "MonitoredUDF Nondeterministic OutputSchema PigStorage PigStreaming StringConcat StringMax "+  + "StringMin StringSize TextLoader TupleSize Utf8StorageConverter").split(" ").join("() ").split(" ");+                    +  function getCompletions(token, context) {+    var found = [], start = token.string;+    function maybeAdd(str) {+      if (str.indexOf(start) == 0 && !arrayContains(found, str)) found.push(str);+    }+    +    function gatherCompletions(obj) {+      if(obj == ":") {+        forEach(pigTypesL, maybeAdd);+      }+      else {+        forEach(pigBuiltinsU, maybeAdd);+        forEach(pigBuiltinsL, maybeAdd);+        forEach(pigBuiltinsC, maybeAdd);+        forEach(pigTypesU, maybeAdd);+        forEach(pigTypesL, maybeAdd);+        forEach(pigKeywordsU, maybeAdd);+        forEach(pigKeywordsL, maybeAdd);+      }+    }++    if (context) {+      // If this is a property, see if it belongs to some object we can+      // find in the current environment.+      var obj = context.pop(), base;++      if (obj.className == "pig-word") +          base = obj.string;+      else if(obj.className == "pig-type")+          base = ":" + obj.string;+        +      while (base != null && context.length)+        base = base[context.pop().string];+      if (base != null) gatherCompletions(base);+    }+    return found;+  }+})();
+ static/codemirror/lib/util/runmode.js view
@@ -0,0 +1,49 @@+CodeMirror.runMode = function(string, modespec, callback, options) {+  var mode = CodeMirror.getMode(CodeMirror.defaults, modespec);+  var isNode = callback.nodeType == 1;+  var tabSize = (options && options.tabSize) || CodeMirror.defaults.tabSize;+  if (isNode) {+    var node = callback, accum = [], col = 0;+    callback = function(text, style) {+      if (text == "\n") {+        accum.push("<br>");+        col = 0;+        return;+      }+      var escaped = "";+      // HTML-escape and replace tabs+      for (var pos = 0;;) {+        var idx = text.indexOf("\t", pos);+        if (idx == -1) {+          escaped += CodeMirror.htmlEscape(text.slice(pos));+          col += text.length - pos;+          break;+        } else {+          col += idx - pos;+          escaped += CodeMirror.htmlEscape(text.slice(pos, idx));+          var size = tabSize - col % tabSize;+          col += size;+          for (var i = 0; i < size; ++i) escaped += " ";+          pos = idx + 1;+        }+      }++      if (style) +        accum.push("<span class=\"cm-" + CodeMirror.htmlEscape(style) + "\">" + escaped + "</span>");+      else+        accum.push(escaped);+    }+  }+  var lines = CodeMirror.splitLines(string), state = CodeMirror.startState(mode);+  for (var i = 0, e = lines.length; i < e; ++i) {+    if (i) callback("\n");+    var stream = new CodeMirror.StringStream(lines[i]);+    while (!stream.eol()) {+      var style = mode.token(stream, state);+      callback(stream.current(), style, i, stream.start);+      stream.start = stream.pos;+    }+  }+  if (isNode)+    node.innerHTML = accum.join("");+};
+ static/codemirror/lib/util/search.js view
@@ -0,0 +1,118 @@+// Define search commands. Depends on dialog.js or another+// implementation of the openDialog method.++// Replace works a little oddly -- it will do the replace on the next+// Ctrl-G (or whatever is bound to findNext) press. You prevent a+// replace by making sure the match is no longer selected when hitting+// Ctrl-G.++(function() {+  function SearchState() {+    this.posFrom = this.posTo = this.query = null;+    this.marked = [];+  }+  function getSearchState(cm) {+    return cm._searchState || (cm._searchState = new SearchState());+  }+  function getSearchCursor(cm, query, pos) {+    // Heuristic: if the query string is all lowercase, do a case insensitive search.+    return cm.getSearchCursor(query, pos, typeof query == "string" && query == query.toLowerCase());+  }+  function dialog(cm, text, shortText, f) {+    if (cm.openDialog) cm.openDialog(text, f);+    else f(prompt(shortText, ""));+  }+  function confirmDialog(cm, text, shortText, fs) {+    if (cm.openConfirm) cm.openConfirm(text, fs);+    else if (confirm(shortText)) fs[0]();+  }+  function parseQuery(query) {+    var isRE = query.match(/^\/(.*)\/([a-z]*)$/);+    return isRE ? new RegExp(isRE[1], isRE[2].indexOf("i") == -1 ? "" : "i") : query;+  }+  var queryDialog =+    'Search: <input type="text" style="width: 10em"/> <span style="color: #888">(Use /re/ syntax for regexp search)</span>';+  function doSearch(cm, rev) {+    var state = getSearchState(cm);+    if (state.query) return findNext(cm, rev);+    dialog(cm, queryDialog, "Search for:", function(query) {+      cm.operation(function() {+        if (!query || state.query) return;+        state.query = parseQuery(query);+        if (cm.lineCount() < 2000) { // This is too expensive on big documents.+          for (var cursor = getSearchCursor(cm, query); cursor.findNext();)+            state.marked.push(cm.markText(cursor.from(), cursor.to(), "CodeMirror-searching"));+        }+        state.posFrom = state.posTo = cm.getCursor();+        findNext(cm, rev);+      });+    });+  }+  function findNext(cm, rev) {cm.operation(function() {+    var state = getSearchState(cm);+    var cursor = getSearchCursor(cm, state.query, rev ? state.posFrom : state.posTo);+    if (!cursor.find(rev)) {+      cursor = getSearchCursor(cm, state.query, rev ? {line: cm.lineCount() - 1} : {line: 0, ch: 0});+      if (!cursor.find(rev)) return;+    }+    cm.setSelection(cursor.from(), cursor.to());+    state.posFrom = cursor.from(); state.posTo = cursor.to();+  })}+  function clearSearch(cm) {cm.operation(function() {+    var state = getSearchState(cm);+    if (!state.query) return;+    state.query = null;+    for (var i = 0; i < state.marked.length; ++i) state.marked[i].clear();+    state.marked.length = 0;+  })}++  var replaceQueryDialog =+    'Replace: <input type="text" style="width: 10em"/> <span style="color: #888">(Use /re/ syntax for regexp search)</span>';+  var replacementQueryDialog = 'With: <input type="text" style="width: 10em"/>';+  var doReplaceConfirm = "Replace? <button>Yes</button> <button>No</button> <button>Stop</button>";+  function replace(cm, all) {+    dialog(cm, replaceQueryDialog, "Replace:", function(query) {+      if (!query) return;+      query = parseQuery(query);+      dialog(cm, replacementQueryDialog, "Replace with:", function(text) {+        if (all) {+          cm.compoundChange(function() { cm.operation(function() {+            for (var cursor = getSearchCursor(cm, query); cursor.findNext();) {+              if (typeof query != "string") {+                var match = cm.getRange(cursor.from(), cursor.to()).match(query);+                cursor.replace(text.replace(/\$(\d)/, function(w, i) {return match[i];}));+              } else cursor.replace(text);+            }+          })});+        } else {+          clearSearch(cm);+          var cursor = getSearchCursor(cm, query, cm.getCursor());+          function advance() {+            var start = cursor.from(), match;+            if (!(match = cursor.findNext())) {+              cursor = getSearchCursor(cm, query);+              if (!(match = cursor.findNext()) ||+                  (start && cursor.from().line == start.line && cursor.from().ch == start.ch)) return;+            }+            cm.setSelection(cursor.from(), cursor.to());+            confirmDialog(cm, doReplaceConfirm, "Replace?",+                          [function() {doReplace(match);}, advance]);+          }+          function doReplace(match) {+            cursor.replace(typeof query == "string" ? text :+                           text.replace(/\$(\d)/, function(w, i) {return match[i];}));+            advance();+          }+          advance();+        }+      });+    });+  }++  CodeMirror.commands.find = function(cm) {clearSearch(cm); doSearch(cm);};+  CodeMirror.commands.findNext = doSearch;+  CodeMirror.commands.findPrev = function(cm) {doSearch(cm, true);};+  CodeMirror.commands.clearSearch = clearSearch;+  CodeMirror.commands.replace = replace;+  CodeMirror.commands.replaceAll = function(cm) {replace(cm, true);};+})();
+ static/codemirror/lib/util/searchcursor.js view
@@ -0,0 +1,117 @@+(function(){+  function SearchCursor(cm, query, pos, caseFold) {+    this.atOccurrence = false; this.cm = cm;+    if (caseFold == null && typeof query == "string") caseFold = false;++    pos = pos ? cm.clipPos(pos) : {line: 0, ch: 0};+    this.pos = {from: pos, to: pos};++    // The matches method is filled in based on the type of query.+    // It takes a position and a direction, and returns an object+    // describing the next occurrence of the query, or null if no+    // more matches were found.+    if (typeof query != "string") // Regexp match+      this.matches = function(reverse, pos) {+        if (reverse) {+          var line = cm.getLine(pos.line).slice(0, pos.ch), match = line.match(query), start = 0;+          while (match) {+            var ind = line.indexOf(match[0]);+            start += ind;+            line = line.slice(ind + 1);+            var newmatch = line.match(query);+            if (newmatch) match = newmatch;+            else break;+            start++;+          }+        }+        else {+          var line = cm.getLine(pos.line).slice(pos.ch), match = line.match(query),+          start = match && pos.ch + line.indexOf(match[0]);+        }+        if (match)+          return {from: {line: pos.line, ch: start},+                  to: {line: pos.line, ch: start + match[0].length},+                  match: match};+      };+    else { // String query+      if (caseFold) query = query.toLowerCase();+      var fold = caseFold ? function(str){return str.toLowerCase();} : function(str){return str;};+      var target = query.split("\n");+      // Different methods for single-line and multi-line queries+      if (target.length == 1)+        this.matches = function(reverse, pos) {+          var line = fold(cm.getLine(pos.line)), len = query.length, match;+          if (reverse ? (pos.ch >= len && (match = line.lastIndexOf(query, pos.ch - len)) != -1)+              : (match = line.indexOf(query, pos.ch)) != -1)+            return {from: {line: pos.line, ch: match},+                    to: {line: pos.line, ch: match + len}};+        };+      else+        this.matches = function(reverse, pos) {+          var ln = pos.line, idx = (reverse ? target.length - 1 : 0), match = target[idx], line = fold(cm.getLine(ln));+          var offsetA = (reverse ? line.indexOf(match) + match.length : line.lastIndexOf(match));+          if (reverse ? offsetA >= pos.ch || offsetA != match.length+              : offsetA <= pos.ch || offsetA != line.length - match.length)+            return;+          for (;;) {+            if (reverse ? !ln : ln == cm.lineCount() - 1) return;+            line = fold(cm.getLine(ln += reverse ? -1 : 1));+            match = target[reverse ? --idx : ++idx];+            if (idx > 0 && idx < target.length - 1) {+              if (line != match) return;+              else continue;+            }+            var offsetB = (reverse ? line.lastIndexOf(match) : line.indexOf(match) + match.length);+            if (reverse ? offsetB != line.length - match.length : offsetB != match.length)+              return;+            var start = {line: pos.line, ch: offsetA}, end = {line: ln, ch: offsetB};+            return {from: reverse ? end : start, to: reverse ? start : end};+          }+        };+    }+  }++  SearchCursor.prototype = {+    findNext: function() {return this.find(false);},+    findPrevious: function() {return this.find(true);},++    find: function(reverse) {+      var self = this, pos = this.cm.clipPos(reverse ? this.pos.from : this.pos.to);+      function savePosAndFail(line) {+        var pos = {line: line, ch: 0};+        self.pos = {from: pos, to: pos};+        self.atOccurrence = false;+        return false;+      }++      for (;;) {+        if (this.pos = this.matches(reverse, pos)) {+          this.atOccurrence = true;+          return this.pos.match || true;+        }+        if (reverse) {+          if (!pos.line) return savePosAndFail(0);+          pos = {line: pos.line-1, ch: this.cm.getLine(pos.line-1).length};+        }+        else {+          var maxLine = this.cm.lineCount();+          if (pos.line == maxLine - 1) return savePosAndFail(maxLine);+          pos = {line: pos.line+1, ch: 0};+        }+      }+    },++    from: function() {if (this.atOccurrence) return this.pos.from;},+    to: function() {if (this.atOccurrence) return this.pos.to;},++    replace: function(newText) {+      var self = this;+      if (this.atOccurrence)+        self.pos.to = this.cm.replaceRange(newText, self.pos.from, self.pos.to);+    }+  };++  CodeMirror.defineExtension("getSearchCursor", function(query, pos, caseFold) {+    return new SearchCursor(this, query, pos, caseFold);+  });+})();
+ static/codemirror/lib/util/simple-hint.css view
@@ -0,0 +1,16 @@+.CodeMirror-completions {+  position: absolute;+  z-index: 10;+  overflow: hidden;+  -webkit-box-shadow: 2px 3px 5px rgba(0,0,0,.2);+  -moz-box-shadow: 2px 3px 5px rgba(0,0,0,.2);+  box-shadow: 2px 3px 5px rgba(0,0,0,.2);+}+.CodeMirror-completions select {+  background: #fafafa;+  outline: none;+  border: none;+  padding: 0;+  margin: 0;+  font-family: monospace;+}
+ static/codemirror/lib/util/simple-hint.js view
@@ -0,0 +1,76 @@+(function() {+  CodeMirror.simpleHint = function(editor, getHints) {+    // We want a single cursor position.+    if (editor.somethingSelected()) return;+    //don't show completion if the token is empty+    var tempToken = editor.getTokenAt(editor.getCursor());+    if(!(/[\S]/gi.test(tempToken.string))) return;++    var result = getHints(editor);+    if (!result || !result.list.length) return;+    var completions = result.list;+    function insert(str) {+      editor.replaceRange(str, result.from, result.to);+    }+    // When there is only one completion, use it directly.+    if (completions.length == 1) {insert(completions[0]); return true;}++    // Build the select widget+    var complete = document.createElement("div");+    complete.className = "CodeMirror-completions";+    var sel = complete.appendChild(document.createElement("select"));+    // Opera doesn't move the selection when pressing up/down in a+    // multi-select, but it does properly support the size property on+    // single-selects, so no multi-select is necessary.+    if (!window.opera) sel.multiple = true;+    for (var i = 0; i < completions.length; ++i) {+      var opt = sel.appendChild(document.createElement("option"));+      opt.appendChild(document.createTextNode(completions[i]));+    }+    sel.firstChild.selected = true;+    sel.size = Math.min(10, completions.length);+    var pos = editor.cursorCoords();+    complete.style.left = pos.x + "px";+    complete.style.top = pos.yBot + "px";+    document.body.appendChild(complete);+    // If we're at the edge of the screen, then we want the menu to appear on the left of the cursor.+    var winW = window.innerWidth || Math.max(document.body.offsetWidth, document.documentElement.offsetWidth);+    if(winW - pos.x < sel.clientWidth)+      complete.style.left = (pos.x - sel.clientWidth) + "px";+    // Hack to hide the scrollbar.+    if (completions.length <= 10)+      complete.style.width = (sel.clientWidth - 1) + "px";++    var done = false;+    function close() {+      if (done) return;+      done = true;+      complete.parentNode.removeChild(complete);+    }+    function pick() {+      insert(completions[sel.selectedIndex]);+      close();+      setTimeout(function(){editor.focus();}, 50);+    }+    CodeMirror.connect(sel, "blur", close);+    CodeMirror.connect(sel, "keydown", function(event) {+      var code = event.keyCode;+      // Enter+      if (code == 13) {CodeMirror.e_stop(event); pick();}+      // Escape+      else if (code == 27) {CodeMirror.e_stop(event); close(); editor.focus();}+      else if (code != 38 && code != 40) {+        close(); editor.focus();+        // Pass the event to the CodeMirror instance so that it can handle things like backspace properly.+        editor.triggerOnKeyDown(event);+        setTimeout(function(){CodeMirror.simpleHint(editor, getHints);}, 50);+      }+    });+    CodeMirror.connect(sel, "dblclick", pick);++    sel.focus();+    // Opera sometimes ignores focusing a freshly created node+    if (window.opera) setTimeout(function(){if (!done) sel.focus();}, 100);+    return true;+  };+})();
+ static/codemirror/lib/util/xml-hint.js view
@@ -0,0 +1,137 @@++(function() {++    CodeMirror.xmlHints = [];++    CodeMirror.xmlHint = function(cm, simbol) {++        if(simbol.length > 0) {+            var cursor = cm.getCursor();+            cm.replaceSelection(simbol);+            cursor = {line: cursor.line, ch: cursor.ch + 1};+            cm.setCursor(cursor);+        }++        // dirty hack for simple-hint to receive getHint event on space+        var getTokenAt = editor.getTokenAt;++        editor.getTokenAt = function() { return 'disabled'; }+        CodeMirror.simpleHint(cm, getHint);++        editor.getTokenAt = getTokenAt;+    };++    var getHint = function(cm) {++        var cursor = cm.getCursor();++        if (cursor.ch > 0) {++            var text = cm.getRange({line: 0, ch: 0}, cursor);+            var typed = '';+            var simbol = '';+            for(var i = text.length - 1; i >= 0; i--) {+                if(text[i] == ' ' || text[i] == '<') {+                    simbol = text[i];+                    break;+                }+                else {+                    typed = text[i] + typed;+                }+            }++            text = text.substr(0, text.length - typed.length);++            var path = getActiveElement(cm, text) + simbol;+            var hints = CodeMirror.xmlHints[path];++            if(typeof hints === 'undefined')+                hints = [''];+            else {+                hints = hints.slice(0);+                for (var i = hints.length - 1; i >= 0; i--) {+                    if(hints[i].indexOf(typed) != 0)+                        hints.splice(i, 1);+                }+            }++            return {+                list: hints,+                from: { line: cursor.line, ch: cursor.ch - typed.length },+                to: cursor,+            };+        };+    }++    var getActiveElement = function(codeMirror, text) {++        var element = '';++        if(text.length >= 0) {++            var regex = new RegExp('<([^!?][^\\s/>]*).*?>', 'g');++            var matches = [];+            var match;+            while ((match = regex.exec(text)) != null) {+                matches.push({+                    tag: match[1],+                    selfclose: (match[0].substr(-1) === '/>')+                });+            }++            for (var i = matches.length - 1, skip = 0; i >= 0; i--) {++                var item = matches[i];++                if (item.tag[0] == '/')+                {+                    skip++;+                }+                else if (item.selfclose == false)+                {+                    if (skip > 0)+                    {+                        skip--;+                    }+                    else+                    {+                        element = '<' + item.tag + '>' + element;+                    }+                }+            }++            element += getOpenTag(text);+        }++        return element;+    };++    var getOpenTag = function(text) {++        var open = text.lastIndexOf('<');+        var close = text.lastIndexOf('>');++        if (close < open)+        {+            text = text.substr(open);++            if(text != '<') {++                var space = text.indexOf(' ');+                if(space < 0)+                    space = text.indexOf('\t');+                if(space < 0)+                    space = text.indexOf('\n');++                if (space < 0)+                    space = text.length;++                return text.substr(0, space);+            }+        }++        return '';+    };++})();
+ static/codemirror/mode/haskell/haskell.js view
@@ -0,0 +1,242 @@+CodeMirror.defineMode("haskell", function(cmCfg, modeCfg) {++  function switchState(source, setState, f) {+    setState(f);+    return f(source, setState);+  }+  +  // These should all be Unicode extended, as per the Haskell 2010 report+  var smallRE = /[a-z_]/;+  var largeRE = /[A-Z]/;+  var digitRE = /[0-9]/;+  var hexitRE = /[0-9A-Fa-f]/;+  var octitRE = /[0-7]/;+  var idRE = /[a-z_A-Z0-9']/;+  var symbolRE = /[-!#$%&*+.\/<=>?@\\^|~:]/;+  var specialRE = /[(),;[\]`{}]/;+  var whiteCharRE = /[ \t\v\f]/; // newlines are handled in tokenizer+    +  function normal(source, setState) {+    if (source.eatWhile(whiteCharRE)) {+      return null;+    }+      +    var ch = source.next();+    if (specialRE.test(ch)) {+      if (ch == '{' && source.eat('-')) {+        var t = "comment";+        if (source.eat('#')) {+          t = "meta";+        }+        return switchState(source, setState, ncomment(t, 1));+      }+      return null;+    }+    +    if (ch == '\'') {+      if (source.eat('\\')) {+        source.next();  // should handle other escapes here+      }+      else {+        source.next();+      }+      if (source.eat('\'')) {+        return "string";+      }+      return "error";+    }+    +    if (ch == '"') {+      return switchState(source, setState, stringLiteral);+    }+      +    if (largeRE.test(ch)) {+      source.eatWhile(idRE);+      if (source.eat('.')) {+        return "qualifier";+      }+      return "variable-2";+    }+      +    if (smallRE.test(ch)) {+      source.eatWhile(idRE);+      return "variable";+    }+      +    if (digitRE.test(ch)) {+      if (ch == '0') {+        if (source.eat(/[xX]/)) {+          source.eatWhile(hexitRE); // should require at least 1+          return "integer";+        }+        if (source.eat(/[oO]/)) {+          source.eatWhile(octitRE); // should require at least 1+          return "number";+        }+      }+      source.eatWhile(digitRE);+      var t = "number";+      if (source.eat('.')) {+        t = "number";+        source.eatWhile(digitRE); // should require at least 1+      }+      if (source.eat(/[eE]/)) {+        t = "number";+        source.eat(/[-+]/);+        source.eatWhile(digitRE); // should require at least 1+      }+      return t;+    }+      +    if (symbolRE.test(ch)) {+      if (ch == '-' && source.eat(/-/)) {+        source.eatWhile(/-/);+        if (!source.eat(symbolRE)) {+          source.skipToEnd();+          return "comment";+        }+      }+      var t = "variable";+      if (ch == ':') {+        t = "variable-2";+      }+      source.eatWhile(symbolRE);+      return t;    +    }+      +    return "error";+  }+    +  function ncomment(type, nest) {+    if (nest == 0) {+      return normal;+    }+    return function(source, setState) {+      var currNest = nest;+      while (!source.eol()) {+        var ch = source.next();+        if (ch == '{' && source.eat('-')) {+          ++currNest;+        }+        else if (ch == '-' && source.eat('}')) {+          --currNest;+          if (currNest == 0) {+            setState(normal);+            return type;+          }+        }+      }+      setState(ncomment(type, currNest));+      return type;+    }+  }+    +  function stringLiteral(source, setState) {+    while (!source.eol()) {+      var ch = source.next();+      if (ch == '"') {+        setState(normal);+        return "string";+      }+      if (ch == '\\') {+        if (source.eol() || source.eat(whiteCharRE)) {+          setState(stringGap);+          return "string";+        }+        if (source.eat('&')) {+        }+        else {+          source.next(); // should handle other escapes here+        }+      }+    }+    setState(normal);+    return "error";+  }+  +  function stringGap(source, setState) {+    if (source.eat('\\')) {+      return switchState(source, setState, stringLiteral);+    }+    source.next();+    setState(normal);+    return "error";+  }+  +  +  var wellKnownWords = (function() {+    var wkw = {};+    function setType(t) {+      return function () {+        for (var i = 0; i < arguments.length; i++)+          wkw[arguments[i]] = t;+      }+    }+    +    setType("keyword")(+      "case", "class", "data", "default", "deriving", "do", "else", "foreign",+      "if", "import", "in", "infix", "infixl", "infixr", "instance", "let",+      "module", "newtype", "of", "then", "type", "where", "_");+      +    setType("keyword")(+      "\.\.", ":", "::", "=", "\\", "\"", "<-", "->", "@", "~", "=>");+      +    setType("builtin")(+      "!!", "$!", "$", "&&", "+", "++", "-", ".", "/", "/=", "<", "<=", "=<<",+      "==", ">", ">=", ">>", ">>=", "^", "^^", "||", "*", "**");+      +    setType("builtin")(+      "Bool", "Bounded", "Char", "Double", "EQ", "Either", "Enum", "Eq",+      "False", "FilePath", "Float", "Floating", "Fractional", "Functor", "GT",+      "IO", "IOError", "Int", "Integer", "Integral", "Just", "LT", "Left",+      "Maybe", "Monad", "Nothing", "Num", "Ord", "Ordering", "Rational", "Read",+      "ReadS", "Real", "RealFloat", "RealFrac", "Right", "Show", "ShowS",+      "String", "True");+      +    setType("builtin")(+      "abs", "acos", "acosh", "all", "and", "any", "appendFile", "asTypeOf",+      "asin", "asinh", "atan", "atan2", "atanh", "break", "catch", "ceiling",+      "compare", "concat", "concatMap", "const", "cos", "cosh", "curry",+      "cycle", "decodeFloat", "div", "divMod", "drop", "dropWhile", "either",+      "elem", "encodeFloat", "enumFrom", "enumFromThen", "enumFromThenTo",+      "enumFromTo", "error", "even", "exp", "exponent", "fail", "filter",+      "flip", "floatDigits", "floatRadix", "floatRange", "floor", "fmap",+      "foldl", "foldl1", "foldr", "foldr1", "fromEnum", "fromInteger",+      "fromIntegral", "fromRational", "fst", "gcd", "getChar", "getContents",+      "getLine", "head", "id", "init", "interact", "ioError", "isDenormalized",+      "isIEEE", "isInfinite", "isNaN", "isNegativeZero", "iterate", "last",+      "lcm", "length", "lex", "lines", "log", "logBase", "lookup", "map",+      "mapM", "mapM_", "max", "maxBound", "maximum", "maybe", "min", "minBound",+      "minimum", "mod", "negate", "not", "notElem", "null", "odd", "or",+      "otherwise", "pi", "pred", "print", "product", "properFraction",+      "putChar", "putStr", "putStrLn", "quot", "quotRem", "read", "readFile",+      "readIO", "readList", "readLn", "readParen", "reads", "readsPrec",+      "realToFrac", "recip", "rem", "repeat", "replicate", "return", "reverse",+      "round", "scaleFloat", "scanl", "scanl1", "scanr", "scanr1", "seq",+      "sequence", "sequence_", "show", "showChar", "showList", "showParen",+      "showString", "shows", "showsPrec", "significand", "signum", "sin",+      "sinh", "snd", "span", "splitAt", "sqrt", "subtract", "succ", "sum",+      "tail", "take", "takeWhile", "tan", "tanh", "toEnum", "toInteger",+      "toRational", "truncate", "uncurry", "undefined", "unlines", "until",+      "unwords", "unzip", "unzip3", "userError", "words", "writeFile", "zip",+      "zip3", "zipWith", "zipWith3");+      +    return wkw;+  })();+    +  +  +  return {+    startState: function ()  { return { f: normal }; },+    copyState:  function (s) { return { f: s.f }; },+    +    token: function(stream, state) {+      var t = state.f(stream, function(s) { state.f = s; });+      var w = stream.current();+      return (w in wellKnownWords) ? wellKnownWords[w] : t;+    }+  };++});++CodeMirror.defineMIME("text/x-haskell", "haskell");
+ static/codemirror/mode/haskell/index.html view
@@ -0,0 +1,60 @@+<!doctype html>+<html>+  <head>+    <title>CodeMirror: Haskell mode</title>+    <link rel="stylesheet" href="../../lib/codemirror.css">+    <script src="../../lib/codemirror.js"></script>+    <script src="haskell.js"></script>+    <link rel="stylesheet" href="../../theme/elegant.css">+    <style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>+    <link rel="stylesheet" href="../../doc/docs.css">+  </head>+  <body>+    <h1>CodeMirror: Haskell mode</h1>++<form><textarea id="code" name="code">+module UniquePerms (+    uniquePerms+    )+where++-- | Find all unique permutations of a list where there might be duplicates.+uniquePerms :: (Eq a) => [a] -> [[a]]+uniquePerms = permBag . makeBag++-- | An unordered collection where duplicate values are allowed,+-- but represented with a single value and a count.+type Bag a = [(a, Int)]++makeBag :: (Eq a) => [a] -> Bag a+makeBag [] = []+makeBag (a:as) = mix a $ makeBag as+  where+    mix a []                        = [(a,1)]+    mix a (bn@(b,n):bs) | a == b    = (b,n+1):bs+                        | otherwise = bn : mix a bs++permBag :: Bag a -> [[a]]+permBag [] = [[]]+permBag bs = concatMap (\(f,cs) -> map (f:) $ permBag cs) . oneOfEach $ bs+  where+    oneOfEach [] = []+    oneOfEach (an@(a,n):bs) =+        let bs' = if n == 1 then bs else (a,n-1):bs+        in (a,bs') : mapSnd (an:) (oneOfEach bs)+    +    apSnd f (a,b) = (a, f b)+    mapSnd = map . apSnd+</textarea></form>++    <script>+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {+        lineNumbers: true,+        matchBrackets: true,+        theme: "elegant"+      });+    </script>++    <p><strong>MIME types defined:</strong> <code>text/x-haskell</code>.</p>+  </body>+</html>
+ static/codemirror/package.json view
@@ -0,0 +1,29 @@+{+    "name": "CodeMirror",+    "version":"2.32.0",+    "main": "codemirror.js",+    "description": "In-browser code editing made bearable",+    "licenses": [+        {+            "type": "MIT",+            "url": "http://codemirror.net/LICENSE"+        }+    ],+    "directories": {+        "lib": "./lib"+    },+    "bugs": "http://github.com/marijnh/CodeMirror2/issues",+    "keywords": ["JavaScript", "CodeMirror", "Editor"],+    "homepage": "http://codemirror.net",+    "maintainers":[ {+        "name": "Marijn Haverbeke",+        "email": "marijnh@gmail.com",+        "web": "http://codemirror.net"+    }],+    "repositories": [+        {+            "type": "git",+            "url": "https://github.com/marijnh/CodeMirror2.git"+        }+    ]+}
+ static/codemirror/test/driver.js view
@@ -0,0 +1,42 @@+var tests = [], runOnly = null;++function Failure(why) {this.message = why;}++function test(name, run) {tests.push({name: name, func: run}); return name;}+function testCM(name, run, opts) {+  return test(name, function() {+    var place = document.getElementById("testground"), cm = CodeMirror(place, opts);+    try {run(cm);}+    finally {place.removeChild(cm.getWrapperElement());}+  });+}++function runTests(callback) {+  function step(i) {+    if (i == tests.length) return callback("done");+    var test = tests[i];+    if (runOnly != null && runOnly != test.name) return step(i + 1);+    try {test.func(); callback("ok", test.name);}+    catch(e) {+      if (e instanceof Failure)+        callback("fail", test.name, e.message);+      else+        callback("error", test.name, e.toString());+    }+    setTimeout(function(){step(i + 1);}, 20);+  }+  step(0);+}++function eq(a, b, msg) {+  if (a != b) throw new Failure(a + " != " + b + (msg ? " (" + msg + ")" : ""));+}+function eqPos(a, b, msg) {+  if (a == b) return;+  if (a == null || b == null) throw new Failure("comparing point to null");+  eq(a.line, b.line, msg);+  eq(a.ch, b.ch, msg);+}+function is(a, msg) {+  if (!a) throw new Failure("assertion failed" + (msg ? " (" + msg + ")" : ""));+}
+ static/codemirror/test/index.html view
@@ -0,0 +1,55 @@+<!doctype html>+<html>+  <head>+    <title>CodeMirror: Test Suite</title>+    <link rel="stylesheet" href="../lib/codemirror.css">+    <script src="../lib/codemirror.js"></script>+    <script src="../mode/javascript/javascript.js"></script>++    <style type="text/css">+      .ok {color: #090;}+      .fail {color: #e00;}+      .error {color: #c90;}+    </style>+  </head>+  <body>+    <h1>CodeMirror: Test Suite</h1>++    <p>A limited set of programmatic sanity tests for CodeMirror.</p>++    <div style="border: 1px solid black; padding: 1px; max-width: 700px;">+      <div style="background: #45d; white-space: pre; width: 0px; font-weight: bold; color: white; padding: 3px;" id=progress></div>+    </div>+    <pre style="padding-left: 5px" id=output></pre>++    <div style="visibility: hidden" id=testground>+      <form><textarea id="code" name="code"></textarea><input type=submit value=ok name=submit></form>+    </div>++    <script src="driver.js"></script>+    <script src="test.js"></script>+    <script>+      window.onload = function() {+        runTests(displayTest);+      };++      var output = document.getElementById("output"), progress = document.getElementById("progress");+      var count = 0, failed = 0, bad = "";+      function displayTest(type, name, msg) {+        if (type != "done") ++count;+        progress.style.width = (count * (progress.parentNode.clientWidth - 8) / tests.length) + "px";+        progress.innerHTML = "Ran " + count + (count < tests.length ? " of " + tests.length : "") + " tests";+        if (type == "ok") {+          output.innerHTML = bad + "<span class=ok>Test '" + CodeMirror.htmlEscape(name) + "' succeeded</span>";+        } else if (type == "error" || type == "fail") {+          ++failed;+          bad += CodeMirror.htmlEscape(name) + ": <span class=" + type + ">" + CodeMirror.htmlEscape(msg) + "</span>\n";+          output.innerHTML = bad;+        } else if (type == "done") {+          output.innerHTML = bad + (failed ? "<span class=fail>" + failed + " failure" + (failed > 1 ? "s" : "") + "</span>"+                                           : "<span class=ok>All passed</span>");+        }+      }+    </script>+  </body>+</html>
+ static/codemirror/test/mode_test.css view
@@ -0,0 +1,22 @@+.mt-output .mt-token {+  border: 1px solid #ddd;+  white-space: pre;+  font-family: "Consolas", monospace;+  text-align: center;+}++.mt-output .mt-style {+  font-size: x-small;+}++.mt-test {+  border-left: 10px solid #fff;+}++.mt-pass {+  border-left: 10px solid #cfc;+}++.mt-fail {+  border-left: 10px solid #fcc;+}
+ static/codemirror/test/mode_test.js view
@@ -0,0 +1,164 @@+/**+ * Helper to test CodeMirror highlighting modes. It pretty prints output of the+ * highlighter and can check against expected styles.+ *+ * See test.html in the stex mode for examples.+ */+ModeTest = {};++ModeTest.modeOptions = {};+ModeTest.modeName = CodeMirror.defaults.mode;++/* keep track of results for printSummary */+ModeTest.tests = 0;+ModeTest.passes = 0;++/**+ * Run a test; prettyprints the results using document.write().+ *+ * @param string to highlight+ *+ * @param style[i] expected style of the i'th token in string+ *+ * @param token[i] expected value for the i'th token in string+ */+ModeTest.test = function() {+  ModeTest.tests += 1;++  var mode = CodeMirror.getMode(ModeTest.modeOptions, ModeTest.modeName);++  if (arguments.length < 1) {+    throw "must have text for test";+  }+  if (arguments.length % 2 != 1) {+    throw "must have text for test plus expected (style, token) pairs";+  }++  var text = arguments[0];+  var expectedOutput = [];+  for (var i = 1; i < arguments.length; i += 2) {+    expectedOutput.push([arguments[i],arguments[i + 1]]);+  }++  var observedOutput = ModeTest.highlight(text, mode)++  var pass, passStyle = "";+  if (expectedOutput.length > 0) {+    pass = ModeTest.highlightOutputsEqual(expectedOutput, observedOutput);+    passStyle = pass ? 'mt-pass' : 'mt-fail';+    ModeTest.passes += pass ? 1 : 0;+  }++  var s = '';+  s += '<div class="mt-test ' + passStyle + '">';+  s +=   '<pre>' + ModeTest.htmlEscape(text) + '</pre>';+  s +=   '<div class="cm-s-default">';+  if (pass || expectedOutput.length == 0) {+    s +=   ModeTest.prettyPrintOutputTable(observedOutput);+  } else {+    s += 'expected:';+    s +=   ModeTest.prettyPrintOutputTable(expectedOutput);+    s += 'observed:';+    s +=   ModeTest.prettyPrintOutputTable(observedOutput);+  }+  s +=   '</div>';+  s += '</div>';+  document.write(s);+}++/**+ * Emulation of CodeMirror's internal highlight routine for testing. Multi-line+ * input is supported.+ *+ * @param string to highlight+ *+ * @param mode the mode that will do the actual highlighting+ *+ * @return array of [style, token] pairs+ */+ModeTest.highlight = function(string, mode) {+  var state = mode.startState()++  var lines = string.replace(/\r\n/g,'\n').split('\n');+  var output = [];+  for (var i = 0; i < lines.length; ++i) {+    var line = lines[i];+    var stream = new CodeMirror.StringStream(line);+    if (line == "" && mode.blankLine) mode.blankLine(state);+    while (!stream.eol()) {+      var style = mode.token(stream, state);+      var substr = line.slice(stream.start, stream.pos);+      output.push([style, substr]);+      stream.start = stream.pos;+    }+  }++  return output;+}++/**+ * Compare two arrays of output from ModeTest.highlight.+ *+ * @param o1 array of [style, token] pairs+ *+ * @param o2 array of [style, token] pairs+ *+ * @return boolean; true iff outputs equal+ */+ModeTest.highlightOutputsEqual = function(o1, o2) {+  var eq = (o1.length == o2.length);+  if (eq) {+    for (var j in o1) {+      eq = eq &&+        o1[j].length == 2 && o1[j][0] == o2[j][0] && o1[j][1] == o2[j][1];+    }+  }+  return eq;+}++/**+ * Print tokens and corresponding styles in a table. Spaces in the token are+ * replaced with 'interpunct' dots (&middot;).+ *+ * @param output array of [style, token] pairs+ *+ * @return html string+ */+ModeTest.prettyPrintOutputTable = function(output) {+  var s = '<table class="mt-output">';+  s += '<tr>';+  for (var i = 0; i < output.length; ++i) {+    var token = output[i];+    s +=+      '<td class="mt-token">' ++        '<span class="cm-' + token[0] + '">' ++          ModeTest.htmlEscape(token[1]).replace(/ /g,'&middot;') ++        '</span>' ++      '</td>';+  }+  s += '</tr><tr>';+  for (var i = 0; i < output.length; ++i) {+    var token = output[i];+    s +=+      '<td class="mt-style"><span>' + token[0] + '</span></td>';+  }+  s += '</table>';+  return s;+}++/**+ * Print how many tests have run so far and how many of those passed.+ */+ModeTest.printSummary = function() {+  document.write(ModeTest.passes + ' passes for ' + ModeTest.tests + ' tests');+}++/**+ * Basic HTML escaping.+ */+ModeTest.htmlEscape = function(str) {+  str = str.toString();+  return str.replace(/[<&]/g,+      function(str) {return str == "&" ? "&amp;" : "&lt;";});+}+
+ static/codemirror/test/test.js view
@@ -0,0 +1,467 @@+function forEach(arr, f) {+  for (var i = 0, e = arr.length; i < e; ++i) f(arr[i]);+}++function addDoc(cm, width, height) {+  var content = [], line = "";+  for (var i = 0; i < width; ++i) line += "x";+  for (var i = 0; i < height; ++i) content.push(line);+  cm.setValue(content.join("\n"));+}++function byClassName(elt, cls) {+  if (elt.getElementsByClassName) return elt.getElementsByClassName(cls);+  var found = [], re = new RegExp("\\b" + cls + "\\b");+  function search(elt) {+    if (elt.nodeType == 3) return;+    if (re.test(elt.className)) found.push(elt);+    for (var i = 0, e = elt.childNodes.length; i < e; ++i)+      search(elt.childNodes[i]);+  }+  search(elt);+  return found;+}++test("fromTextArea", function() {+  var te = document.getElementById("code");+  te.value = "CONTENT";+  var cm = CodeMirror.fromTextArea(te);+  is(!te.offsetHeight);+  eq(cm.getValue(), "CONTENT");+  cm.setValue("foo\nbar");+  eq(cm.getValue(), "foo\nbar");+  cm.save();+  is(/^foo\r?\nbar$/.test(te.value));+  cm.setValue("xxx");+  cm.toTextArea();+  is(te.offsetHeight);+  eq(te.value, "xxx");+});++testCM("getRange", function(cm) {+  eq(cm.getLine(0), "1234");+  eq(cm.getLine(1), "5678");+  eq(cm.getLine(2), null);+  eq(cm.getLine(-1), null);+  eq(cm.getRange({line: 0, ch: 0}, {line: 0, ch: 3}), "123");+  eq(cm.getRange({line: 0, ch: -1}, {line: 0, ch: 200}), "1234");+  eq(cm.getRange({line: 0, ch: 2}, {line: 1, ch: 2}), "34\n56");+  eq(cm.getRange({line: 1, ch: 2}, {line: 100, ch: 0}), "78");+}, {value: "1234\n5678"});++testCM("replaceRange", function(cm) {+  eq(cm.getValue(), "");+  cm.replaceRange("foo\n", {line: 0, ch: 0});+  eq(cm.getValue(), "foo\n");+  cm.replaceRange("a\nb", {line: 0, ch: 1});+  eq(cm.getValue(), "fa\nboo\n");+  eq(cm.lineCount(), 3);+  cm.replaceRange("xyzzy", {line: 0, ch: 0}, {line: 1, ch: 1});+  eq(cm.getValue(), "xyzzyoo\n");+  cm.replaceRange("abc", {line: 0, ch: 0}, {line: 10, ch: 0});+  eq(cm.getValue(), "abc");+  eq(cm.lineCount(), 1);+});++testCM("selection", function(cm) {+  cm.setSelection({line: 0, ch: 4}, {line: 2, ch: 2});+  is(cm.somethingSelected());+  eq(cm.getSelection(), "11\n222222\n33");+  eqPos(cm.getCursor(false), {line: 2, ch: 2});+  eqPos(cm.getCursor(true), {line: 0, ch: 4});+  cm.setSelection({line: 1, ch: 0});+  is(!cm.somethingSelected());+  eq(cm.getSelection(), "");+  eqPos(cm.getCursor(true), {line: 1, ch: 0});+  cm.replaceSelection("abc");+  eq(cm.getSelection(), "abc");+  eq(cm.getValue(), "111111\nabc222222\n333333");+  cm.replaceSelection("def", "end");+  eq(cm.getSelection(), "");+  eqPos(cm.getCursor(true), {line: 1, ch: 3});+  cm.setCursor({line: 2, ch: 1});+  eqPos(cm.getCursor(true), {line: 2, ch: 1});+  cm.setCursor(1, 2);+  eqPos(cm.getCursor(true), {line: 1, ch: 2});+}, {value: "111111\n222222\n333333"});++testCM("lines", function(cm) {+  eq(cm.getLine(0), "111111");+  eq(cm.getLine(1), "222222");+  eq(cm.getLine(-1), null);+  cm.removeLine(1);+  cm.setLine(1, "abc");+  eq(cm.getValue(), "111111\nabc");+}, {value: "111111\n222222\n333333"});++testCM("indent", function(cm) {+  cm.indentLine(1);+  eq(cm.getLine(1), "   blah();");+  cm.setOption("indentUnit", 8);+  cm.indentLine(1);+  eq(cm.getLine(1), "\tblah();");+}, {value: "if (x) {\nblah();\n}", indentUnit: 3, indentWithTabs: true, tabSize: 8});++test("defaults", function() {+  var olddefaults = CodeMirror.defaults, defs = CodeMirror.defaults = {};+  for (var opt in olddefaults) defs[opt] = olddefaults[opt];+  defs.indentUnit = 5;+  defs.value = "uu";+  defs.enterMode = "keep";+  defs.tabindex = 55;+  var place = document.getElementById("testground"), cm = CodeMirror(place);+  try {+    eq(cm.getOption("indentUnit"), 5);+    cm.setOption("indentUnit", 10);+    eq(defs.indentUnit, 5);+    eq(cm.getValue(), "uu");+    eq(cm.getOption("enterMode"), "keep");+    eq(cm.getInputField().tabIndex, 55);+  }+  finally {+    CodeMirror.defaults = olddefaults;+    place.removeChild(cm.getWrapperElement());+  }+});++testCM("lineInfo", function(cm) {+  eq(cm.lineInfo(-1), null);+  var lh = cm.setMarker(1, "FOO", "bar");+  var info = cm.lineInfo(1);+  eq(info.text, "222222");+  eq(info.markerText, "FOO");+  eq(info.markerClass, "bar");+  eq(info.line, 1);+  eq(cm.lineInfo(2).markerText, null);+  cm.clearMarker(lh);+  eq(cm.lineInfo(1).markerText, null);+}, {value: "111111\n222222\n333333"});++testCM("coords", function(cm) {+  cm.setSize(null, 100);+  addDoc(cm, 32, 200);+  var top = cm.charCoords({line: 0, ch: 0});+  var bot = cm.charCoords({line: 200, ch: 30});+  is(top.x < bot.x);+  is(top.y < bot.y);+  is(top.y < top.yBot);+  cm.scrollTo(null, 100);+  var top2 = cm.charCoords({line: 0, ch: 0});+  is(top.y > top2.y);+  eq(top.x, top2.x);+});++testCM("coordsChar", function(cm) {+  addDoc(cm, 35, 70);+  for (var ch = 0; ch <= 35; ch += 5) {+    for (var line = 0; line < 70; line += 5) {+      cm.setCursor(line, ch);+      var coords = cm.charCoords({line: line, ch: ch});+      var pos = cm.coordsChar({x: coords.x, y: coords.y + 1});+      eq(pos.line, line);+      eq(pos.ch, ch);+    }+  }+});++testCM("posFromIndex", function(cm) {+  cm.setValue(+    "This function should\n" ++    "convert a zero based index\n" ++    "to line and ch."+  );++  var examples = [+    { index: -1, line: 0, ch: 0  }, // <- Tests clipping+    { index: 0,  line: 0, ch: 0  },+    { index: 10, line: 0, ch: 10 },+    { index: 39, line: 1, ch: 18 },+    { index: 55, line: 2, ch: 7  },+    { index: 63, line: 2, ch: 15 },+    { index: 64, line: 2, ch: 15 }  // <- Tests clipping+  ];++  for (var i = 0; i < examples.length; i++) {+    var example = examples[i];+    var pos = cm.posFromIndex(example.index);+    eq(pos.line, example.line);+    eq(pos.ch, example.ch);+    if (example.index >= 0 && example.index < 64)+      eq(cm.indexFromPos(pos), example.index);+  }  +});++testCM("undo", function(cm) {+  cm.setLine(0, "def");+  eq(cm.historySize().undo, 1);+  cm.undo();+  eq(cm.getValue(), "abc");+  eq(cm.historySize().undo, 0);+  eq(cm.historySize().redo, 1);+  cm.redo();+  eq(cm.getValue(), "def");+  eq(cm.historySize().undo, 1);+  eq(cm.historySize().redo, 0);+  cm.setValue("1\n\n\n2");+  cm.clearHistory();+  eq(cm.historySize().undo, 0);+  for (var i = 0; i < 20; ++i) {+    cm.replaceRange("a", {line: 0, ch: 0});+    cm.replaceRange("b", {line: 3, ch: 0});+  }+  eq(cm.historySize().undo, 40);+  for (var i = 0; i < 40; ++i)+    cm.undo();+  eq(cm.historySize().redo, 40);+  eq(cm.getValue(), "1\n\n\n2");+}, {value: "abc"});++testCM("undoMultiLine", function(cm) {+  cm.replaceRange("x", {line:0, ch: 0});+  cm.replaceRange("y", {line:1, ch: 0});+  cm.undo();+  eq(cm.getValue(), "abc\ndef\nghi");+  cm.replaceRange("y", {line:1, ch: 0});+  cm.replaceRange("x", {line:0, ch: 0});+  cm.undo();+  eq(cm.getValue(), "abc\ndef\nghi");+  cm.replaceRange("y", {line:2, ch: 0});+  cm.replaceRange("x", {line:1, ch: 0});+  cm.replaceRange("z", {line:2, ch: 0});+  cm.undo();+  eq(cm.getValue(), "abc\ndef\nghi");+}, {value: "abc\ndef\nghi"});++testCM("markTextSingleLine", function(cm) {+  forEach([{a: 0, b: 1, c: "", f: 2, t: 5},+           {a: 0, b: 4, c: "", f: 0, t: 2},+           {a: 1, b: 2, c: "x", f: 3, t: 6},+           {a: 4, b: 5, c: "", f: 3, t: 5},+           {a: 4, b: 5, c: "xx", f: 3, t: 7},+           {a: 2, b: 5, c: "", f: 2, t: 3},+           {a: 2, b: 5, c: "abcd", f: 6, t: 7},+           {a: 2, b: 6, c: "x", f: null, t: null},+           {a: 3, b: 6, c: "", f: null, t: null},+           {a: 0, b: 9, c: "hallo", f: null, t: null},+           {a: 4, b: 6, c: "x", f: 3, t: 4},+           {a: 4, b: 8, c: "", f: 3, t: 4},+           {a: 6, b: 6, c: "a", f: 3, t: 6},+           {a: 8, b: 9, c: "", f: 3, t: 6}], function(test) {+    cm.setValue("1234567890");+    var r = cm.markText({line: 0, ch: 3}, {line: 0, ch: 6}, "foo");+    cm.replaceRange(test.c, {line: 0, ch: test.a}, {line: 0, ch: test.b});+    var f = r.find();+    eq(f.from && f.from.ch, test.f); eq(f.to && f.to.ch, test.t);+  });+});++testCM("markTextMultiLine", function(cm) {+  function p(v) { return v && {line: v[0], ch: v[1]}; }+  forEach([{a: [0, 0], b: [0, 5], c: "", f: [0, 0], t: [2, 5]},+           {a: [0, 1], b: [0, 10], c: "", f: [0, 1], t: [2, 5]},+           {a: [0, 5], b: [0, 6], c: "x", f: [0, 6], t: [2, 5]},+           {a: [0, 0], b: [1, 0], c: "", f: [0, 0], t: [1, 5]},+           {a: [0, 6], b: [2, 4], c: "", f: [0, 5], t: [0, 7]},+           {a: [0, 6], b: [2, 4], c: "aa", f: [0, 5], t: [0, 9]},+           {a: [1, 2], b: [1, 8], c: "", f: [0, 5], t: [2, 5]},+           {a: [0, 5], b: [2, 5], c: "xx", f: null, t: null},+           {a: [0, 0], b: [2, 10], c: "x", f: null, t: null},+           {a: [1, 5], b: [2, 5], c: "", f: [0, 5], t: [1, 5]},+           {a: [2, 0], b: [2, 3], c: "", f: [0, 5], t: [2, 2]},+           {a: [2, 5], b: [3, 0], c: "a\nb", f: [0, 5], t: [2, 5]},+           {a: [2, 3], b: [3, 0], c: "x", f: [0, 5], t: [2, 4]},+           {a: [1, 1], b: [1, 9], c: "1\n2\n3", f: [0, 5], t: [4, 5]}], function(test) {+    cm.setValue("aaaaaaaaaa\nbbbbbbbbbb\ncccccccccc\ndddddddd\n");+    var r = cm.markText({line: 0, ch: 5}, {line: 2, ch: 5}, "foo");+    cm.replaceRange(test.c, p(test.a), p(test.b));+    var f = r.find();+    eqPos(f.from, p(test.f)); eqPos(f.to, p(test.t));+  });+});++testCM("markClearBetween", function(cm) {+  cm.setValue("aaa\nbbb\nccc\nddd\n");+  cm.markText({line: 0, ch: 0}, {line: 2}, "foo");+  cm.replaceRange("aaa\nbbb\nccc", {line: 0, ch: 0}, {line: 2});+  eq(cm.findMarksAt({line: 1, ch: 1}).length, 0);+});++testCM("bookmark", function(cm) {+  function p(v) { return v && {line: v[0], ch: v[1]}; }+  forEach([{a: [1, 0], b: [1, 1], c: "", d: [1, 4]},+           {a: [1, 1], b: [1, 1], c: "xx", d: [1, 7]},+           {a: [1, 4], b: [1, 5], c: "ab", d: [1, 6]},+           {a: [1, 4], b: [1, 6], c: "", d: null},+           {a: [1, 5], b: [1, 6], c: "abc", d: [1, 5]},+           {a: [1, 6], b: [1, 8], c: "", d: [1, 5]},+           {a: [1, 4], b: [1, 4], c: "\n\n", d: [3, 1]},+           {bm: [1, 9], a: [1, 1], b: [1, 1], c: "\n", d: [2, 8]}], function(test) {+    cm.setValue("1234567890\n1234567890\n1234567890");+    var b = cm.setBookmark(p(test.bm) || {line: 1, ch: 5});+    cm.replaceRange(test.c, p(test.a), p(test.b));+    eqPos(b.find(), p(test.d));+  });+});++testCM("bug577", function(cm) {+  cm.setValue("a\nb");+  cm.clearHistory();+  cm.setValue("fooooo");+  cm.undo();+});++testCM("scrollSnap", function(cm) {+  cm.setSize(100, 100);+  addDoc(cm, 200, 200);+  cm.setCursor({line: 100, ch: 180});+  var info = cm.getScrollInfo();+  is(info.x > 0 && info.y > 0);+  cm.setCursor({line: 0, ch: 0});+  info = cm.getScrollInfo();+  is(info.x == 0 && info.y == 0, "scrolled clean to top");+  cm.setCursor({line: 100, ch: 180});+  cm.setCursor({line: 199, ch: 0});+  info = cm.getScrollInfo();+  is(info.x == 0 && info.y == info.height - 100, "scrolled clean to bottom");+});++testCM("selectionPos", function(cm) {+  cm.setSize(100, 100);+  addDoc(cm, 200, 100);+  cm.setSelection({line: 1, ch: 100}, {line: 98, ch: 100});+  var lineWidth = cm.charCoords({line: 0, ch: 200}, "local").x;+  var lineHeight = cm.charCoords({line: 1}).y - cm.charCoords({line: 0}).y;+  cm.scrollTo(0, 0);+  var selElt = byClassName(cm.getWrapperElement(), "CodeMirror-selected");+  var outer = cm.getWrapperElement().getBoundingClientRect();+  var sawMiddle, sawTop, sawBottom;+  for (var i = 0, e = selElt.length; i < e; ++i) {+    var box = selElt[i].getBoundingClientRect();+    var atLeft = box.left - outer.left < 30;+    var width = box.right - box.left;+    var atRight = box.right - outer.left > .8 * lineWidth;+    if (atLeft && atRight) {+      sawMiddle = true;+      is(box.bottom - box.top > 95 * lineHeight, "middle high");+      is(width > .9 * lineWidth, "middle wide");+    } else {+      is(width > .4 * lineWidth, "top/bot wide enough");+      is(width < .6 * lineWidth, "top/bot slim enough");+      if (atLeft) {+        sawBottom = true;+        is(box.top - outer.top > 96 * lineHeight, "bot below");+      } else if (atRight) {+        sawTop = true;+        is(box.top - outer.top < 2 * lineHeight, "top above");+      }+    }+  }+  is(sawTop && sawBottom && sawMiddle, "all parts");+});++testCM("restoreHistory", function(cm) {+  cm.setValue("abc\ndef");+  cm.compoundChange(function() {cm.setLine(1, "hello");});+  cm.compoundChange(function() {cm.setLine(0, "goop");});+  cm.undo();+  var storedVal = cm.getValue(), storedHist = cm.getHistory();+  if (window.JSON) storedHist = JSON.parse(JSON.stringify(storedHist));+  eq(storedVal, "abc\nhello");+  cm.setValue("");+  cm.clearHistory();+  eq(cm.historySize().undo, 0);+  cm.setValue(storedVal);+  cm.setHistory(storedHist);+  cm.redo();+  eq(cm.getValue(), "goop\nhello");+  cm.undo(); cm.undo();+  eq(cm.getValue(), "abc\ndef");+});++testCM("doubleScrollbar", function(cm) {+  var dummy = document.body.appendChild(document.createElement("p"));+  dummy.style.cssText = "height: 50px; overflow: scroll; width: 50px";+  var scrollbarWidth = dummy.offsetWidth + 1 - dummy.clientWidth;+  document.body.removeChild(dummy);+  cm.setSize(null, 100);+  addDoc(cm, 1, 300);+  var wrap = cm.getWrapperElement();+  is(wrap.offsetWidth - byClassName(wrap, "CodeMirror-lines")[0].offsetWidth <= scrollbarWidth);+});++testCM("weirdLinebreaks", function(cm) {+  cm.setValue("foo\nbar\rbaz\r\nquux\n\rplop");+  is(cm.getValue(), "foo\nbar\nbaz\nquux\n\nplop");+  is(cm.lineCount(), 6);+  cm.setValue("\n\n");+  is(cm.lineCount(), 3);+});++testCM("setSize", function(cm) {+  cm.setSize(100, 100);+  is(cm.getWrapperElement().offsetWidth, 100);+  is(cm.getWrapperElement().offsetHeight, 100);+  cm.setSize("100%", "3em");+  is(cm.getWrapperElement().style.width, "100%");+  is(cm.getScrollerElement().style.height, "3em");+  cm.setSize(null, 40);+  is(cm.getWrapperElement().style.width, "100%");+  is(cm.getScrollerElement().style.height, "40px");+});++testCM("hiddenLines", function(cm) {+  addDoc(cm, 4, 10);+  cm.hideLine(4);+  cm.setCursor({line: 3, ch: 0});+  CodeMirror.commands.goLineDown(cm);+  eqPos(cm.getCursor(), {line: 5, ch: 0});+  cm.setLine(3, "abcdefg");+  cm.setCursor({line: 3, ch: 6});+  CodeMirror.commands.goLineDown(cm);+  eqPos(cm.getCursor(), {line: 5, ch: 4});+  cm.setLine(3, "ab");+  cm.setCursor({line: 3, ch: 2});+  CodeMirror.commands.goLineDown(cm);+  eqPos(cm.getCursor(), {line: 5, ch: 2});+});++testCM("hiddenLinesSelectAll", function(cm) {  // Issue #484+  addDoc(cm, 4, 20);+  for (var i = 0; i < 20; ++i)+    if (i != 10) cm.hideLine(i);+  CodeMirror.commands.selectAll(cm);+  eqPos(cm.getCursor(true), {line: 10, ch: 0});+  eqPos(cm.getCursor(false), {line: 10, ch: 4});+});++testCM("wrappingAndResizing", function(cm) {+  cm.setSize(null, "auto");+  cm.setOption("lineWrapping", true);+  var wrap = cm.getWrapperElement(), h0 = wrap.offsetHeight, w = 50;+  var doc = "xxx xxx xxx xxx xxx";+  cm.setValue(doc);+  for (var step = 10;; w += step) {+    cm.setSize(w);+    if (wrap.offsetHeight == h0) {+      if (step == 10) { w -= 10; step = 1; }+      else { w--; break; }+    }+  }+  // Ensure that putting the cursor at the end of the maximally long+  // line doesn't cause wrapping to happen.+  cm.setCursor({line: 0, ch: doc.length});+  eq(wrap.offsetHeight, h0);+  cm.replaceSelection("x");+  is(wrap.offsetHeight > h0);+  // Now add a max-height and, in a document consisting of+  // almost-wrapped lines, go over it so that a scrollbar appears.+  cm.setValue(doc + "\n" + doc + "\n");+  cm.getScrollerElement().style.maxHeight = "100px";+  cm.replaceRange("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n!\n", {line: 2, ch: 0});+  forEach([{line: 0, ch: doc.length}, {line: 0, ch: doc.length - 1},+           {line: 0, ch: 0}, {line: 1, ch: doc.length}, {line: 1, ch: doc.length - 1}],+          function(pos) {+    var coords = cm.charCoords(pos);+    eqPos(pos, cm.coordsChar({x: coords.x + 2, y: coords.y + 2}));+  });+});
+ static/codemirror/theme/ambiance.css view
@@ -0,0 +1,81 @@+/* ambiance theme for code-mirror */++/* Color scheme */++.cm-s-ambiance .cm-keyword { color: #cda869; }+.cm-s-ambiance .cm-atom { color: #CF7EA9; }+.cm-s-ambiance .cm-number { color: #78CF8A; }+.cm-s-ambiance .cm-def { color: #aac6e3; }+.cm-s-ambiance .cm-variable { color: #ffb795; }+.cm-s-ambiance .cm-variable-2 { color: #eed1b3; }+.cm-s-ambiance .cm-variable-3 { color: #faded3; }+.cm-s-ambiance .cm-property { color: #eed1b3; }+.cm-s-ambiance .cm-operator {color: #fa8d6a;}+.cm-s-ambiance .cm-comment { color: #555; font-style:italic; }+.cm-s-ambiance .cm-string { color: #8f9d6a; }+.cm-s-ambiance .cm-string-2 { color: #9d937c; }+.cm-s-ambiance .cm-meta { color: #D2A8A1; }+.cm-s-ambiance .cm-error { color: #AF2018; }+.cm-s-ambiance .cm-qualifier { color: yellow; }+.cm-s-ambiance .cm-builtin { color: #9999cc; }+.cm-s-ambiance .cm-bracket { color: #24C2C7; }+.cm-s-ambiance .cm-tag { color: #fee4ff }+.cm-s-ambiance .cm-attribute {  color: #9B859D; }+.cm-s-ambiance .cm-header {color: blue;}+.cm-s-ambiance .cm-quote { color: #24C2C7; }+.cm-s-ambiance .cm-hr { color: pink; }+.cm-s-ambiance .cm-link { color: #F4C20B; }+.cm-s-ambiance .cm-special { color: #FF9D00; }++.cm-s-ambiance .CodeMirror-matchingbracket { color: #0f0; }+.cm-s-ambiance .CodeMirror-nonmatchingbracket { color: #f22; }++.cm-s-ambiance .CodeMirror-selected {+  background: rgba(255, 255, 255, 0.15);+}+.CodeMirror-focused .cm-s-ambiance .CodeMirror-selected {+  background: rgba(255, 255, 255, 0.10);+}++/* Editor styling */++.cm-s-ambiance {+  line-height: 1.40em;+  font-family: Monaco, Menlo,"Andale Mono","lucida console","Courier New",monospace !important;+  color: #E6E1DC;+  background-color: #202020;+  -webkit-box-shadow: inset 0 0 10px black;+  -moz-box-shadow: inset 0 0 10px black;+  -o-box-shadow: inset 0 0 10px black;+  box-shadow: inset 0 0 10px black;+}++.cm-s-ambiance .CodeMirror-gutter {+  background: #3D3D3D;+  padding: 0 5px;+  text-shadow: #333 1px 1px;+  border-right: 1px solid #4D4D4D;+  box-shadow: 0 10px 20px black;+}++.cm-s-ambiance .CodeMirror-gutter .CodeMirror-gutter-text {+  text-shadow: 0px 1px 1px #4d4d4d;+  color: #222;+}++.cm-s-ambiance .CodeMirror-lines {+  +}++.cm-s-ambiance .CodeMirror-lines .CodeMirror-cursor {+  border-left: 1px solid #7991E8;+}++.cm-s-ambiance .activeline {+  background: none repeat scroll 0% 0% rgba(255, 255, 255, 0.031);+}++.cm-s-ambiance,+.cm-s-ambiance .CodeMirror-gutter {+  background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAQAAAAHUWYVAABFFUlEQVQYGbzBCeDVU/74/6fj9HIcx/FRHx9JCFmzMyGRURhLZIkUsoeRfUjS2FNDtr6WkMhO9sm+S8maJfu+Jcsg+/o/c+Z4z/t97/vezy3z+z8ekGlnYICG/o7gdk+wmSHZ1z4pJItqapjoKXWahm8NmV6eOTbWUOp6/6a/XIg6GQqmenJ2lDHyvCFZ2cBDbmtHA043VFhHwXxClWmeYAdLhV00Bd85go8VmaFCkbVkzlQENzfBDZ5gtN7HwF0KDrTwJ0dypSOzpaKCMwQHKTIreYIxlmhXTzTWkVm+LTynZhiSBT3RZQ7aGfjGEd3qyXQ1FDymqbKxpspERQN2MiRjNZlFFQXfCNFm9nM1zpAsoYjmtRTc5ajwuaXc5xrWskT97RaKzAGe5ARHhVUsDbjKklziiX5WROcJwSNCNI+9w1Jwv4Zb2r7lCMZ4oq5C0EdTx+2GzNuKpJ+iFf38JEWkHJn9DNF7mmBDITrWEg0VWL3pHU20tSZnuqWu+R3BtYa8XxV1HO7GyD32UkOpL/yDloINFTmvtId+nmAjxRw40VMwVKiwrKLE4bK5UOVntYwhOcSSXKrJHKPJedocpGjVz/ZMIbnYUPB10/eKCrs5apqpgVmWzBYWpmtKHecJPjaUuEgRDDaU0oZghCJ6zNMQ5ZhDYx05r5v2muQdM0EILtXUsaKiQX9WMEUotagQzFbUNN6NUPC2nm5pxEWGCjMc3GdJHjSU2kORLK/JGSrkfGEIjncU/CYUnOipoYemwj8tST9NsJmB7TUVXtbUtXATJVZXBMvYeTXJfobgJUPmGMP/yFaWonaa6BcFO3nqcIqCozSZoZoSr1g4zJOzuyGnxTEX3lUEJ7WcZgme8ddaWvWJo2AJR9DZU3CUIbhCSG6ybSwN6qtJVnCU2svDTP2ZInOw2cBTrqtQahtNZn9NcJ4l2NaSmSkkP1noZWnVwkLmdUPOwLZEwy2Z3S3R+4rIG9hcbpPXHFVWcQdZkn2FOta3cKWQnNRC5g1LsJah4GCzSVsKnCOY5OAFRTBekyyryeyilhFKva75r4Mc0aWanGEaThcy31s439KKxTzJYY5WTHPU1FtIHjQU3Oip4xlNzj/lBw23dYZVliQa7WAXf4shetcQfatI+jWRDBPmyNeW6A1P5kdDgyYJlba0BIM8BZu1JfrFwItyjcAMR3K0BWOIrtMEXyhyrlVEx3ui5dUBjmB/Q3CXW85R4mBD0s7B+4q5tKUjOlb9qqmhi5AZ6GFIC5HXtOobdYGlVdMVbNJ8toNTFcHxnoL+muBagcctjWnbNMuR00uI7nQESwg5q2qqrKWIfrNUmeQocY6HuyxJV02wj36w00yhpmUFenv4p6fUkZYqLyuinx2RGOjhCXYyJF84oiU00YMOOhhquNdfbOB7gU88pY4xJO8LVdp6/q2voeB4R04vIdhSE40xZObx1HGGJ/ja0LBthFInKaLPPFzuCaYaoj8JjPME8yoyxo6zlBqkiUZYgq00OYMswbWO5NGmq+xhipxHLRW29ARjNKXO0wRnear8XSg4XFPLKEPUS1GqvyLwiuBUoa7zpZ0l5xxFwWmWZC1H5h5FwU8eQ7K+g8UcVY6TMQreVQT/8uQ8Z+ALIXnSEa2pYZQneE9RZbSBNYXfWYJzW/h/4j4Dp1tYVcFIC5019Vyi4ThPqSFCzjGWaHQTBU8q6vrVwgxP9Lkm840imWKpcLCjYTtrKuwvsKSnrvHCXGkSMk9p6lhckfRpIeis+N2PiszT+mFLspyGleUhDwcLrZqmyeylxwjBcKHEapqkmyangyLZRVOijwOtCY5SsG5zL0OwlCJ4y5KznF3EUNDDrinwiyLZRzOXtlBbK5ITHFGLp8Q0R6ab6mS7enI2cFrxOyHvOCFaT1HThS1krjCwqWeurCkk+willhCC+RSZnRXBiZaC5RXRIZYKp2lyfrHwiKPKR0JDzrdU2EFgpidawlFDR6FgXUMNa+g1FY3bUQh2cLCwosRdnuQTS/S+JVrGLeWIvtQUvONJxlqSQYYKpwoN2kaocLjdVsis4Mk80ESF2YpSkzwldjHkjFCUutI/r+EHDU8oCs6yzL3PhWiEooZdFMkymlas4AcI3KmoMMNSQ3tHzjGWCrcJJdYyZC7QFGwjRL9p+MrRkAGWzIaWCn9W0F3TsK01c2ZvQw0byvxuQU0r1lM0qJO7wW0kRIMdDTtXEdzi4VIh+EoIHm0mWtAtpCixlabgn83fKTI7anJe9ST7WIK1DMGpQmYeA58ImV6ezOGOzK2Kgq01pd60cKWiUi9Lievb/0vIDPHQ05Kzt4ddPckQBQtoaurjyHnek/nKzpQLrVgKPjIkh2v4uyezpv+Xoo7fPFXaGFp1vaLKxQ4uUpQQS5VuQs7BCq4xRJv7fwpVvvFEB3j+620haOuocqMhWd6TTPAEx+mdFNGHdranFe95WrWmIvlY4F1Dle2ECgc6cto7SryuqGGGha0tFQ5V53migUKmg6XKAo4qS3mik+0OZpAhOLeZKicacgaYcyx5hypYQE02ZA4xi/pNhOQxR4klNKyqacj+mpxnLTnnGSo85++3ZCZq6lrZkXlGEX3o+C9FieccJbZWVFjC0Yo1FZnJhoYMFoI1hEZ9r6hwg75HwzBNhbZCdJEfJwTPGzJvaKImw1yYX1HDAmpXR+ZJQ/SmgqMNVQb5vgamGwLtt7VwvP7Qk1xpiM5x5Cyv93E06MZmgs0Nya2azIKOYKCGBQQW97RmhKNKF02JZqHEJ4o58qp7X5EcZmc56trXEqzjCBZ1MFGR87Ql2tSTs6CGxS05PTzRQorkbw7aKoKXFDXsYW42VJih/q+FP2BdTzDTwVqOYB13liM50vG7wy28qagyuIXMeQI/Oqq8bcn5wJI50xH00CRntyfpL1T4hydYpoXgNiFzoIUTDZnLNRzh4TBHwbYGDvZkxmlyJloyr6tRihpeUG94GnKtIznREF0tzJG/OOr73JBcrSh1k6WuTprgLU+mnSGnv6Zge0NNz+kTDdH8nuAuTdJDCNb21LCiIuqlYbqGzT3RAoZofQfjFazkqeNWdYaGvYTM001EW2oKPvVk1ldUGSgUtHFwjKM1h9jnFcmy5lChoLNaQMGGDsYbKixlaMBmmsx1QjCfflwTfO/gckW0ruZ3jugKR3R5W9hGUWqCgxuFgsuaCHorotGKzGaeZB9DMsaTnKCpMtwTvOzhYk0rdrArKCqcaWmVk1+F372ur1YkKxgatI8Qfe1gIX9wE9FgS8ESmuABIXnRUbCapcKe+nO7slClSZFzpV/LkLncEb1qiO42fS3R855Su2mCLh62t1SYZZYVmKwIHjREF2uihTzB20JOkz7dkxzYQnK0UOU494wh+VWRc6Un2kpTaVgLDFEkJ/uhzRcI0YKGgpGWOlocBU/a4fKoJ/pEaNV6jip3+Es9VXY078rGnmAdf7t9ylPXS34RBSuYPs1UecZTU78WanhBCHpZ5sAoTz0LGZKjPf9TRypqWEiTvOFglL1fCEY3wY/++rbk7C8bWebA6p6om6PgOL2kp44TFJlVNBXae2rqqdZztOJpT87GQsE9jqCPIe9VReZuQ/CIgacsyZdCpIScSYqcZk8r+nsyCzhyfhOqHGOIvrLknC8wTpFcaYiGC/RU1NRbUeUpocQOnkRpGOrIOcNRx+1uA0UrzhSSt+VyS3SJpnFWkzNDqOFGIWcfR86DnmARTQ1HKIL33ExPiemeOhYSSjzlSUZZuE4TveoJLnBUOFof6KiysCbnAEcZgcUNTDOwkqWu3RWtmGpZwlHhJENdZ3miGz0lJlsKnjbwqSHQjpxnFDlTLLwqJPMZMjd7KrzkSG7VsxXBZE+F8YZkb01Oe00yyRK9psh5SYh29ySPKBo2ylNht7ZkZnsKenjKNJu9PNEyZpaCHv4Kt6RQsLvAVp7M9kIimmCUwGeWqLMmGuIotYMmWNpSahkhZw9FqZsVnKJhsjAHvtHMsTM9fCI06Dx/u3vfUXCqfsKRc4oFY2jMsoo/7DJDwZ1CsIKnJu+J9ldkpmiCxQx1rWjI+T9FwcWWzOuaYH0Hj7klNRVWEQpmaqosakiGNTFHdjS/qnUdmf0NJW5xsL0HhimCCZZSRzmSPTXJQ4aaztAwtZnoabebJ+htCaZ7Cm535ByoqXKbX1WRc4Eh2MkRXWzImVc96Cj4VdOKVxR84VdQsIUM8Psoou2byVHyZFuq7O8otbSQ2UAoeEWTudATLGSpZzVLlXVkPU2Jc+27lsw2jmg5T5VhbeE3BT083K9WsTTkFU/Osi0rC5lRlpwRHUiesNS0sOvmqGML1aRbPAxTJD9ZKtxuob+hhl8cwYGWpJ8nub7t5p6coYbMovZ1BTdaKn1jYD6h4GFDNFyT/Kqe1XCXphXHOKLZmuRSRdBPEfVUXQzJm5YGPGGJdvAEr7hHNdGZnuBvrpciGmopOLf5N0uVMy0FfYToJk90uUCbJupaVpO53UJXR2bVpoU00V2KOo4zMFrBd0Jtz2pa0clT5Q5L8IpQ177mWQejPMEJhuQjS10ref6HHjdEhy1P1EYR7GtO0uSsKJQYLiTnG1rVScj5lyazpqWGl5uBbRWl7m6ixGOOnEsMJR7z8J0n6KMnCdxhiNYQCoZ6CmYLnO8omC3MkW3bktlPmEt/VQQHejL3+dOE5FlPdK/Mq8hZxxJtLyRrepLThYKbLZxkSb5W52vYxNOaOxUF0yxMUPwBTYqCzy01XayYK0sJyWBLqX0MwU5CzoymRzV0EjjeUeLgDpTo6ij42ZAzvD01dHUUTPLU96MdLbBME8nFBn7zJCMtJcZokn8YoqU0FS5WFKyniHobguMcmW8N0XkWZjkyN3hqOMtS08r+/xTBwpZSZ3qiVRX8SzMHHjfUNFjgHEPmY9PL3ykEzxkSre/1ZD6z/NuznuB0RcE1TWTm9zRgfUWVJiG6yrzgmWPXC8EAR4Wxhlad0ZbgQyEz3pG5RVEwwDJH2mgKpjcTiCOzn1lfUWANFbZ2BA8balnEweJC9J0iuaeZoI+ippFCztEKVvckR2iice1JvhVytrQwUAZpgsubCPaU7xUe9vWnaOpaSBEspalykhC9bUlOMpT42ZHca6hyrqKmw/wMR8H5ZmdFoBVJb03O4UL0tSNnvIeRmkrLWqrs78gcrEn2tpcboh0UPOW3UUR9PMk4T4nnNKWmCjlrefhCwxRNztfmIQVdDElvS4m1/WuOujoZCs5XVOjtKPGokJzsYCtFYoWonSPT21DheU/wWhM19FcElwqNGOsp9Q8N/cwXaiND1MmeL1Q5XROtYYgGeFq1aTMsoMmcrKjQrOFQTQ1fmBYhmW6o8Jkjc7iDJRTBIo5kgJD5yMEYA3srCg7VFKwiVJkmRCc5ohGOKhsYMn/XBLdo5taZjlb9YAlGWRimqbCsoY7HFAXLa5I1HPRxMMsQDHFkWtRNniqT9UEeNjcE7RUlrCJ4R2CSJuqlKHWvJXjAUNcITYkenuBRB84TbeepcqTj3zZyFJzgYQdHnqfgI0ddUwS6GqWpsKWhjq9cV0vBAEMN2znq+EBfIWT+pClYw5xsTlJU6GeIBsjGmmANTzJZiIYpgrM0Oa8ZMjd7NP87jxhqGOhJlnQtjuQpB+8aEE00wZFznSJPyHxgH3HkPOsJFvYk8zqCHzTs1BYOa4J3PFU+UVRZxlHDM4YavlNUuMoRveiZA2d7grMNc2g+RbSCEKzmgYsUmWmazFJyoiOZ4KnyhKOGRzWJa0+moyV4TVHDzn51Awtqaphfk/lRQ08FX1iiqxTB/kLwd0VynKfEvI6cd4XMV5bMhZ7gZUWVzYQ6Nm2BYzxJbw3bGthEUUMfgbGeorae6DxHtJoZ6alhZ0+ytiVoK1R4z5PTrOECT/SugseEOlb1MMNR4VRNcJy+V1Hg9ONClSZFZjdHlc6W6FBLdJja2MC5hhpu0DBYEY1TFGwiFAxRRCsYkiM9JRb0JNMVkW6CZYT/2EiTGWmo8k+h4FhDNE7BvppoTSFnmCV5xZKzvcCdDo7VVPnIU+I+Rc68juApC90MwcFCsJ5hDqxgScYKreruyQwTqrzoqDCmhWi4IbhB0Yrt3RGa6GfDv52rKXWhh28dyZaWUvcZeMTBaZoSGyiCtRU5J8iviioHaErs7Jkj61syVzTTgOcUOQ8buFBTYWdL5g3T4qlpe0+wvD63heAXRfCCIed9RbCsp2CiI7raUOYOTU13N8PNHvpaGvayo4a3LLT1lDrVEPT2zLUlheB1R+ZTRfKWJ+dcocLJfi11vyJ51lLqJ0WD7tRwryezjiV5W28uJO9qykzX8JDe2lHl/9oyBwa2UMfOngpXCixvKdXTk3wrsKmiVYdZIqsoWEERjbcUNDuiaQomGoIbFdEHmsyWnuR+IeriKDVLnlawlyNHKwKlSU631PKep8J4Q+ayjkSLKYLhalNHlYvttb6fHm0p6OApsZ4l2VfdqZkjuysy6ysKLlckf1KUutCTs39bmCgEyyoasIWlVaMF7mgmWtBT8Kol5xpH9IGllo8cJdopcvZ2sImlDmMIbtDk3KIpeNiS08lQw11NFPTwVFlPP6pJ2gvRfI7gQUfmNAtf6Gs0wQxDsKGlVBdF8rCa3jzdwMaGHOsItrZk7hAyOzpK9VS06j5F49b0VNGOOfKs3lDToMsMBe9ZWtHFEgxTJLs7qrygKZjUnmCYoeAqeU6jqWuLJup4WghOdvCYJnrSkSzoyRkm5M2StQwVltPkfCAk58tET/CSg+8MUecmotMEnhBKfWBIZsg2ihruMJQaoIm+tkTLKEqspMh00w95gvFCQRtDwTT1gVDDSEVdlwqZfxoQRbK0g+tbiBZxzKlpnpypejdDwTaeOvorMk/IJE10h9CqRe28hhLbe0pMsdSwv4ZbhKivo2BjDWfL8UKJgeavwlwb5KlwhyE4u4XkGE2ytZCznKLCDZZq42VzT8HLCrpruFbIfOIINmh/qCdZ1ZBc65kLHR1Bkyf5zn6pN3SvGKIlFNGplhrO9QSXanLOMQTLCa0YJCRrCZm/CZmrLTm7WzCK4GJDiWUdFeYx1LCFg3NMd0XmCuF3Y5rITLDUsYS9zoHVzwnJoYpSTQoObyEzr4cFBNqYTopoaU/wkyLZ2lPhX/5Y95ulxGTV7KjhWrOZgl8MyUUafjYraNjNU1N3IWcjT5WzWqjwtoarHSUObGYO3GCJZpsBlnJGPd6ZYLyl1GdCA2625IwwJDP8GUKymbzuyPlZlvTUsaUh5zFDhRWFzPKKZLAlWdcQbObgF9tOqOsmB1dqcqYJmWstFbZRRI9poolmqiLnU0POvxScpah2iSL5UJNzgScY5+AuIbpO0YD3NCW+dLMszFSdFCWGqG6eVq2uYVNDdICGD6W7EPRWZEY5gpsE9rUkS3mijzzJnm6UpUFXG1hCUeVoS5WfNcFpblELL2qqrCvMvRfd45oalvKU2tiQ6ePJOVMRXase9iTtLJztPxJKLWpo2CRDcJwn2sWSLKIO1WQWNTCvpVUvOZhgSC40JD0dOctaSqzkCRbXsKlb11Oip6PCJ0IwSJM31j3akRxlP7Rwn6aGaUL0qiLnJkvB3xWZ2+Q1TfCwpQH3G0o92UzmX4o/oJNQMMSQc547wVHhdk+VCw01DFYEnTxzZKAm74QmeNNR1w6WzEhNK15VJzuCdxQ53dRUDws5KvwgBMOEgpcVNe0hZI6RXT1Jd0cyj5nsaEAHgVmGaJIlWdsc5Ui2ElrRR6jrRAttNMEAIWrTDFubkZaok7/AkzfIwfuWVq0jHzuCK4QabtLUMVPB3kJ0oyHTSVFlqMALilJf2Rf8k5aaHtMfayocLBS8L89oKoxpJvnAkDPa0qp5DAUTHKWmCcnthlou8iCKaFFLHWcINd1nyIwXqrSxMNmSs6KmoL2QrKuWtlQ5V0120xQ5vRyZS1rgFkWwhiOwiuQbR0OOVhQM9iS3tiXp4RawRPMp5tDletOOBL95MpM01dZTBM9pkn5qF010rIeHFcFZhmSGpYpTsI6nwhqe5C9ynhlpp5ophuRb6WcJFldkVnVEwwxVfrVkvnWUuNLCg5bgboFHPDlDPDmnK7hUrWiIbjadDclujlZcaokOFup4Ri1kacV6jmrrK1hN9bGwpKEBQ4Q6DvIUXOmo6U5LqQM6EPyiKNjVkPnJkDPNEaxhiFay5ExW1NXVUGqcpYYdPcGiCq7z/TSlbhL4pplWXKd7NZO5QQFrefhRQW/NHOsqcIglc4UhWklR8K0QzbAw08CBDnpbgqXdeD/QUsM4RZXDFBW6WJKe/mFPdH0LtBgiq57wFLzlyQzz82qYx5D5WJP5yVJDW01BfyHnS6HKO/reZqId1WGa4Hkh2kWodJ8i6KoIPlAj2hPt76CzXsVR6koPRzWTfKqIentatYpQw2me4AA3y1Kind3SwoOKZDcFXTwl9tWU6mfgRk9d71sKtlNwrjnYw5tC5n5LdKiGry3JKNlHEd3oaMCFHrazBPMp/uNJ+V7IudcSbeOIdjUEdwl0VHCOZo5t6YluEuaC9mQeMgSfOyKnYGFHcIeQ84yQWbuJYJpZw5CzglDH7gKnWqqM9ZTaXcN0TeYhR84eQtJT76JJ1lREe7WnnvsMmRc9FQ7SBBM9mV3lCUdmHk/S2RAMt0QjFNFqQpWjDPQ01DXWUdDBkXziKPjGEP3VP+zIWU2t7im41FOloyWzn/L6dkUy3VLDaZ6appgDLHPjJEsyvJngWEPUyVBiAaHCTEXwrLvSEbV1e1gKJniicWorC1MUrVjB3uDhJE/wgSOzk1DXpk0k73qCM8xw2UvD5kJmDUfOomqMpWCkJRlvKXGmoeBm18USjVIk04SClxTB6YrgLAPLWYK9HLUt5cmc0vYES8GnTeRc6skZbQkWdxRsIcyBRzx1DbTk9FbU0caTPOgJHhJKnOGIVhQqvKmo0llRw9sabrZkDtdg3PqaKi9oatjY8B+G371paMg6+mZFNNtQ04mWBq3rYLOmtWWQp8KJnpy9DdFensyjdqZ+yY40VJlH8wcdLzC8PZnvHMFUTZUrDTkLyQaGus5X5LzpYAf3i+e/ZlhqGqWhh6Ou6xTR9Z6oi5AZZtp7Mj2EEm8oSpxiYZCHU/1fbGdNNNRRoZMhmilEb2gqHOEJDtXkHK/JnG6IrvbPCwV3NhONVdS1thBMs1T4QOBcTWa2IzhMk2nW5Kyn9tXUtpv9RsG2msxk+ZsQzRQacJncpgke0+T8y5Fzj8BiGo7XlJjaTIlpQs7KFjpqGnKuoyEPeIKnFMkZHvopgh81ySxNFWvJWcKRs70j2FOT012IllEEO1n4pD1513Yg2ssQPOThOkvyrqHUdEXOSEsihmBbTbKX1kLBPWqWkLOqJbjB3GBIZmoa8qWl4CG/iZ7oiA72ZL7TJNeZUY7kFQftDcHHluBzRbCegzMtrRjVQpX2lgoPKKLJAkcbMl01XK2p7yhL8pCBbQ3BN2avJgKvttcrWDK3CiUOVxQ8ZP+pqXKyIxnmBymCg5vJjNfkPK4+c8cIfK8ocVt7kmfd/I5SR1hKvCzUtb+lhgc00ZaO6CyhIQP1Uv4yIZjload72PXX0OIJvnFU+0Zf6MhsJwTfW0r0UwQfW4LNLZl5HK261JCZ4qnBaAreVAS3WrjV0LBnNDUNNDToCEeFfwgcb4gOEqLRhirWkexrCEYKVV711DLYEE1XBEsp5tpTGjorkomKYF9FDXv7fR3BGwbettSxnyL53MBPjsxDZjMh+VUW9NRxq1DhVk+FSxQcaGjV9Pawv6eGByw5qzoy7xk4RsOShqjJwWKe/1pEEfzkobeD/dQJmpqedcyBTy2sr4nGNRH0c0SPWTLrqAc0OQcb/gemKgqucQT7ySWKCn2EUotoCvpZct7RO2sy/QW0IWcXd7pQRQyZVwT2USRO87uhjioTLKV2brpMUcMQRbKH/N2T+UlTpaMls6cmc6CCNy3JdYYSUzzJQ4oSD3oKLncULOiJvjBEC2oqnCJkJluCYy2ZQ5so9YYlZ1VLlQU1mXEW1jZERwj/MUSRc24TdexlqLKfQBtDTScJUV8FszXBEY5ktpD5Ur9hYB4Nb1iikw3JoYpkKX+RodRKFt53MMuRnKSpY31PwYaGaILh3wxJGz9TkTPEETxoCWZrgvOlmyMzxFEwVJE5xZKzvyJ4WxEc16Gd4Xe3Weq4XH2jKRikqOkGQ87hQnC7wBmGYLAnesX3M+S87eFATauuN+Qcrh7xIxXJbUIdMw3JGE3ylCWzrieaqCn4zhGM19TQ3z1oH1AX+pWEqIc7wNGAkULBo/ZxRaV9NNyh4Br3rCHZzbzmSfawBL0dNRwpW1kK9mxPXR9povcdrGSZK9c2k0xwFGzjuniCtRSZCZ6ccZ7gaktmgAOtKbG/JnOkJrjcQTdFMsxRQ2cLY3WTIrlCw1eWKn8R6pvt4GFDso3QoL4a3nLk3G6JrtME3dSenpx7PNFTmga0EaJTLQ061sEeQoWXhSo9LTXsaSjoJQRXeZLtDclbCrYzfzHHeaKjHCVOUkQHO3JeEepr56mhiyaYYKjjNU+Fed1wS5VlhWSqI/hYUdDOkaxiKehoyOnrCV5yBHtbWFqTHCCwtpDcYolesVR5yUzTZBb3RNMd0d6WP+SvhuBmRcGxnuQzT95IC285cr41cLGQ6aJJhmi4TMGempxeimBRQw1tFKV+8jd6KuzoSTqqDxzRtpZkurvKEHxlqXKRIjjfUNNXQsNOsRScoWFLT+YeRZVD3GRN0MdQcKqQjHDMrdGGVu3iYJpQx3WGUvfbmxwFfR20WBq0oYY7LMFhhgYtr8jpaEnaOzjawWWaTP8mMr0t/EPDPoqcnxTBI5o58L7uoWnMrpoqPwgVrlAUWE+V+TQl9rawoyP6QGAlQw2TPRX+YSkxyBC8Z6jhHkXBgQL7WII3DVFnRfCrBfxewv9D6xsyjys4VkhWb9pUU627JllV0YDNHMku/ldNMMXDEo4aFnAkk4U6frNEU4XgZUPmEKHUl44KrzmYamjAbh0JFvGnaTLPu1s9jPCwjFpYiN7z1DTOk/nc07CfDFzmCf7i+bfNHXhDtLeBXzTBT5rkMvWOIxpl4EMh2LGJBu2syDnAEx2naEhHDWMMzPZEhygyS1mS5RTJr5ZkoKbEUoYqr2kqdDUE8ztK7OaIntJkFrIECwv8LJTaVx5XJE86go8dFeZ3FN3rjabCAYpoYEeC9zzJVULBbmZhDyd7ko09ydpNZ3nm2Kee4FPPXHnYEF1nqOFEC08LUVcDvYXkJHW8gTaKCk9YGOeIJhqiE4ToPEepdp7IWFjdwnWaufGMwJJCMtUTTBBK9BGCOy2tGGrJTHIwyEOzp6aPzNMOtlZkDvcEWpP5SVNhfkvDxhmSazTJXYrM9U1E0xwFVwqZQwzJxw6+kGGGUj2FglGGmnb1/G51udRSMNlTw6GGnCcUwVcOpmsqTHa06o72sw1RL02p9z0VbnMLOaIX3QKaYKSCFQzBKEUNHTSc48k53RH9wxGMtpQa5KjjW0W0n6XCCCG4yxNNdhQ4R4l1Ff+2sSd6UFHiIEOyqqFgT01mEUMD+joy75jPhOA+oVVLm309FR4yVOlp4RhLiScNmSmaYF5Pw0STrOIoWMSR2UkRXOMp+M4SHW8o8Zoi6OZgjKOaFar8zZDzkWzvKOjkKBjmCXby8JahhjXULY4KlzgKLvAwxVGhvyd4zxB1d9T0piazmKLCVZY5sKiD0y2ZSYrkUEPUbIk+dlQ4SJHTR50k1DPaUWIdTZW9NJwnJMOECgd7ou/MnppMJ02O1VT4Wsh85MnZzcFTngpXGKo84qmwgKbCL/orR/SzJ2crA+t6Mp94KvxJUeIbT3CQu1uIdlQEOzlKfS3UMcrTiFmOuroocrZrT2AcmamOKg8YomeEKm/rlT2sociMaybaUlFhuqHCM2qIJ+rg4EcDFymiDSxzaHdPcpE62pD5kyM5SBMoA1PaUtfIthS85ig1VPiPPYXgYEMNk4Qq7TXBgo7oT57gPUdwgCHzhIVFPFU6OYJzHAX9m5oNrVjeE61miDrqQ4VSa1oiURTsKHC0IfjNwU2WzK6eqK8jWln4g15TVBnqmDteCJ501PGAocJhhqjZdtBEB6lnhLreFJKxmlKbeGrqLiSThVIbCdGzloasa6lpMQXHCME2boLpJgT7yWaemu6wBONbqGNVRS0PKIL7LckbjmQtR7K8I5qtqel+T/ChJTNIKLjdUMNIRyvOEko9YYl2cwQveBikCNawJKcLBbc7+JM92mysNvd/Fqp8a0k6CNEe7cnZrxlW0wQXaXjaktnRwNOGZKYiONwS7a1JVheq3WgJHlQUGKHKmp4KAxXR/ULURcNgoa4zhKSLpZR3kxRRb0NmD0OFn+UCS7CzI1nbP6+o4x47QZE5xRCt3ZagnYcvmpYQktXdk5YKXTzBC57kKEe0VVuiSYqapssMS3C9p2CKkHOg8B8Pa8p5atrIw3qezIWanMGa5HRDNF6RM9wcacl0N+Q8Z8hsIkSnaIIdHRUOEebAPy1zbCkhM062FCJtif7PU+UtoVXzWKqM1PxXO8cfdruhFQ/a6x3JKYagvVDhQEtNiyiiSQ7OsuRsZUku0CRNDs4Sog6KKjsZgk2bYJqijgsEenoKeniinRXBn/U3lgpPdyDZynQx8IiioMnCep5Ky8mjGs6Wty0l1hUQTcNWswS3WRp2kCNZwJG8omG8JphPUaFbC8lEfabwP7VtM9yoaNCAjpR41VNhrD9LkbN722v0CoZMByFzhaW+MyzRYEWFDQwN2M4/JiT76PuljT3VU/A36eaIThb+R9oZGOAJ9tewkgGvqOMNRWYjT/Cwu99Q8LqDE4TgbLWxJ1jaDDAERsFOFrobgjUsBScaguXU8kKm2RL19tRypSHnHNlHiIZqgufs4opgQdVdwxBNNFBR6kVFqb8ogimOzB6a6HTzrlDHEpYaxjiiA4TMQobkDg2vejjfwJGWmnbVFAw3H3hq2NyQfG7hz4aC+w3BbwbesG0swYayvpAs6++Ri1Vfzx93mFChvyN5xVHTS+0p9aqCAxyZ6ZacZyw5+7uuQkFPR9DDk9NOiE7X1PCYJVjVUqq7JlrHwWALF5nfHNGjApdpqgzx5OwilDhCiDYTgnc9waGW4BdLNNUQvOtpzDOWHDH8D7TR/A/85KljEQu3NREc4Pl/6B1Hhc8Umb5CsKMmGC9EPcxoT2amwHNCmeOEnOPbklnMkbOgIvO5UMOpQrS9UGVdt6iH/fURjhI/WOpaW9OKLYRod6HCUEdOX000wpDZQ6hwg6LgZfOqo1RfT/CrJzjekXOGhpc1VW71ZLbXyyp+93ILbC1kPtIEYx0FIx1VDrLoVzXRKRYWk809yYlC9ImcrinxtabKnzRJk3lAU1OLEN1j2zrYzr2myHRXJFf4h4QKT1qSTzTB5+ZNTzTRkAxX8FcLV2uS8eoQQ2aAkFzvCM72sJIcJET3WPjRk5wi32uSS9rfZajpWEvj9hW42F4o5NytSXYy8IKHay10VYdrcl4SkqscrXpMwyGOgtkajheSxdQqmpxP1L3t4R5PqasFnrQEjytq6qgp9Y09Qx9o4S1FzhUCn1kyHSzBWLemoSGvOqLNhZyBjmCaAUYpMgt4Ck7wBBMMwWKWgjsUwTaGVsxWC1mYoKiyqqeGKYqonSIRQ3KIkHO0pmAxTdBHkbOvfllfr+AA+7gnc50huVKYK393FOyg7rbPO/izI7hE4CnHHHnJ0ogNPRUGeUpsrZZTBJcrovUcJe51BPsr6GkJdhCCsZ6aTtMEb2pqWkqeVtDXE/QVggsU/Nl86d9RMF3DxvZTA58agu810RWawCiSzzXBeU3MMW9oyJUedvNEvQyNu1f10BSMddR1vaLCYpYa/mGocLSiYDcLbQz8aMn5iyF4xBNMs1P0QEOV7o5gaWGuzSeLue4tt3ro7y4Tgm4G/mopdZgl6q0o6KzJWE3mMksNr3r+a6CbT8g5wZNzT9O7fi/zpaOmnz3BRoqos+tv9zMbdpxsqDBOEewtJLt7cg5wtKKbvldpSzRRCD43VFheCI7yZLppggMVBS/KMAdHODJvOwq2NQSbKKKPLdFWQs7Fqo+mpl01JXYRgq8dnGLhTiFzqmWsUMdpllZdbKlyvSdYxhI9YghOtxR8LgSLWHK62mGGVoxzBE8LNWzqH9CUesQzFy5RQzTc56mhi6fgXEWwpKfE5Z7M05ZgZUPmo6auiv8YKzDYwWBLMErIbKHJvOwIrvEdhOBcQ9JdU1NHQ7CXn2XIDFBKU2WAgcX9UAUzDXWd5alwuyJ41Z9rjKLCL4aCp4WarhPm2rH+SaHUYE001JDZ2ZAzXPjdMpZWvC9wmqIB2lLhQ01D5jO06hghWMndbM7yRJMsoCj1vYbnFQVrW9jak3OlEJ3s/96+p33dEPRV5GxiqaGjIthUU6FFEZyqCa5qJrpBdzSw95IUnOPIrCUUjRZQFrbw5PR0R1qiYx3cb6nrWUMrBmmiBQxVHtTew5ICP/ip6g4hed/Akob/32wvBHsIOX83cI8hGeNeNPCIkPmXe8fPKx84OMSRM1MTdXSwjCZ4S30jVGhvqTRak/OVhgGazHuOCud5onEO1lJr6ecVyaOK6H7zqlBlIaHE0oroCgfvGJIdPcmfLNGLjpz7hZwZQpUbFME0A1cIJa7VNORkgfsMBatbKgwwJM9bSvQXeNOvbIjelg6WWvo5kvbKaJJNHexkKNHL9xRyFlH8Ti2riB5wVPhUk7nGkJnoCe428LR/wRGdYIlmWebCyxou1rCk4g/ShugBDX0V0ZQWkh0dOVsagkM0yV6OoLd5ye+pRlsCr0n+KiQrGuq5yJDzrTAXHtLUMduTDBVKrSm3eHL+6ijxhFDX9Z5gVU/wliHYTMiMFpKLNMEywu80wd3meoFmt6VbRMPenhrOc6DVe4pgXU8DnnHakLOIIrlF4FZPIw6R+zxBP0dyq6OOZ4Q5sLKCcz084ok+VsMMyQhNZmmBgX5xIXOEJTmi7VsGTvMTNdHHhpzdbE8Du2oKxgvBqQKdDDnTFOylCFaxR1syz2iqrOI/FEpNc3C6f11/7+ASS6l2inq2ciTrCCzgyemrCL5SVPjQkdPZUmGy2c9Sw9FtR1sS30RmsKPCS4rkIC/2U0MduwucYolGaPjKEyhzmiPYXagyWbYz8LWBDdzRimAXzxx4z8K9hpzlhLq+NiQ97HuKorMUfK/OVvC2JfiHUPCQI/q7J2gjK+tTDNxkCc4TMssqCs4TGtLVwQihyoAWgj9bosU80XGW6Ac9TJGziaUh5+hnFcHOnlaM1iRn29NaqGENTTTSUHCH2tWTeV0osUhH6psuVLjRUmGWhm6OZEshGeNowABHcJ2Bpy2ZszRcKkRXd2QuKVEeXnbfaEq825FguqfgfE2whlChSRMdron+LATTPQ2Z369t4B9C5gs/ylzv+CMmepIDPclFQl13W0rspPd1JOcbghGOEutqCv5qacURQl3dDKyvyJlqKXGPgcM9FfawJAMVmdcspcYKOZc4GjDYkFlK05olNMHyHn4zFNykyOxt99RkHlfwmiHo60l2EKI+mhreEKp080Tbug08BVPcgoqC5zWt+NLDTZ7oNSF51N1qie7Va3uCCwyZbkINf/NED6jzOsBdZjFN8oqG3wxVunqCSYYKf3EdhJyf9YWGf7tRU2oH3VHgPr1fe5J9hOgHd7xQ0y7qBwXr23aGErP0cm64JVjZwsOGqL+mhNgZmhJLW2oY4UhedsyBgzrCKrq7BmcpNVhR6jBPq64Vgi+kn6XE68pp8J5/+0wRHGOpsKenQn9DZntPzjRLZpDAdD2fnSgkG9tmIXnUwQ6WVighs7Yi2MxQ0N3CqYaCXkJ0oyOztMDJjmSSpcpvlrk0RMMOjmArQ04PRV1DO1FwhCVaUVPpKUM03JK5SxPsIWRu8/CGHi8UHChiqGFDTbSRJWeYUDDcH6vJWUxR4k1FXbMUwV6e4AJFXS8oMqsZKqzvYQ9DDQdZckY4aGsIhtlubbd2r3j4QBMoTamdPZk7O/Bf62lacZwneNjQoGcdVU7zJOd7ghsUHOkosagic6cnWc8+4gg285R6zZP5s1/LUbCKIznTwK36PkdwlOrl4U1LwfdCCa+IrvFkmgw1PCAUXKWo0sURXWcI2muKJlgyFzhynCY4RBOsqCjoI1R5zREco0n2Vt09BQtYSizgKNHfUmUrQ5UOCh51BFcLmY7umhYqXKQomOop8bUnWNNQcIiBcYaC6xzMNOS8JQQfeqKBmmglB+97ok/lfk3ygaHSyZaCRTzRxQo6GzLfa2jWBPepw+UmT7SQEJyiyRkhBLMVOfcoMjcK0eZChfUNzFAUzCsEN5vP/X1uP/n/aoMX+K+nw/Hjr/9xOo7j7Pju61tLcgvJpTWXNbfN5jLpi6VfCOviTktKlFusQixdEKWmEBUKNaIpjZRSSOXSgzaaKLdabrm1/9nZ+/f+vd/vz/v9+Xy+zZ7PRorYoZqyLrCwQdEAixxVOEXNNnjX2nUSRlkqGmWowk8lxR50JPy9Bo6qJXaXwNvREBvnThPEPrewryLhcAnj5WE15Fqi8W7R1sAuEu86S4ENikItFN4xkv9Af4nXSnUVcLiA9xzesFpivRRVeFKtsMRaKBhuSbjOELnAUtlSQUpXgdfB4Z1oSbnFEetbQ0IrAe+Y+pqnDcEJFj6S8LDZzZHwY4e3XONNlARraomNEt2bkvGsosA3ioyHm+6jCMbI59wqt4eeara28IzEmyPgoRaUOEDhTVdEJhmCoTWfC0p8aNkCp0oYqih2iqGi4yXeMkOsn4LdLLnmKfh/YogjNsPebeFGR4m9BJHLzB61XQ3BtpISfS2FugsK9FAtLWX1dCRcrCnUp44CNzuCowUZmxSRgYaE6Za0W2u/E7CVXCiI/UOR8aAm1+OSyE3mOUcwyc1zBBeoX1kiKy0Zfxck1Gsyulti11i83QTBF5Kg3pDQThFMVHiPSlK+0cSedng/VaS8bOZbtsBcTcZAR8JP5KeqQ1OYKAi20njdNNRpgnsU//K+JnaXJaGTomr7aYIphoRn9aeShJWKEq9LcozSF7QleEfDI5LYm5bgVkFkRwVDBCVu0DDIkGupo8TZBq+/pMQURYErJQmPKGKjNDkWOLx7Jd5QizdUweIaKrlP7SwJDhZvONjLkOsBBX9UpGxnydhXkfBLQ8IxgojQbLFnJf81JytSljclYYyEFyx0kVBvKWOFJmONpshGAcsduQY5giVNCV51eOdJYo/pLhbvM0uDHSevNKRcrKZIqnCtJeEsO95RoqcgGK4ocZcho1tTYtcZvH41pNQ7vA0WrhIfOSraIIntIAi+NXWCErdbkvrWwjRLrt0NKUdL6KSOscTOdMSOUtBHwL6OLA0vNSdynaWQEnCpIvKaIrJJEbvHkmuNhn6OjM8VkSGSqn1uYJCGHnq9I3aLhNME3t6GjIkO7xrNFumpyTNX/NrwX7CrIRiqqWijI9JO4d1iieykyfiposQIQ8YjjsjlBh6oHWbwRjgYJQn2NgSnNycmJAk3NiXhx44Sxykihxm8ybUwT1OVKySc7vi3OXVkdBJ4AyXBeksDXG0IhgtYY0lY5ahCD0ehborIk5aUWRJviMA7Xt5kyRjonrXENkm8yYqgs8VzgrJmClK20uMM3jRJ0FiQICQF9hdETlLQWRIb5ki6WDfWRPobvO6a4GP5mcOrNzDFELtTkONLh9dXE8xypEg7z8A9jkhrQ6Fhjlg/QVktJXxt4WXzT/03Q8IaQWSqIuEvloQ2mqC9Jfi7wRul4RX3pSPlzpoVlmCtI2jvKHCFhjcM3sN6lqF6HxnKelLjXWbwrpR4xzuCrTUZx2qq9oAh8p6ixCUGr78g8oyjRAtB5CZFwi80VerVpI0h+IeBxa6Zg6kWvpDHaioYYuEsRbDC3eOmC2JvGYLeioxGknL2UATNJN6hmtj1DlpLvDVmocYbrGCVJKOrg4X6DgddLA203BKMFngdJJFtFd7vJLm6KEpc5yjQrkk7M80SGe34X24nSex1Ra5Omgb71JKyg8SrU3i/kARKwWpH0kOGhKkObyfd0ZGjvyXlAkVZ4xRbYJ2irFMkFY1SwyWxr2oo4zlNiV+7zmaweFpT4kR3kaDAFW6xpSqzJay05FtYR4HmZhc9UxKbbfF2V8RG1MBmSaE+kmC6JnaRXK9gsiXhJHl/U0qM0WTcbyhwkYIvFGwjSbjfwhiJt8ZSQU+Bd5+marPMOkVkD0muxYLIfEuhh60x/J92itguihJSEMySVPQnTewnEm+620rTQEMsOfo4/kP/0ARvWjitlpSX7GxBgcMEsd3EEeYWvdytd+Saawi6aCIj1CkGb6Aj9rwhx16Cf3vAwFy5pyLhVonXzy51FDpdEblbkdJbUcEPDEFzQ8qNmhzzLTmmKWKbFCXeEuRabp6rxbvAtLF442QjQ+wEA9eL1xSR7Q0JXzlSHjJ4exq89yR0laScJ/FW6z4a73pFMEfDiRZvuvijIt86RaSFOl01riV2mD1UEvxGk/Geg5aWwGki1zgKPG9J2U8PEg8qYvMsZeytiTRXBMslCU8JSlxi8EabjwUldlDNLfzTUmCgxWsjqWCOHavYAqsknKFIO0yQ61VL5AVFxk6WhEaCAkdJgt9aSkzXlKNX2jEa79waYuc7gq0N3GDJGCBhoiTXUEPsdknCUE1CK0fwsiaylSF2uiDyO4XX3pFhNd7R4itFGc0k/ElBZwWvq+GC6szVeEoS/MZ+qylwpKNKv9Z469UOjqCjwlusicyTxG6VpNxcQ8IncoR4RhLbR+NdpGGmJWOcIzJGUuKPGpQg8rrG21dOMqQssJQ4RxH5jaUqnZuQ0F4Q+cjxLwPtpZbIAk3QTJHQWBE5S1BokoVtDd6lhqr9UpHSUxMcIYl9pojsb8h4SBOsMQcqvOWC2E8EVehqiJ1hrrAEbQxeK0NGZ0Gkq+guSRgniM23bIHVkqwx4hiHd7smaOyglyIyQuM978j4VS08J/A2G1KeMBRo4fBaSNhKUEZfQewVQ/C1I+MgfbEleEzCUw7mKXI0M3hd1EESVji8x5uQ41nxs1q4RMJCCXs7Iq9acpxn22oSDnQ/sJTxsCbHIYZiLyhY05TY0ZLIOQrGaSJDDN4t8pVaIrsqqFdEegtizc1iTew5Q4ayBDMUsQMkXocaYkc0hZua412siZ1rSXlR460zRJ5SlHGe5j801RLMlJTxtaOM3Q1pvxJ45zUlWFD7rsAbpfEm1JHxG0eh8w2R7QQVzBUw28FhFp5QZzq8t2rx2joqulYTWSuJdTYfWwqMFMcovFmSyJPNyLhE4E10pHzYjOC3huArRa571ZsGajQpQx38SBP5pyZB6lMU3khDnp0MBV51BE9o2E+TY5Ml2E8S7C0o6w1xvCZjf0HkVEHCzFoyNmqC+9wdcqN+Tp7jSDheE9ws8Y5V0NJCn2bk2tqSY4okdrEhx1iDN8cSudwepWmAGXKcJXK65H9to8jYQRH7SBF01ESUJdd0TayVInaWhLkOjlXE5irKGOnI6GSWGCJa482zBI9rCr0jyTVcEuzriC1vcr6mwFGSiqy5zMwxBH/TJHwjSPhL8+01kaaSUuMFKTcLEvaUePcrSmwn8DZrgikWb7CGPxkSjhQwrRk57tctmxLsb9sZvL9LSlyuSLlWkqOjwduo8b6Uv1DkmudIeFF2dHCgxVtk8dpIvHpBxhEOdhKk7OLIUSdJ+cSRY57B+0DgGUUlNfpthTfGkauzxrvTsUUaCVhlKeteTXCoJDCa2NOKhOmC4G1H8JBd4OBZReSRGkqcb/CO1PyLJTLB4j1q8JYaIutEjSLX8YKM+a6phdMsdLFUoV5RTm9JSkuDN8WcIon0NZMNZWh1q8C7SJEwV5HxrmnnTrf3KoJBlmCYI2ilSLlfEvlE4011NNgjgthzEua0oKK7JLE7HZHlEl60BLMVFewg4EWNt0ThrVNEVkkiTwpKXSWJzdRENgvKGq4IhjsiezgSFtsfCUq8qki5S1LRQeYQQ4nemmCkImWMw3tFUoUBZk4NOeZYEp4XRKTGa6wJjrWNHBVJR4m3FCnbuD6aak2WsMTh3SZImGCIPKNgsDpVwnsa70K31lCFJZYcwwSMFcQulGTsZuEaSdBXkPGZhu0FsdUO73RHjq8MPGGIfaGIbVTk6iuI3GFgucHrIQkmWSJdBd7BBu+uOryWAhY7+Lki9rK5wtEQzWwvtbqGhIMFwWRJsElsY4m9IIg9L6lCX0VklaPAYkfkZEGDnOWowlBJjtMUkcGK4Lg6EtoZInMUBVYLgn0UsdmCyCz7gIGHFfk+k1QwTh5We7A9x+IdJ6CvIkEagms0hR50eH9UnTQJ+2oiKyVlLFUE+8gBGu8MQ3CppUHesnjTHN4QB/UGPhCTHLFPHMFrCqa73gqObUJGa03wgbhHkrCfpEpzNLE7JDS25FMKhlhKKWKfCgqstLCPu1zBXy0J2ztwjtixBu8UTRn9LVtkmCN2iyFhtME70JHRQ1KVZXqKI/KNIKYMCYs1GUMEKbM1bKOI9LDXC7zbHS+bt+1MTWS9odA9DtrYtpbImQJ2VHh/lisEwaHqUk1kjKTAKknkBEXkbkdMGwq0dnhzLJF3NJH3JVwrqOB4Sca2hti75nmJN0WzxS6UxDYoEpxpa4htVlRjkYE7DZGzJVU72uC9IyhQL4i8YfGWSYLLNcHXloyz7QhNifmKSE9JgfGmuyLhc403Xm9vqcp6gXe3xuuv8F6VJNxkyTHEkHG2g0aKXL0MsXc1bGfgas2//dCONXiNLCX+5mB7eZIl1kHh7ajwpikyzlUUWOVOsjSQlsS+M0R+pPje/dzBXRZGO0rMtgQrLLG9VSu9n6CMXS3BhwYmSoIBhsjNBmZbgusE9BCPCP5triU4VhNbJfE+swSP27aayE8tuTpYYjtrYjMVGZdp2NpS1s6aBnKSHDsbKuplKbHM4a0wMFd/5/DmGyKrJSUaW4IBrqUhx0vyfzTBBLPIUcnZdrAkNsKR0sWRspumSns6Ch0v/qqIbBYUWKvPU/CFoyrDJGwSNFhbA/MlzKqjrO80hRbpKx0Jewsi/STftwGSlKc1JZyAzx05dhLEdnfQvhZOqiHWWEAHC7+30FuRcZUgaO5gpaIK+xsiHRUsqaPElTV40xQZQ107Q9BZE1nryDVGU9ZSQ47bmhBpLcYpUt7S+xuK/FiT8qKjwXYw5ypS2iuCv7q1gtgjhuBuB8LCFY5cUuCNtsQOFcT+4Ih9JX+k8Ea6v0iCIRZOtCT0Et00JW5UeC85Cg0ScK0k411HcG1zKtre3SeITBRk7WfwDhEvaYLTHP9le0m8By0JDwn4TlLW/aJOvGHxdjYUes+ScZigCkYQdNdEOhkiezgShqkx8ueKjI8lDfK2oNiOFvrZH1hS+tk7NV7nOmLHicGWEgubkXKdwdtZknCLJXaCpkrjZBtLZFsDP9CdxWsSr05Sxl6CMmoFbCOgryX40uDtamB7SVmXW4Ihlgpmq+00tBKUUa83WbjLUNkzDmY7cow1JDygyPGlhgGKYKz4vcV7QBNbJIgM11TUqZaMdwTeSguH6rOaw1JRKzaaGyxVm2EJ/uCIrVWUcZUkcp2grMsEjK+DMwS59jQk3Kd6SEq1d0S6uVmO4Bc1lDXTUcHjluCXEq+1OlBDj1pi9zgiXxnKuE0SqTXwhqbETW6RggMEnGl/q49UT2iCzgJvRwVXS2K/d6+ZkyUl7jawSVLit46EwxVljDZwoSQ20sDBihztHfk2yA8NVZghiXwrYHQdfKAOtzsayjhY9bY0yE2CWEeJ9xfzO423xhL5syS2TFJofO2pboHob0nY4GiAgRrvGQEDa/FWSsoaaYl0syRsEt3kWoH3B01shCXhTUWe9w3Bt44SC9QCh3eShQctwbaK2ApLroGCMlZrYqvlY3qYhM0aXpFkPOuoqJ3Dm6fxXrGwVF9gCWZagjPqznfkuMKQ8DPTQRO8ZqG1hPGKEm9IgpGW4DZDgTNriTxvFiq+Lz+0cKfp4wj6OCK9JSnzNSn9LFU7UhKZZMnYwcJ8s8yRsECScK4j5UOB95HFO0CzhY4xJxuCix0lDlEUeMdS6EZBkTsUkZ4K74dugyTXS7aNgL8aqjDfkCE0ZbwkCXpaWCKhl8P7VD5jxykivSyxyZrYERbe168LYu9ZYh86IkscgVLE7tWPKmJv11CgoyJltMEbrohtVAQfO4ImltiHEroYEs7RxAarVpY8AwXMcMReFOTYWe5iiLRQxJ5Q8DtJ8LQhWOhIeFESPGsILhbNDRljNbHzNRlTFbk2S3L0NOS6V1KFJYKUbSTcIIhM0wQ/s2TM0SRMNcQmSap3jCH4yhJZKSkwyRHpYYgsFeQ4U7xoCB7VVOExhXepo9ABBsYbvGWKXPME3lyH95YioZ0gssQRWWbI+FaSMkXijZXwgiTlYdPdkNLaETxlyDVIwqeaEus0aTcYcg0RVOkpR3CSJqIddK+90JCxzsDVloyrFd5ZAr4TBKfaWa6boEA7C7s6EpYaeFPjveooY72mjIccLHJ9HUwVlDhKkmutJDJBwnp1rvulJZggKDRfbXAkvC/4l3ozQOG9a8lxjx0i7nV4jSXc7vhe3OwIxjgSHjdEhhsif9YkPGlus3iLFDnWOFhtCZbJg0UbQcIaR67JjthoCyMEZRwhiXWyxO5QxI6w5NhT4U1WsJvDO60J34fW9hwzwlKij6ZAW9ne4L0s8C6XeBMEkd/LQy1VucBRot6QMlbivaBhoBgjqGiCJNhsqVp/S2SsG6DIONCR0dXhvWbJ+MRRZJkkuEjgDXJjFQW6SSL7GXK8Z2CZg7cVsbWGoKmEpzQ5elpiy8Ryg7dMkLLUEauzeO86CuwlSOlgYLojZWeJ9xM3S1PWfEfKl5ISLQ0MEKR8YOB2QfCxJBjrKPCN4f9MkaSsqoVXJBmP7EpFZ9UQfOoOFwSzBN4MQ8LsGrymlipcJQhmy0GaQjPqCHaXRwuCZwRbqK2Fg9wlClZqYicrIgMdZfxTQ0c7TBIbrChxmuzoKG8XRaSrIhhiyNFJkrC7oIAWMEOQa5aBekPCRknCo4IKPrYkvCDI8aYmY7WFtprgekcJZ3oLIqssCSMtFbQTJKwXYy3BY5oCh2iKPCpJOE+zRdpYgi6O2KmOAgvVCYaU4ySRek1sgyFhJ403QFHiVEmJHwtybO1gs8Hr5+BETQX3War0qZngYGgtVZtoqd6vFSk/UwdZElYqyjrF4HXUeFspIi9IGKf4j92pKGAdCYMVsbcV3kRF0N+R8LUd5PCsIGWoxDtBkCI0nKofdJQxT+LtZflvuc8Q3CjwWkq8KwUpHzkK/NmSsclCL0nseQdj5FRH5CNHSgtLiW80Of5HU9Hhlsga9bnBq3fEVltKfO5IaSTmGjjc4J0otcP7QsJUSQM8pEj5/wCuUuC2DWz8AAAAAElFTkSuQmCC");+}
+ static/codemirror/theme/blackboard.css view
@@ -0,0 +1,25 @@+/* Port of TextMate's Blackboard theme */++.cm-s-blackboard { background: #0C1021; color: #F8F8F8; }+.cm-s-blackboard .CodeMirror-selected { background: #253B76 !important; }+.cm-s-blackboard .CodeMirror-gutter { background: #0C1021; border-right: 0; }+.cm-s-blackboard .CodeMirror-gutter-text { color: #888; }+.cm-s-blackboard .CodeMirror-cursor { border-left: 1px solid #A7A7A7 !important; }++.cm-s-blackboard .cm-keyword { color: #FBDE2D; }+.cm-s-blackboard .cm-atom { color: #D8FA3C; }+.cm-s-blackboard .cm-number { color: #D8FA3C; }+.cm-s-blackboard .cm-def { color: #8DA6CE; }+.cm-s-blackboard .cm-variable { color: #FF6400; }+.cm-s-blackboard .cm-operator { color: #FBDE2D;}+.cm-s-blackboard .cm-comment { color: #AEAEAE; }+.cm-s-blackboard .cm-string { color: #61CE3C; }+.cm-s-blackboard .cm-string-2 { color: #61CE3C; }+.cm-s-blackboard .cm-meta { color: #D8FA3C; }+.cm-s-blackboard .cm-error { background: #9D1E15; color: #F8F8F8; }+.cm-s-blackboard .cm-builtin { color: #8DA6CE; }+.cm-s-blackboard .cm-tag { color: #8DA6CE; }+.cm-s-blackboard .cm-attribute { color: #8DA6CE; }+.cm-s-blackboard .cm-header { color: #FF6400; }+.cm-s-blackboard .cm-hr { color: #AEAEAE; }+.cm-s-blackboard .cm-link { color: #8DA6CE; }
+ static/codemirror/theme/cobalt.css view
@@ -0,0 +1,18 @@+.cm-s-cobalt { background: #002240; color: white; }+.cm-s-cobalt div.CodeMirror-selected { background: #b36539 !important; }+.cm-s-cobalt .CodeMirror-gutter { background: #002240; border-right: 1px solid #aaa; }+.cm-s-cobalt .CodeMirror-gutter-text { color: #d0d0d0; }+.cm-s-cobalt .CodeMirror-cursor { border-left: 1px solid white !important; }++.cm-s-cobalt span.cm-comment { color: #08f; }+.cm-s-cobalt span.cm-atom { color: #845dc4; }+.cm-s-cobalt span.cm-number, .cm-s-cobalt span.cm-attribute { color: #ff80e1; }+.cm-s-cobalt span.cm-keyword { color: #ffee80; }+.cm-s-cobalt span.cm-string { color: #3ad900; }+.cm-s-cobalt span.cm-meta { color: #ff9d00; }+.cm-s-cobalt span.cm-variable-2, .cm-s-cobalt span.cm-tag { color: #9effff; }+.cm-s-cobalt span.cm-variable-3, .cm-s-cobalt span.cm-def { color: white; }+.cm-s-cobalt span.cm-error { color: #9d1e15; }+.cm-s-cobalt span.cm-bracket { color: #d8d8d8; }+.cm-s-cobalt span.cm-builtin, .cm-s-cobalt span.cm-special { color: #ff9e59; }+.cm-s-cobalt span.cm-link { color: #845dc4; }
+ static/codemirror/theme/eclipse.css view
@@ -0,0 +1,25 @@+.cm-s-eclipse span.cm-meta {color: #FF1717;}+.cm-s-eclipse span.cm-keyword { line-height: 1em; font-weight: bold; color: #7F0055; }+.cm-s-eclipse span.cm-atom {color: #219;}+.cm-s-eclipse span.cm-number {color: #164;}+.cm-s-eclipse span.cm-def {color: #00f;}+.cm-s-eclipse span.cm-variable {color: black;}+.cm-s-eclipse span.cm-variable-2 {color: #0000C0;}+.cm-s-eclipse span.cm-variable-3 {color: #0000C0;}+.cm-s-eclipse span.cm-property {color: black;}+.cm-s-eclipse span.cm-operator {color: black;}+.cm-s-eclipse span.cm-comment {color: #3F7F5F;}+.cm-s-eclipse span.cm-string {color: #2A00FF;}+.cm-s-eclipse span.cm-string-2 {color: #f50;}+.cm-s-eclipse span.cm-error {color: #f00;}+.cm-s-eclipse span.cm-qualifier {color: #555;}+.cm-s-eclipse span.cm-builtin {color: #30a;}+.cm-s-eclipse span.cm-bracket {color: #cc7;}+.cm-s-eclipse span.cm-tag {color: #170;}+.cm-s-eclipse span.cm-attribute {color: #00c;}+.cm-s-eclipse span.cm-link {color: #219;}++.cm-s-eclipse .CodeMirror-matchingbracket {+	border:1px solid grey;+	color:black !important;;+}
+ static/codemirror/theme/elegant.css view
@@ -0,0 +1,10 @@+.cm-s-elegant span.cm-number, .cm-s-elegant span.cm-string, .cm-s-elegant span.cm-atom {color: #762;}+.cm-s-elegant span.cm-comment {color: #262; font-style: italic; line-height: 1em;}+.cm-s-elegant span.cm-meta {color: #555; font-style: italic; line-height: 1em;}+.cm-s-elegant span.cm-variable {color: black;}+.cm-s-elegant span.cm-variable-2 {color: #b11;}+.cm-s-elegant span.cm-qualifier {color: #555;}+.cm-s-elegant span.cm-keyword {color: #730;}+.cm-s-elegant span.cm-builtin {color: #30a;}+.cm-s-elegant span.cm-error {background-color: #fdd;}+.cm-s-elegant span.cm-link {color: #762;}
+ static/codemirror/theme/erlang-dark.css view
@@ -0,0 +1,21 @@+.cm-s-erlang-dark { background: #002240; color: white; }+.cm-s-erlang-dark div.CodeMirror-selected { background: #b36539 !important; }+.cm-s-erlang-dark .CodeMirror-gutter { background: #002240; border-right: 1px solid #aaa; }+.cm-s-erlang-dark .CodeMirror-gutter-text { color: #d0d0d0; }+.cm-s-erlang-dark .CodeMirror-cursor { border-left: 1px solid white !important; }++.cm-s-erlang-dark span.cm-atom       { color: #845dc4; }+.cm-s-erlang-dark span.cm-attribute  { color: #ff80e1; }+.cm-s-erlang-dark span.cm-bracket    { color: #ff9d00; }+.cm-s-erlang-dark span.cm-builtin    { color: #eeaaaa; }+.cm-s-erlang-dark span.cm-comment    { color: #7777ff; }+.cm-s-erlang-dark span.cm-def        { color: #ee77aa; }+.cm-s-erlang-dark span.cm-error      { color: #9d1e15; }+.cm-s-erlang-dark span.cm-keyword    { color: #ffee80; }+.cm-s-erlang-dark span.cm-meta       { color: #50fefe; }+.cm-s-erlang-dark span.cm-number     { color: #ffd0d0; }+.cm-s-erlang-dark span.cm-operator   { color: #dd1111; }+.cm-s-erlang-dark span.cm-string     { color: #3ad900; }+.cm-s-erlang-dark span.cm-tag        { color: #9effff; }+.cm-s-erlang-dark span.cm-variable   { color: #50fe50; }+.cm-s-erlang-dark span.cm-variable-2 { color: #ee00ee; }
+ static/codemirror/theme/lesser-dark.css view
@@ -0,0 +1,44 @@+/*+http://lesscss.org/ dark theme+Ported to CodeMirror by Peter Kroon+*/+.cm-s-lesser-dark {+  line-height: 1.3em;+}+.cm-s-lesser-dark {+  font-family: 'Bitstream Vera Sans Mono', 'DejaVu Sans Mono', 'Monaco', Courier, monospace !important;+}++.cm-s-lesser-dark { background: #262626; color: #EBEFE7; text-shadow: 0 -1px 1px #262626; }+.cm-s-lesser-dark div.CodeMirror-selected {background: #45443B !important;} /* 33322B*/+.cm-s-lesser-dark .CodeMirror-cursor { border-left: 1px solid white !important; }+.cm-s-lesser-dark .CodeMirror-lines { margin-left:3px; margin-right:3px; }/*editable code holder*/++div.CodeMirror span.CodeMirror-matchingbracket { color: #7EFC7E; }/*65FC65*/++.cm-s-lesser-dark .CodeMirror-gutter { background: #262626; border-right:1px solid #aaa; padding-right:3px; min-width:2.5em; }+.cm-s-lesser-dark .CodeMirror-gutter-text { color: #777; }++.cm-s-lesser-dark span.cm-keyword { color: #599eff; }+.cm-s-lesser-dark span.cm-atom { color: #C2B470; }+.cm-s-lesser-dark span.cm-number { color: #B35E4D; }+.cm-s-lesser-dark span.cm-def {color: white;}+.cm-s-lesser-dark span.cm-variable { color:#D9BF8C; }+.cm-s-lesser-dark span.cm-variable-2 { color: #669199; }+.cm-s-lesser-dark span.cm-variable-3 { color: white; }+.cm-s-lesser-dark span.cm-property {color: #92A75C;}+.cm-s-lesser-dark span.cm-operator {color: #92A75C;}+.cm-s-lesser-dark span.cm-comment { color: #666; }+.cm-s-lesser-dark span.cm-string { color: #BCD279; }+.cm-s-lesser-dark span.cm-string-2 {color: #f50;}+.cm-s-lesser-dark span.cm-meta { color: #738C73; }+.cm-s-lesser-dark span.cm-error { color: #9d1e15; }+.cm-s-lesser-dark span.cm-qualifier {color: #555;}+.cm-s-lesser-dark span.cm-builtin { color: #ff9e59; }+.cm-s-lesser-dark span.cm-bracket { color: #EBEFE7; }+.cm-s-lesser-dark span.cm-tag { color: #669199; }+.cm-s-lesser-dark span.cm-attribute {color: #00c;}+.cm-s-lesser-dark span.cm-header {color: #a0a;}+.cm-s-lesser-dark span.cm-quote {color: #090;}+.cm-s-lesser-dark span.cm-hr {color: #999;}+.cm-s-lesser-dark span.cm-link {color: #00c;}
+ static/codemirror/theme/monokai.css view
@@ -0,0 +1,28 @@+/* Based on Sublime Text's Monokai theme */++.cm-s-monokai {background: #272822; color: #f8f8f2;}+.cm-s-monokai div.CodeMirror-selected {background: #49483E !important;}+.cm-s-monokai .CodeMirror-gutter {background: #272822; border-right: 0px;}+.cm-s-monokai .CodeMirror-gutter-text {color: #d0d0d0;}+.cm-s-monokai .CodeMirror-cursor {border-left: 1px solid #f8f8f0 !important;}++.cm-s-monokai span.cm-comment {color: #75715e;}+.cm-s-monokai span.cm-atom {color: #ae81ff;}+.cm-s-monokai span.cm-number {color: #ae81ff;}++.cm-s-monokai span.cm-property, .cm-s-monokai span.cm-attribute {color: #a6e22e;}+.cm-s-monokai span.cm-keyword {color: #f92672;}+.cm-s-monokai span.cm-string {color: #e6db74;}++.cm-s-monokai span.cm-variable {color: #a6e22e;}+.cm-s-monokai span.cm-variable-2 {color: #9effff;}+.cm-s-monokai span.cm-def {color: #fd971f;}+.cm-s-monokai span.cm-error {background: #f92672; color: #f8f8f0;}+.cm-s-monokai span.cm-bracket {color: #f8f8f2;}+.cm-s-monokai span.cm-tag {color: #f92672;}+.cm-s-monokai span.cm-link {color: #ae81ff;}++.cm-s-monokai .CodeMirror-matchingbracket {+  text-decoration: underline;+  color: white !important;+}
+ static/codemirror/theme/neat.css view
@@ -0,0 +1,9 @@+.cm-s-neat span.cm-comment { color: #a86; }+.cm-s-neat span.cm-keyword { line-height: 1em; font-weight: bold; color: blue; }+.cm-s-neat span.cm-string { color: #a22; }+.cm-s-neat span.cm-builtin { line-height: 1em; font-weight: bold; color: #077; }+.cm-s-neat span.cm-special { line-height: 1em; font-weight: bold; color: #0aa; }+.cm-s-neat span.cm-variable { color: black; }+.cm-s-neat span.cm-number, .cm-s-neat span.cm-atom { color: #3a3; }+.cm-s-neat span.cm-meta {color: #555;}+.cm-s-neat span.cm-link { color: #3a3; }
+ static/codemirror/theme/night.css view
@@ -0,0 +1,21 @@+/* Loosely based on the Midnight Textmate theme */++.cm-s-night { background: #0a001f; color: #f8f8f8; }+.cm-s-night div.CodeMirror-selected { background: #447 !important; }+.cm-s-night .CodeMirror-gutter { background: #0a001f; border-right: 1px solid #aaa; }+.cm-s-night .CodeMirror-gutter-text { color: #f8f8f8; }+.cm-s-night .CodeMirror-cursor { border-left: 1px solid white !important; }++.cm-s-night span.cm-comment { color: #6900a1; }+.cm-s-night span.cm-atom { color: #845dc4; }+.cm-s-night span.cm-number, .cm-s-night span.cm-attribute { color: #ffd500; }+.cm-s-night span.cm-keyword { color: #599eff; }+.cm-s-night span.cm-string { color: #37f14a; }+.cm-s-night span.cm-meta { color: #7678e2; }+.cm-s-night span.cm-variable-2, .cm-s-night span.cm-tag { color: #99b2ff; }+.cm-s-night span.cm-variable-3, .cm-s-night span.cm-def { color: white; }+.cm-s-night span.cm-error { color: #9d1e15; }+.cm-s-night span.cm-bracket { color: #8da6ce; }+.cm-s-night span.cm-comment { color: #6900a1; }+.cm-s-night span.cm-builtin, .cm-s-night span.cm-special { color: #ff9e59; }+.cm-s-night span.cm-link { color: #845dc4; }
+ static/codemirror/theme/rubyblue.css view
@@ -0,0 +1,21 @@+.cm-s-rubyblue { font:13px/1.4em Trebuchet, Verdana, sans-serif; }	/* - customized editor font - */++.cm-s-rubyblue { background: #112435; color: white; }+.cm-s-rubyblue div.CodeMirror-selected { background: #38566F !important; }+.cm-s-rubyblue .CodeMirror-gutter { background: #1F4661; border-right: 7px solid #3E7087; min-width:2.5em; }+.cm-s-rubyblue .CodeMirror-gutter-text { color: white; }+.cm-s-rubyblue .CodeMirror-cursor { border-left: 1px solid white !important; }++.cm-s-rubyblue span.cm-comment { color: #999; font-style:italic; line-height: 1em; }+.cm-s-rubyblue span.cm-atom { color: #F4C20B; }+.cm-s-rubyblue span.cm-number, .cm-s-rubyblue span.cm-attribute { color: #82C6E0; }+.cm-s-rubyblue span.cm-keyword { color: #F0F; }+.cm-s-rubyblue span.cm-string { color: #F08047; }+.cm-s-rubyblue span.cm-meta { color: #F0F; }+.cm-s-rubyblue span.cm-variable-2, .cm-s-rubyblue span.cm-tag { color: #7BD827; }+.cm-s-rubyblue span.cm-variable-3, .cm-s-rubyblue span.cm-def { color: white; }+.cm-s-rubyblue span.cm-error { color: #AF2018; }+.cm-s-rubyblue span.cm-bracket { color: #F0F; }+.cm-s-rubyblue span.cm-link { color: #F4C20B; }+.cm-s-rubyblue span.CodeMirror-matchingbracket { color:#F0F !important; }+.cm-s-rubyblue span.cm-builtin, .cm-s-rubyblue span.cm-special { color: #FF9D00; }
+ static/codemirror/theme/vibrant-ink.css view
@@ -0,0 +1,27 @@+/* Taken from the popular Visual Studio Vibrant Ink Schema */++.cm-s-vibrant-ink { background: black; color: white; }+.cm-s-vibrant-ink .CodeMirror-selected { background: #35493c !important; }++.cm-s-vibrant-ink .CodeMirror-gutter { background: #002240; border-right: 1px solid #aaa; }+.cm-s-vibrant-ink .CodeMirror-gutter-text { color: #d0d0d0; }+.cm-s-vibrant-ink .CodeMirror-cursor { border-left: 1px solid white !important; }++.cm-s-vibrant-ink .cm-keyword {  color: #CC7832; }+.cm-s-vibrant-ink .cm-atom { color: #FC0; }+.cm-s-vibrant-ink .cm-number { color:  #FFEE98; }+.cm-s-vibrant-ink .cm-def { color: #8DA6CE; }+.cm-s-vibrant-ink span.cm-variable-2, .cm-s-cobalt span.cm-tag { color: #FFC66D }+.cm-s-vibrant-ink span.cm-variable-3, .cm-s-cobalt span.cm-def { color: #FFC66D }+.cm-s-vibrant-ink .cm-operator { color: #888; }+.cm-s-vibrant-ink .cm-comment { color: gray; font-weight: bold; }+.cm-s-vibrant-ink .cm-string { color:  #A5C25C }+.cm-s-vibrant-ink .cm-string-2 { color: red }+.cm-s-vibrant-ink .cm-meta { color: #D8FA3C; }+.cm-s-vibrant-ink .cm-error { border-bottom: 1px solid red; }+.cm-s-vibrant-ink .cm-builtin { color: #8DA6CE; }+.cm-s-vibrant-ink .cm-tag { color: #8DA6CE; }+.cm-s-vibrant-ink .cm-attribute { color: #8DA6CE; }+.cm-s-vibrant-ink .cm-header { color: #FF6400; }+.cm-s-vibrant-ink .cm-hr { color: #AEAEAE; }+.cm-s-vibrant-ink .cm-link { color: blue; }
+ static/codemirror/theme/xq-dark.css view
@@ -0,0 +1,46 @@+/*+Copyright (C) 2011 by MarkLogic Corporation+Author: Mike Brevoort <mike@brevoort.com>++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.+*/+.cm-s-xq-dark { background: #0a001f; color: #f8f8f8; }+.cm-s-xq-dark span.CodeMirror-selected { background: #a8f !important; }+.cm-s-xq-dark .CodeMirror-gutter { background: #0a001f; border-right: 1px solid #aaa; }+.cm-s-xq-dark .CodeMirror-gutter-text { color: #f8f8f8; }+.cm-s-xq-dark .CodeMirror-cursor { border-left: 1px solid white !important; }++.cm-s-xq-dark span.cm-keyword {color: #FFBD40;}+.cm-s-xq-dark span.cm-atom {color: #6C8CD5;}+.cm-s-xq-dark span.cm-number {color: #164;}+.cm-s-xq-dark span.cm-def {color: #FFF; text-decoration:underline;}+.cm-s-xq-dark span.cm-variable {color: #FFF;}+.cm-s-xq-dark span.cm-variable-2 {color: #EEE;}+.cm-s-xq-dark span.cm-variable-3 {color: #DDD;}+.cm-s-xq-dark span.cm-property {}+.cm-s-xq-dark span.cm-operator {}+.cm-s-xq-dark span.cm-comment {color: gray;}+.cm-s-xq-dark span.cm-string {color: #9FEE00;}+.cm-s-xq-dark span.cm-meta {color: yellow;}+.cm-s-xq-dark span.cm-error {color: #f00;}+.cm-s-xq-dark span.cm-qualifier {color: #FFF700;}+.cm-s-xq-dark span.cm-builtin {color: #30a;}+.cm-s-xq-dark span.cm-bracket {color: #cc7;}+.cm-s-xq-dark span.cm-tag {color: #FFBD40;}+.cm-s-xq-dark span.cm-attribute {color: #FFF700;}
+ static/document.js view
@@ -0,0 +1,394 @@+function evtJson(evt, f) {+    var str;+    if(evt.data instanceof Blob) {+        var reader = new FileReader();+        reader.onload = function() {+            f($.parseJSON(reader.result));+        }+        reader.readAsText(evt.data);+    } else {+        f($.parseJSON(evt.data));+    }+}++// a map that first converts the keys to string+function SerMap() {+  this.map = new Map();+}+SerMap.prototype.set = function(k,v) {+  this.map.set(""+k,v);+}+SerMap.prototype.get = function(k) {+  return this.map.get(""+k);+}++// specialized atom map, can cause problems with high (> 2000) client ids+function AtomMap() {+  this.map = {};+}+AtomMap.prototype.set = function(k,v) {+  this.map[k[0]*k[1]+1] = v;+}+AtomMap.prototype.get = function(k,v) {+  return this.map[k[0]*k[1]+1];+}++spliceArr = function(arr,i,n,a) {+  a.unshift(i,n);+  arr.splice.apply(arr,a);+  a.shift();+  a.shift();+  return arr;+}++concatArr = function(arr1,arr2) {+    var a = arr1.slice(0);+    a.push.apply(a,arr2);+    return a;+}++var clientId = -1;+// we work with server-synchronized strictly increasing timestamps+var tsOffset = 0;+var prevTs   = 0;++function setClientId(cid) {+//  console.log("setting clientid");+//  console.log(cid);+  clientId = cid;+}++function updateTimestamp(t) {+    tsOffset = t - new Date().getTime();+}++function getTimestamp() {+    var t = new Date().getTime() + tsOffset;+    if(t <= prevTs) t = prevTs + 1;+    prevTs = t;+    return t;+}++function mkAtomId() {+    return [getTimestamp(),clientId];+}++function Document() {+   this.lines = [[0,0]];          // lines[line][ch] -> [time,clientid], first ch of every line is line separator atomid (or [0,0] for first)+   this.atoms = new AtomMap();    // [time,clientid] -> { id, prev, next, ch, removed }+   var firstId = [0,0];+   this.atoms.set(firstId, { id: firstId, t: 0, c: 0, prev: null, next: null, ch: ' ', removed: true });+}+++// first atom+Document.prototype.first = function() {+   return this.atoms.get([0,0]);+}++// set document to list of [clientid,time,char,removed]+// expects first atom id to be [0,0]+Document.prototype.setDocument = function(d) {+//  console.log('setdocument');+//  console.log(d);+  this.lines = [];+  this.atoms = new AtomMap();+  var currentLine = [];+  var atomId = function(n) { return [d[n][0],d[n][1]] };+  var newAtoms = new Array(d.length);+  for(var i=0;i<d.length;i++) {+    var x = d[i];+    var aid    = atomId(i);+    var atom   = { id: aid, ch: x[2], removed: x[3] };+    newAtoms[i] = atom;+    this.atoms.set(aid,atom);+    if(!atom.removed || (aid[0] == 0 && aid[1] == 0)) {+      if(atom.ch == '\n') {+        this.lines.push(currentLine);+        currentLine = [];+      }+      currentLine.push(aid);+    }+  }+  this.lines.push(currentLine);+  for(var i=0;i<newAtoms.length;i++) {+    newAtoms[i].prev = (i > 0)                   ? newAtoms[i-1] : null;+    newAtoms[i].next = (i < newAtoms.length - 1) ? newAtoms[i+1] : null;+  }+}++// returns current version as string+Document.prototype.currentVersion = function() {+  var str = '';+  var a = this.first();+  while(true) {+    // console.log('iteration');+    // console.log(a);+    if(!a.removed) {+      str += a.ch;+    }+    if(!a.next) break;+    a = a.next;+  }+  return str;+}++function aidEq(aid1,aid2) {+  if(aid1 == null && aid2 == null) return true;+  if(aid1 == null || aid2 == null) return false;+  return (aid1[0] == aid2[0] && aid1[1] == aid2[1]);+}++function posEq(pos1,pos2) {+   return pos1.ch == pos2.ch && pos1.line == pos2.line;+}++// replace a range { line, ch } - { line, ch } by str+// returns modification messages+Document.prototype.replace = function(from,to,strs) {+  var mods  = [];+  var start = this.idbefore(from); // insert new string after this atom+  if(start == null) start = [0,0];+  var end   = this.pos2atomid(to);                // insert new string before this+  var aid   = this.nextid(start);+  var beforeEnd = this.idbefore(to); // last char to be removed+//  console.log("start: " + this.atomStr(start) + " end: " + this.atomStr(end));+//  console.log("aid: " + aid + " beforeEnd: " + beforeEnd);+  // first mark atoms as removed+  var atom = (aid != null) ? this.atoms.get(aid) : null;+  while(atom != null && !aidEq(atom.id,end) && !posEq(from,to)) {+    if(!atom.removed) {+      atom.removed = true;+      mods.push({ action: 'remove', atom: atom.id });+    }+    if(aidEq(atom.id, beforeEnd)) {+      break;+    }+    atom = atom.next;+  }+  // now remove original string+  var lastPost = this.lines[to.line].slice(to.ch+1); // part that we have to stick back to the last line+  var firstPre = this.lines[from.line].slice(0,from.ch+1);+  this.lines.splice(from.line, to.line - from.line + 1); // fixme don't do this if single line+  // insert new chars+  var newAtoms = [];+  var newLines = [];+  var currentLine = [];+  for(var l=0;l<strs.length;l++) {+    var str = strs[l];+    for(var i=0;i<str.length;i++) {+      var aid = mkAtomId();+      var atom = { id: aid, ch: str[i], removed: false }+      newAtoms.push(atom);+      currentLine.push(aid);+    }+    newLines.push(currentLine);+    currentLine = [];+    if(l<strs.length-1) {+      var linebr = { id: mkAtomId(), ch: '\n', removed: false};+      newAtoms.push(linebr);+      currentLine.push(linebr.id);+    }+  }+  for(var i=0;i<newAtoms.length;i++) {+      if(i>=1) { newAtoms[i].prev = newAtoms[i-1]; }+      if(i<newAtoms.length-1) { newAtoms[i].next = newAtoms[i+1]; }+  }+  if(newAtoms.length > 0) {+      var startAtom  = this.atoms.get(start);+      var afterStart = this.atoms.get(start).next;+      newAtoms[0].prev = startAtom;+      startAtom.next = newAtoms[0];+      newAtoms[newAtoms.length-1].next = afterStart;+      if(afterStart != null) { afterStart.prev = newAtoms[newAtoms.length-1]; }+  }+  for(var i=0;i<newAtoms.length;i++) {+      var a = newAtoms[i];+      mods.push({ action: 'insert', after: a.prev.id, id: a.id,  ch: a.ch });+      this.atoms.set(a.id,a);+  }+  if(newLines.length > 0) {+    newLines[0] = concatArr(firstPre,newLines[0]);+    newLines[newLines.length-1] = concatArr(newLines[newLines.length-1],lastPost);+    spliceArr(this.lines,from.line, 0, newLines);+  } else {+    this.lines.splice(from.line,0,concatArr(firstPre,lastPost));+  }+  this.dump();+  return mods;+}++// apply an insert/delete operation+Document.prototype.applyOp = function(op) {+  function smaller(aid1, aid2) {+    return aid1[0] < aid2[0] || (aid1[0] == aid2[0] && aid1[1] < aid2[1]);+  }+  function isFirst(aid) {+    return aid[0] == 0 && aid[1] == 0;+  }++  if(op.action == 'insert') {+//    console.log("inserting");+//    console.log(op);+    var atomAfter = this.atoms.get(op.after);+    if(this.atoms.get(op.id) != null) {+	return false;  // already applied op+    } else if(atomAfter == null) {+      console.log("invalid position");+      console.log(atomAfter);+      console.log(op.id);+      console.log(this.dumpStructure());+      return false;+    } else {+      // first find insertion position+      var atom = atomAfter;+      while(true) {+        if(atom.next == null || smaller(atom.next.id, op.id)) {+          var newAtom = { id: op.id, ch: op.ch, removed: false, prev: atom, next: atom.next }+          if(atom.next != null) {+            atom.next.prev = newAtom;+          }+          atom.next = newAtom;+          this.atoms.set(newAtom.id, newAtom);+          break;+        }+        atom = atom.next;+      }+  //    console.log("inserted after:");+  //    this.dumpAtom(aid);+      // now search back to first visible, or [0,0]+      // aid = op.after;+      while(!isFirst(atom.id) && atom.removed) {+         atom = atom.prev;+      }+      // find aid in lines+      idx = this.findIndex(atom.id);+      var l=idx[0];+      var c=idx[1];++//      console.log(this.dumpStructure());+//      console.log("line index: " + l + ":" + c);+      // and add our new id+      if(op.ch == '\n') {+        var remain = this.lines[l].slice(c+1);+        this.lines[l] = this.lines[l].slice(0,c+1);+        remain.unshift(op.id);+        this.lines.splice(l+1,0,remain);+      } else {+        this.lines[l].splice(c+1,0,op.id);+      }+//      console.log(this.dumpStructure());+      return true;+    }+  } else if(op.action == 'remove') {+    var atom = this.atoms.get(op.id);+    if(atom == null || atom.removed) {+      return false;+    } else {+      atom.removed = true;+      idx = this.findIndex(atom.id);+      var l = idx[0];+      var c = idx[1];+      if(atom.ch == '\n') {+        var remain = this.lines[l].slice(1);+        this.lines[l-1] = concatArr(this.lines[l-1], remain);+        this.lines.splice(l,1);+      } else {+        this.lines[l].splice(c,1);+      }+      return true;+    }+  } else {+    return false;+  }+}++Document.prototype.findIndex = function(aid) {+  for(var l=0;l<this.lines.length;l++) {+    var cl = this.lines[l];+    for(var c=0;c<cl.length;c++) {+      if(cl[c][0] == aid[0] && cl[c][1] == aid[1]) {+        return [l,c];+      }+    }+  }+  return null;+}++// convert a line,ch position to an atom id+Document.prototype.pos2atomid = function(pos) {+  return this.lines[pos.line][pos.ch+1];+}++// atom id before cursor { line: n, ch: m }  (both start at 0)+Document.prototype.idbefore = function(pos) {+  return this.lines[pos.line][pos.ch];+}++Document.prototype.dumpAtom = function(aid) {+  console.log(this.atomStr(aid)); +}++Document.prototype.dumpLine = function(aids) {+  console.log(this.lineStr(aids));+}++Document.prototype.lineStr = function(aids) {+  var str='';+  for(var i=0;i<aids.length;i++) {+    str += this.atomStr(aids[i]);+  }+  return str;+}++Document.prototype.atomStr = function(aid) {+  if(aid == null) {+      return "[null]";+  }+  var atom = this.atoms.get(aid);+  var str  = '';+  function charify(c) { return (c=='\n') ? "\\n" : c; }+  if(atom == null) {+    str += "[" + [aid[0],aid[1]] + "](not found)";+    aid = null;+  } else {+    str += "[" + [aid[0],aid[1],"'" + charify(atom.ch) + "'",atom.removed] + "]";+    aid = atom.next;+  }+  return str;+}++// fixme remove usage of this+Document.prototype.previd = function(aid) {+  var atom = this.atoms.get(aid);+  if(atom == null || atom.prev == null) return null;+  return atom.prev.id;+}++// fixme remove usage of this+Document.prototype.nextid = function(aid) {+  var atom = this.atoms.get(aid);+  if(atom == null || atom.next == null) return null;+  return atom.next.id;+}++Document.prototype.dump = function() {+  console.log(this.dumpStructure());+}++Document.prototype.dumpStructure = function() {+  return ''; // comment out for dumps+  str = "map:\n";+  var aid = [0,0]; // this.first();+  while(aid != null) {+    str += this.atomStr(aid) + "\n";+    aid = this.nextid(aid);+  }+  str += "lines:\n";+  for(var i=0;i<this.lines.length;i++) {+    str += this.lineStr(this.lines[i]) + "\n";+  }+  str += "current:\n" + this.currentVersion();+  return str;+}+
+ static/foo.css view
@@ -0,0 +1,71 @@+/* style.css won't load, so we use foo.css */+body {+    font-family: Georgia;+}+textarea, input {+    font-family: monospace;+    font-size: 13px;+    width: 100%;+}++#editor-panel {+/*    height: 300px; */+    overflow-y: auto+}++#output {+    font-family: monospace;+    font-size: 13px;+    background-color: PaleGoldenRod;+/*    height:300px; */+    overflow-y: auto;+}++#expr {+    width: 100%;+}++#load {+    font-size: 85%;+}++#editormessages {+    overflow-y: auto;+    background-color: #ffcfcf;+    font-family: monospace;+    font-size: 13px;+}++#eval-panel {+    text-align: center;+    width: 100%+}+++.expr {+    font-weight: bold;+}++.header {+        background: url(ui-bg_highlight-hard_100_f9f9f9_1x100.png) 0 50% repeat-x;+	/* background: #80ade5 url(../img/80ade5_40x100_textures_04_highlight_hard_100.png) 0 50% repeat-x; */+	border-bottom: 1px solid #777;+	font-weight: bold;+	text-align: center;+	padding: 2px 0 4px;+	position: relative;+	overflow: hidden;+}++.CodeMirror-wrap {+        position: absolute;+        bottom: 0;+        top: 0;+        left: 0;+        right: 0;+}+++.CodeMirror-scroll {+        height: 100% !important; /* override CodeMirror default */+}
+ static/ghclive.js view
@@ -0,0 +1,243 @@+function wsLocation() {+    return window.location.href.replace(/^([a-z]+)\:/i, "ws:");+}++var mainLayout;++var ignoreChange = false;++function handleChange(editor, change) {+    if(ignoreChange) { return; }+    var msgs = doc.replace(change.from, change.to, change.text);+    if(msgs.length > 0) {+        sock.send(JSON.stringify({ actions: msgs }));+    }+}++function refreshEditor() {+    ignoreChange = true;+    // fixme: try to preserve cursor position and selection better if other users insert lines etc+    var sel = cm.somethingSelected();+    var selStart;+    var selEnd;+    var cursor = cm.getCursor();+    if(sel) {+        selStart = cm.getCursor(start);+        selEnd   = cm.getCursor(end);+    }+    cm.setValue(doc.currentVersion());+    cm.setCursor(cursor);+    if(sel) {+        cm.setSelection(selStart,selEnd);+    }+    ignoreChange = false;+}++doc = new Document();++cm = CodeMirror.fromTextArea($('#editor')[0],+                             { mode:         'text/x-haskell'+                               , lineWrapping: true+                               , lineNumbers:  true+                               , fixedGutter:  true+                               , onChange:     handleChange+                             }+                            );+sock = new WebSocket(wsLocation());+sock.onmessage = function(evt) {+    evtJson(evt,function(msg) {+        if(msg.time) {+            updateTimestamp(msg.time);+        }+        var refresh = false;+        var r;+        if(msg.actions) {+            for(var i=0;i<msg.actions.length;i++) {+                var a = msg.actions[i];+                if(a.action === "doc") {+                    doc.setDocument(a.doc);+                    refresh = true;+                } else if(a.action === "clientid") {+                    setClientId(a.clientId);+                } else if(a.action === "insert") {+                    r = doc.applyOp(a);+                    if(r) { refresh = true; }+                } else if(a.action === "remove") {+                    r = doc.applyOp(a);+                    if(r) { refresh = true; }+                }+            }+        }+        if(msg.refreshoutput) {+            // refreshOutput();+            // alert('need to refresh output');+            outputit();+        }+        if(refresh) {+            refreshEditor();+        }+    });+}++function makeResultSlot(expr) {+    var slot = $('<div><span class="prompt">hint&gt;</span> <span class="expr">empty expr</span><div class="result">...</div></div>');+    slot.find('.expr').text(expr);+    return slot;+}++function fillInResultSlot(slot, res) {+    var node = slot.find('.result');+    if (res.error) {+        formatErrors(node, res.error);+    } else {+//        node.text('');+//        node.append(res.result.result);+        node.empty();+        for(var i=0; i<res.result.length; i++) {+            node.append(convertRes(res.result[i]));+        }+    }+}++function convertRes (res) {+    switch(res.t) {+        case "svg":+           return $(res.r); // fixme add clickable zoom function+        case "html":+           return $(res.r);+        case "text":+            var r = $("<span></span>");+            r.text(res.r);+            return r;+    }+}++function formatResult (res) {+    var slot = makeResultSlot(res.expr);+    fillInResultSlot(slot, res);+    return slot;+}++function formatErrors(node, message) {+    node.empty();+    var lines = message.split("\n");+    for (var i = 0; i < lines.length; ++i) {+        // console.log('line ' + i + ': ' + lines[i]);+        node.append(spacify(lines[i]));+        if (lines[i+1])+            node.append($('<br>'));+    }+}++// Change leading spaces into nbsp entities.+function spacify(line) {+    var i;+    var result = "";+    for (i = 0; i < line.length && line[i] === " "; ++i)+        result += "&nbsp;";+    return result + line.substring(i);+}++function scrollToBottom(elem) {+    // var elem = document.getElementById(elem);+    // elem.scrollTop = elem.scrollHeight;+    $(elem).scrollTo('max')+}++function load(success) {+    $.get('/loader', function(res) {+        if ("" + res === "Main,Helper") {+            $("#editormessages").text("");+//            $("#editor-messages").hide()+        } else if (typeof res === "string") {+            formatErrors($("#editormessages"), res);+//            $("#editor-messages").show()+        } else { // just paranoia+            $("#editormessages").text("" + res);+//            $("#editor-messages").show()+        }+        mainLayout.sizeContent("center");+        cm.refresh();+        if (success) success();+    });+}++function outputit(){+    $.ajax({+        type: "GET",+        url: "/results",+        success: function(results) {+            // clear the output area+            $("#output").empty();+            // map formatResult over the results+            for (var i = 0; i < results.length; i++) {+                $("#output").append(formatResult(results[i]));+            }+            scrollToBottom('#output');+            scrollToBottom('.ui-layout-center');+        }+    }); // end ajax call+    return false;+}+++$(function () {+    // $("#tabs").tabs();+    $( "input:submit, button").button();+    $(document).ready(function () {+      mainLayout = $('body').layout({+          name: "main-layout"+        , applyDefaultStyles: true+        , west: { initHidden: true }+        , east: { initHidden: true }+        , north: { size: 300 }+        , north__onresize: function() { cm.refresh(); }+      });+    });++    function mentionit() {+      var slot = $('<div><span class="prompt">hint&gt;</span> <span class="expr">:load</span><div class="result"></div></div>');+      $("#output").append(slot)+      scrollToBottom('#output');+      scrollToBottom('.ui-layout-center');+    }++    $("#load").click(function() {+        load();+        $("#expr").select();+        $("#expr").focus();+        mentionit();+        return false;+    });++    function evalit() {+        var expr = $("#expr").val();+        var slot = makeResultSlot(expr);+        $("#output").append(slot);+        load(function() {+            $.ajax({+                type: "GET",+                url: "/eval",+                data: {expr: expr},+                success: function(res) {+                    // XXX This is probably pointless now that each evaluation+                    // causes the server to send out a refreshoutput message.+                    // But maybe it still gets you a result display with lower+                    // latency (one less round trip, and not rewriting the whole+                    // output history) so I'm not nuking this yet.+                    fillInResultSlot(slot, res);+                    scrollToBottom('#output');+                    scrollToBottom('.ui-layout-center');+                }+            });+        });+        $("#expr").select();+        return false;+    }+    $("#evalform").submit(function(e) {+      e.preventDefault();+      evalit();+    });+    $("#evalit").click(evalit);+    $("#outputit").click(outputit);+});
+ static/grippie.png view

binary file changed (absent → 162 bytes)

+ static/images/ui-bg_flat_65_ffffff_40x100.png view

binary file changed (absent → 178 bytes)

+ static/images/ui-bg_glass_40_111111_1x400.png view

binary file changed (absent → 124 bytes)

+ static/images/ui-bg_glass_55_1c1c1c_1x400.png view

binary file changed (absent → 171 bytes)

+ static/images/ui-bg_highlight-hard_100_f9f9f9_1x100.png view

binary file changed (absent → 86 bytes)

+ static/images/ui-bg_highlight-hard_40_aaaaaa_1x100.png view

binary file changed (absent → 100 bytes)

+ static/images/ui-bg_highlight-soft_50_aaaaaa_1x100.png view

binary file changed (absent → 102 bytes)

+ static/images/ui-bg_inset-hard_45_cd0a0a_1x100.png view

binary file changed (absent → 123 bytes)

+ static/images/ui-bg_inset-hard_55_ffeb80_1x100.png view

binary file changed (absent → 113 bytes)

+ static/images/ui-icons_222222_256x240.png view

binary file changed (absent → 4369 bytes)

+ static/images/ui-icons_4ca300_256x240.png view

binary file changed (absent → 4369 bytes)

+ static/images/ui-icons_bbbbbb_256x240.png view

binary file changed (absent → 4369 bytes)

+ static/images/ui-icons_ededed_256x240.png view

binary file changed (absent → 4369 bytes)

+ static/images/ui-icons_ffcf29_256x240.png view

binary file changed (absent → 4369 bytes)

+ static/images/ui-icons_ffffff_256x240.png view

binary file changed (absent → 4369 bytes)

+ static/jquery-ui-1.8.23.custom.css view
@@ -0,0 +1,392 @@+/*!+ * jQuery UI CSS Framework 1.8.23+ *+ * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)+ * Dual licensed under the MIT or GPL Version 2 licenses.+ * http://jquery.org/license+ *+ * http://docs.jquery.com/UI/Theming/API+ */++/* Layout helpers+----------------------------------*/+.ui-helper-hidden { display: none; }+.ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); }+.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }+.ui-helper-clearfix:before, .ui-helper-clearfix:after { content: ""; display: table; }+.ui-helper-clearfix:after { clear: both; }+.ui-helper-clearfix { zoom: 1; }+.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }+++/* Interaction Cues+----------------------------------*/+.ui-state-disabled { cursor: default !important; }+++/* Icons+----------------------------------*/++/* states and images */+.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }+++/* Misc visuals+----------------------------------*/++/* Overlays */+.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }+++/*!+ * jQuery UI CSS Framework 1.8.23+ *+ * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)+ * Dual licensed under the MIT or GPL Version 2 licenses.+ * http://jquery.org/license+ *+ * http://docs.jquery.com/UI/Theming/API+ *+ * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Verdana,%20Arial,%20sans-serif&fwDefault=normal&fsDefault=1.1em&cornerRadius=8px&bgColorHeader=333333&bgTextureHeader=02_glass.png&bgImgOpacityHeader=15\\'&borderColorHeader=a3a3a3&fcHeader=eeeeee&iconColorHeader=bbbbbb&bgColorContent=f9f9f9&bgTextureContent=04_highlight_hard.png&bgImgOpacityContent=100&borderColorContent=cccccc&fcContent=222222&iconColorContent=222222&bgColorDefault=111111&bgTextureDefault=02_glass.png&bgImgOpacityDefault=40&borderColorDefault=777777&fcDefault=e3e3e3&iconColorDefault=ededed&bgColorHover=1c1c1c&bgTextureHover=02_glass.png&bgImgOpacityHover=55&borderColorHover=000000&fcHover=ffffff&iconColorHover=ffffff&bgColorActive=ffffff&bgTextureActive=01_flat.png&bgImgOpacityActive=65&borderColorActive=cccccc&fcActive=222222&iconColorActive=222222&bgColorHighlight=ffeb80&bgTextureHighlight=06_inset_hard.png&bgImgOpacityHighlight=55&borderColorHighlight=ffde2e&fcHighlight=363636&iconColorHighlight=4ca300&bgColorError=cd0a0a&bgTextureError=06_inset_hard.png&bgImgOpacityError=45&borderColorError=9e0505&fcError=ffffff&iconColorError=ffcf29&bgColorOverlay=aaaaaa&bgTextureOverlay=04_highlight_hard.png&bgImgOpacityOverlay=40&opacityOverlay=30&bgColorShadow=aaaaaa&bgTextureShadow=03_highlight_soft.png&bgImgOpacityShadow=50&opacityShadow=20&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=8px+ */+++/* Component containers+----------------------------------*/+.ui-widget { font-family: Verdana, Arial, sans-serif; font-size: 1.1em; }+.ui-widget .ui-widget { font-size: 1em; }+.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Verdana, Arial, sans-serif; font-size: 1em; }+.ui-widget-content { border: 1px solid #cccccc; background: #f9f9f9 url(images/ui-bg_highlight-hard_100_f9f9f9_1x100.png) 50% top repeat-x; color: #222222; }+.ui-widget-content a { color: #222222; }+.ui-widget-header { border: 1px solid #a3a3a3; background: #333333 url(images/ui-bg_glass_15\\\\\\\\\\\\\\\'_333333_1x400.png) 50% 50% repeat-x; color: #eeeeee; font-weight: bold; }+.ui-widget-header a { color: #eeeeee; }++/* Interaction states+----------------------------------*/+.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #777777; background: #111111 url(images/ui-bg_glass_40_111111_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #e3e3e3; }+.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #e3e3e3; text-decoration: none; }+.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #000000; background: #1c1c1c url(images/ui-bg_glass_55_1c1c1c_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #ffffff; }+.ui-state-hover a, .ui-state-hover a:hover { color: #ffffff; text-decoration: none; }+.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #cccccc; background: #ffffff url(images/ui-bg_flat_65_ffffff_40x100.png) 50% 50% repeat-x; font-weight: normal; color: #222222; }+.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #222222; text-decoration: none; }+.ui-widget :active { outline: none; }++/* Interaction Cues+----------------------------------*/+.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight  {border: 1px solid #ffde2e; background: #ffeb80 url(images/ui-bg_inset-hard_55_ffeb80_1x100.png) 50% bottom repeat-x; color: #363636; }+.ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636; }+.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #9e0505; background: #cd0a0a url(images/ui-bg_inset-hard_45_cd0a0a_1x100.png) 50% bottom repeat-x; color: #ffffff; }+.ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #ffffff; }+.ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #ffffff; }+.ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; }+.ui-priority-secondary, .ui-widget-content .ui-priority-secondary,  .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }+.ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }++/* Icons+----------------------------------*/++/* states and images */+.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png); }+.ui-widget-content .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); }+.ui-widget-header .ui-icon {background-image: url(images/ui-icons_bbbbbb_256x240.png); }+.ui-state-default .ui-icon { background-image: url(images/ui-icons_ededed_256x240.png); }+.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_ffffff_256x240.png); }+.ui-state-active .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); }+.ui-state-highlight .ui-icon {background-image: url(images/ui-icons_4ca300_256x240.png); }+.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_ffcf29_256x240.png); }++/* positioning */+.ui-icon-carat-1-n { background-position: 0 0; }+.ui-icon-carat-1-ne { background-position: -16px 0; }+.ui-icon-carat-1-e { background-position: -32px 0; }+.ui-icon-carat-1-se { background-position: -48px 0; }+.ui-icon-carat-1-s { background-position: -64px 0; }+.ui-icon-carat-1-sw { background-position: -80px 0; }+.ui-icon-carat-1-w { background-position: -96px 0; }+.ui-icon-carat-1-nw { background-position: -112px 0; }+.ui-icon-carat-2-n-s { background-position: -128px 0; }+.ui-icon-carat-2-e-w { background-position: -144px 0; }+.ui-icon-triangle-1-n { background-position: 0 -16px; }+.ui-icon-triangle-1-ne { background-position: -16px -16px; }+.ui-icon-triangle-1-e { background-position: -32px -16px; }+.ui-icon-triangle-1-se { background-position: -48px -16px; }+.ui-icon-triangle-1-s { background-position: -64px -16px; }+.ui-icon-triangle-1-sw { background-position: -80px -16px; }+.ui-icon-triangle-1-w { background-position: -96px -16px; }+.ui-icon-triangle-1-nw { background-position: -112px -16px; }+.ui-icon-triangle-2-n-s { background-position: -128px -16px; }+.ui-icon-triangle-2-e-w { background-position: -144px -16px; }+.ui-icon-arrow-1-n { background-position: 0 -32px; }+.ui-icon-arrow-1-ne { background-position: -16px -32px; }+.ui-icon-arrow-1-e { background-position: -32px -32px; }+.ui-icon-arrow-1-se { background-position: -48px -32px; }+.ui-icon-arrow-1-s { background-position: -64px -32px; }+.ui-icon-arrow-1-sw { background-position: -80px -32px; }+.ui-icon-arrow-1-w { background-position: -96px -32px; }+.ui-icon-arrow-1-nw { background-position: -112px -32px; }+.ui-icon-arrow-2-n-s { background-position: -128px -32px; }+.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }+.ui-icon-arrow-2-e-w { background-position: -160px -32px; }+.ui-icon-arrow-2-se-nw { background-position: -176px -32px; }+.ui-icon-arrowstop-1-n { background-position: -192px -32px; }+.ui-icon-arrowstop-1-e { background-position: -208px -32px; }+.ui-icon-arrowstop-1-s { background-position: -224px -32px; }+.ui-icon-arrowstop-1-w { background-position: -240px -32px; }+.ui-icon-arrowthick-1-n { background-position: 0 -48px; }+.ui-icon-arrowthick-1-ne { background-position: -16px -48px; }+.ui-icon-arrowthick-1-e { background-position: -32px -48px; }+.ui-icon-arrowthick-1-se { background-position: -48px -48px; }+.ui-icon-arrowthick-1-s { background-position: -64px -48px; }+.ui-icon-arrowthick-1-sw { background-position: -80px -48px; }+.ui-icon-arrowthick-1-w { background-position: -96px -48px; }+.ui-icon-arrowthick-1-nw { background-position: -112px -48px; }+.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }+.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }+.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }+.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }+.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }+.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }+.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }+.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }+.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }+.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }+.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }+.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }+.ui-icon-arrowreturn-1-w { background-position: -64px -64px; }+.ui-icon-arrowreturn-1-n { background-position: -80px -64px; }+.ui-icon-arrowreturn-1-e { background-position: -96px -64px; }+.ui-icon-arrowreturn-1-s { background-position: -112px -64px; }+.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }+.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }+.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }+.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }+.ui-icon-arrow-4 { background-position: 0 -80px; }+.ui-icon-arrow-4-diag { background-position: -16px -80px; }+.ui-icon-extlink { background-position: -32px -80px; }+.ui-icon-newwin { background-position: -48px -80px; }+.ui-icon-refresh { background-position: -64px -80px; }+.ui-icon-shuffle { background-position: -80px -80px; }+.ui-icon-transfer-e-w { background-position: -96px -80px; }+.ui-icon-transferthick-e-w { background-position: -112px -80px; }+.ui-icon-folder-collapsed { background-position: 0 -96px; }+.ui-icon-folder-open { background-position: -16px -96px; }+.ui-icon-document { background-position: -32px -96px; }+.ui-icon-document-b { background-position: -48px -96px; }+.ui-icon-note { background-position: -64px -96px; }+.ui-icon-mail-closed { background-position: -80px -96px; }+.ui-icon-mail-open { background-position: -96px -96px; }+.ui-icon-suitcase { background-position: -112px -96px; }+.ui-icon-comment { background-position: -128px -96px; }+.ui-icon-person { background-position: -144px -96px; }+.ui-icon-print { background-position: -160px -96px; }+.ui-icon-trash { background-position: -176px -96px; }+.ui-icon-locked { background-position: -192px -96px; }+.ui-icon-unlocked { background-position: -208px -96px; }+.ui-icon-bookmark { background-position: -224px -96px; }+.ui-icon-tag { background-position: -240px -96px; }+.ui-icon-home { background-position: 0 -112px; }+.ui-icon-flag { background-position: -16px -112px; }+.ui-icon-calendar { background-position: -32px -112px; }+.ui-icon-cart { background-position: -48px -112px; }+.ui-icon-pencil { background-position: -64px -112px; }+.ui-icon-clock { background-position: -80px -112px; }+.ui-icon-disk { background-position: -96px -112px; }+.ui-icon-calculator { background-position: -112px -112px; }+.ui-icon-zoomin { background-position: -128px -112px; }+.ui-icon-zoomout { background-position: -144px -112px; }+.ui-icon-search { background-position: -160px -112px; }+.ui-icon-wrench { background-position: -176px -112px; }+.ui-icon-gear { background-position: -192px -112px; }+.ui-icon-heart { background-position: -208px -112px; }+.ui-icon-star { background-position: -224px -112px; }+.ui-icon-link { background-position: -240px -112px; }+.ui-icon-cancel { background-position: 0 -128px; }+.ui-icon-plus { background-position: -16px -128px; }+.ui-icon-plusthick { background-position: -32px -128px; }+.ui-icon-minus { background-position: -48px -128px; }+.ui-icon-minusthick { background-position: -64px -128px; }+.ui-icon-close { background-position: -80px -128px; }+.ui-icon-closethick { background-position: -96px -128px; }+.ui-icon-key { background-position: -112px -128px; }+.ui-icon-lightbulb { background-position: -128px -128px; }+.ui-icon-scissors { background-position: -144px -128px; }+.ui-icon-clipboard { background-position: -160px -128px; }+.ui-icon-copy { background-position: -176px -128px; }+.ui-icon-contact { background-position: -192px -128px; }+.ui-icon-image { background-position: -208px -128px; }+.ui-icon-video { background-position: -224px -128px; }+.ui-icon-script { background-position: -240px -128px; }+.ui-icon-alert { background-position: 0 -144px; }+.ui-icon-info { background-position: -16px -144px; }+.ui-icon-notice { background-position: -32px -144px; }+.ui-icon-help { background-position: -48px -144px; }+.ui-icon-check { background-position: -64px -144px; }+.ui-icon-bullet { background-position: -80px -144px; }+.ui-icon-radio-off { background-position: -96px -144px; }+.ui-icon-radio-on { background-position: -112px -144px; }+.ui-icon-pin-w { background-position: -128px -144px; }+.ui-icon-pin-s { background-position: -144px -144px; }+.ui-icon-play { background-position: 0 -160px; }+.ui-icon-pause { background-position: -16px -160px; }+.ui-icon-seek-next { background-position: -32px -160px; }+.ui-icon-seek-prev { background-position: -48px -160px; }+.ui-icon-seek-end { background-position: -64px -160px; }+.ui-icon-seek-start { background-position: -80px -160px; }+/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */+.ui-icon-seek-first { background-position: -80px -160px; }+.ui-icon-stop { background-position: -96px -160px; }+.ui-icon-eject { background-position: -112px -160px; }+.ui-icon-volume-off { background-position: -128px -160px; }+.ui-icon-volume-on { background-position: -144px -160px; }+.ui-icon-power { background-position: 0 -176px; }+.ui-icon-signal-diag { background-position: -16px -176px; }+.ui-icon-signal { background-position: -32px -176px; }+.ui-icon-battery-0 { background-position: -48px -176px; }+.ui-icon-battery-1 { background-position: -64px -176px; }+.ui-icon-battery-2 { background-position: -80px -176px; }+.ui-icon-battery-3 { background-position: -96px -176px; }+.ui-icon-circle-plus { background-position: 0 -192px; }+.ui-icon-circle-minus { background-position: -16px -192px; }+.ui-icon-circle-close { background-position: -32px -192px; }+.ui-icon-circle-triangle-e { background-position: -48px -192px; }+.ui-icon-circle-triangle-s { background-position: -64px -192px; }+.ui-icon-circle-triangle-w { background-position: -80px -192px; }+.ui-icon-circle-triangle-n { background-position: -96px -192px; }+.ui-icon-circle-arrow-e { background-position: -112px -192px; }+.ui-icon-circle-arrow-s { background-position: -128px -192px; }+.ui-icon-circle-arrow-w { background-position: -144px -192px; }+.ui-icon-circle-arrow-n { background-position: -160px -192px; }+.ui-icon-circle-zoomin { background-position: -176px -192px; }+.ui-icon-circle-zoomout { background-position: -192px -192px; }+.ui-icon-circle-check { background-position: -208px -192px; }+.ui-icon-circlesmall-plus { background-position: 0 -208px; }+.ui-icon-circlesmall-minus { background-position: -16px -208px; }+.ui-icon-circlesmall-close { background-position: -32px -208px; }+.ui-icon-squaresmall-plus { background-position: -48px -208px; }+.ui-icon-squaresmall-minus { background-position: -64px -208px; }+.ui-icon-squaresmall-close { background-position: -80px -208px; }+.ui-icon-grip-dotted-vertical { background-position: 0 -224px; }+.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }+.ui-icon-grip-solid-vertical { background-position: -32px -224px; }+.ui-icon-grip-solid-horizontal { background-position: -48px -224px; }+.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }+.ui-icon-grip-diagonal-se { background-position: -80px -224px; }+++/* Misc visuals+----------------------------------*/++/* Corner radius */+.ui-corner-all, .ui-corner-top, .ui-corner-left, .ui-corner-tl { -moz-border-radius-topleft: 8px; -webkit-border-top-left-radius: 8px; -khtml-border-top-left-radius: 8px; border-top-left-radius: 8px; }+.ui-corner-all, .ui-corner-top, .ui-corner-right, .ui-corner-tr { -moz-border-radius-topright: 8px; -webkit-border-top-right-radius: 8px; -khtml-border-top-right-radius: 8px; border-top-right-radius: 8px; }+.ui-corner-all, .ui-corner-bottom, .ui-corner-left, .ui-corner-bl { -moz-border-radius-bottomleft: 8px; -webkit-border-bottom-left-radius: 8px; -khtml-border-bottom-left-radius: 8px; border-bottom-left-radius: 8px; }+.ui-corner-all, .ui-corner-bottom, .ui-corner-right, .ui-corner-br { -moz-border-radius-bottomright: 8px; -webkit-border-bottom-right-radius: 8px; -khtml-border-bottom-right-radius: 8px; border-bottom-right-radius: 8px; }++/* Overlays */+.ui-widget-overlay { background: #aaaaaa url(images/ui-bg_highlight-hard_40_aaaaaa_1x100.png) 50% top repeat-x; opacity: .30;filter:Alpha(Opacity=30); }+.ui-widget-shadow { margin: -8px 0 0 -8px; padding: 8px; background: #aaaaaa url(images/ui-bg_highlight-soft_50_aaaaaa_1x100.png) 50% top repeat-x; opacity: .20;filter:Alpha(Opacity=20); -moz-border-radius: 8px; -khtml-border-radius: 8px; -webkit-border-radius: 8px; border-radius: 8px; }/*!+ * jQuery UI Resizable 1.8.23+ *+ * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)+ * Dual licensed under the MIT or GPL Version 2 licenses.+ * http://jquery.org/license+ *+ * http://docs.jquery.com/UI/Resizable#theming+ */+.ui-resizable { position: relative;}+.ui-resizable-handle { position: absolute;font-size: 0.1px; display: block; }+.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; }+.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; }+.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; }+.ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; }+.ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; }+.ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; }+.ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; }+.ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; }+.ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}/*!+ * jQuery UI Selectable 1.8.23+ *+ * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)+ * Dual licensed under the MIT or GPL Version 2 licenses.+ * http://jquery.org/license+ *+ * http://docs.jquery.com/UI/Selectable#theming+ */+.ui-selectable-helper { position: absolute; z-index: 100; border:1px dotted black; }+/*!+ * jQuery UI Button 1.8.23+ *+ * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)+ * Dual licensed under the MIT or GPL Version 2 licenses.+ * http://jquery.org/license+ *+ * http://docs.jquery.com/UI/Button#theming+ */+.ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; text-decoration: none !important; cursor: pointer; text-align: center; zoom: 1; overflow: visible; } /* the overflow property removes extra width in IE */+.ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */+button.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */+.ui-button-icons-only { width: 3.4em; } +button.ui-button-icons-only { width: 3.7em; } ++/*button text element */+.ui-button .ui-button-text { display: block; line-height: 1.4;  }+.ui-button-text-only .ui-button-text { padding: .4em 1em; }+.ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: .4em; text-indent: -9999999px; }+.ui-button-text-icon-primary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 2.1em; }+.ui-button-text-icon-secondary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 2.1em .4em 1em; }+.ui-button-text-icons .ui-button-text { padding-left: 2.1em; padding-right: 2.1em; }+/* no icon support for input elements, provide padding by default */+input.ui-button { padding: .4em 1em; }++/*button icon element(s) */+.ui-button-icon-only .ui-icon, .ui-button-text-icon-primary .ui-icon, .ui-button-text-icon-secondary .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -8px; }+.ui-button-icon-only .ui-icon { left: 50%; margin-left: -8px; }+.ui-button-text-icon-primary .ui-button-icon-primary, .ui-button-text-icons .ui-button-icon-primary, .ui-button-icons-only .ui-button-icon-primary { left: .5em; }+.ui-button-text-icon-secondary .ui-button-icon-secondary, .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }+.ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }++/*button sets*/+.ui-buttonset { margin-right: 7px; }+.ui-buttonset .ui-button { margin-left: 0; margin-right: -.3em; }++/* workarounds */+button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra padding in Firefox */+/*!+ * jQuery UI Dialog 1.8.23+ *+ * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)+ * Dual licensed under the MIT or GPL Version 2 licenses.+ * http://jquery.org/license+ *+ * http://docs.jquery.com/UI/Dialog#theming+ */+.ui-dialog { position: absolute; padding: .2em; width: 300px; overflow: hidden; }+.ui-dialog .ui-dialog-titlebar { padding: .4em 1em; position: relative;  }+.ui-dialog .ui-dialog-title { float: left; margin: .1em 16px .1em 0; } +.ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; }+.ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; }+.ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; }+.ui-dialog .ui-dialog-content { position: relative; border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; }+.ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; }+.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { float: right; }+.ui-dialog .ui-dialog-buttonpane button { margin: .5em .4em .5em 0; cursor: pointer; }+.ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; }+.ui-draggable .ui-dialog-titlebar { cursor: move; }+/*!+ * jQuery UI Tabs 1.8.23+ *+ * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)+ * Dual licensed under the MIT or GPL Version 2 licenses.+ * http://jquery.org/license+ *+ * http://docs.jquery.com/UI/Tabs#theming+ */+.ui-tabs { position: relative; padding: .2em; zoom: 1; } /* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */+.ui-tabs .ui-tabs-nav { margin: 0; padding: .2em .2em 0; }+.ui-tabs .ui-tabs-nav li { list-style: none; float: left; position: relative; top: 1px; margin: 0 .2em 1px 0; border-bottom: 0 !important; padding: 0; white-space: nowrap; }+.ui-tabs .ui-tabs-nav li a { float: left; padding: .5em 1em; text-decoration: none; }+.ui-tabs .ui-tabs-nav li.ui-tabs-selected { margin-bottom: 0; padding-bottom: 1px; }+.ui-tabs .ui-tabs-nav li.ui-tabs-selected a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-state-processing a { cursor: text; }+.ui-tabs .ui-tabs-nav li a, .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */+.ui-tabs .ui-tabs-panel { display: block; border-width: 0; padding: 1em 1.4em; background: none; }+.ui-tabs .ui-tabs-hide { display: none !important; }
+ static/jquery-ui-1.8.23.custom.min.js view
@@ -0,0 +1,125 @@+/*! jQuery UI - v1.8.23 - 2012-08-15+* https://github.com/jquery/jquery-ui+* Includes: jquery.ui.core.js+* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */+(function(a,b){function c(b,c){var e=b.nodeName.toLowerCase();if("area"===e){var f=b.parentNode,g=f.name,h;return!b.href||!g||f.nodeName.toLowerCase()!=="map"?!1:(h=a("img[usemap=#"+g+"]")[0],!!h&&d(h))}return(/input|select|textarea|button|object/.test(e)?!b.disabled:"a"==e?b.href||c:c)&&d(b)}function d(b){return!a(b).parents().andSelf().filter(function(){return a.curCSS(this,"visibility")==="hidden"||a.expr.filters.hidden(this)}).length}a.ui=a.ui||{};if(a.ui.version)return;a.extend(a.ui,{version:"1.8.23",keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}}),a.fn.extend({propAttr:a.fn.prop||a.fn.attr,_focus:a.fn.focus,focus:function(b,c){return typeof b=="number"?this.each(function(){var d=this;setTimeout(function(){a(d).focus(),c&&c.call(d)},b)}):this._focus.apply(this,arguments)},scrollParent:function(){var b;return a.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?b=this.parents().filter(function(){return/(relative|absolute|fixed)/.test(a.curCSS(this,"position",1))&&/(auto|scroll)/.test(a.curCSS(this,"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1))}).eq(0):b=this.parents().filter(function(){return/(auto|scroll)/.test(a.curCSS(this,"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1))}).eq(0),/fixed/.test(this.css("position"))||!b.length?a(document):b},zIndex:function(c){if(c!==b)return this.css("zIndex",c);if(this.length){var d=a(this[0]),e,f;while(d.length&&d[0]!==document){e=d.css("position");if(e==="absolute"||e==="relative"||e==="fixed"){f=parseInt(d.css("zIndex"),10);if(!isNaN(f)&&f!==0)return f}d=d.parent()}}return 0},disableSelection:function(){return this.bind((a.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(a){a.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}}),a("<a>").outerWidth(1).jquery||a.each(["Width","Height"],function(c,d){function h(b,c,d,f){return a.each(e,function(){c-=parseFloat(a.curCSS(b,"padding"+this,!0))||0,d&&(c-=parseFloat(a.curCSS(b,"border"+this+"Width",!0))||0),f&&(c-=parseFloat(a.curCSS(b,"margin"+this,!0))||0)}),c}var e=d==="Width"?["Left","Right"]:["Top","Bottom"],f=d.toLowerCase(),g={innerWidth:a.fn.innerWidth,innerHeight:a.fn.innerHeight,outerWidth:a.fn.outerWidth,outerHeight:a.fn.outerHeight};a.fn["inner"+d]=function(c){return c===b?g["inner"+d].call(this):this.each(function(){a(this).css(f,h(this,c)+"px")})},a.fn["outer"+d]=function(b,c){return typeof b!="number"?g["outer"+d].call(this,b):this.each(function(){a(this).css(f,h(this,b,!0,c)+"px")})}}),a.extend(a.expr[":"],{data:a.expr.createPseudo?a.expr.createPseudo(function(b){return function(c){return!!a.data(c,b)}}):function(b,c,d){return!!a.data(b,d[3])},focusable:function(b){return c(b,!isNaN(a.attr(b,"tabindex")))},tabbable:function(b){var d=a.attr(b,"tabindex"),e=isNaN(d);return(e||d>=0)&&c(b,!e)}}),a(function(){var b=document.body,c=b.appendChild(c=document.createElement("div"));c.offsetHeight,a.extend(c.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0}),a.support.minHeight=c.offsetHeight===100,a.support.selectstart="onselectstart"in c,b.removeChild(c).style.display="none"}),a.curCSS||(a.curCSS=a.css),a.extend(a.ui,{plugin:{add:function(b,c,d){var e=a.ui[b].prototype;for(var f in d)e.plugins[f]=e.plugins[f]||[],e.plugins[f].push([c,d[f]])},call:function(a,b,c){var d=a.plugins[b];if(!d||!a.element[0].parentNode)return;for(var e=0;e<d.length;e++)a.options[d[e][0]]&&d[e][1].apply(a.element,c)}},contains:function(a,b){return document.compareDocumentPosition?a.compareDocumentPosition(b)&16:a!==b&&a.contains(b)},hasScroll:function(b,c){if(a(b).css("overflow")==="hidden")return!1;var d=c&&c==="left"?"scrollLeft":"scrollTop",e=!1;return b[d]>0?!0:(b[d]=1,e=b[d]>0,b[d]=0,e)},isOverAxis:function(a,b,c){return a>b&&a<b+c},isOver:function(b,c,d,e,f,g){return a.ui.isOverAxis(b,d,f)&&a.ui.isOverAxis(c,e,g)}})})(jQuery);;/*! jQuery UI - v1.8.23 - 2012-08-15+* https://github.com/jquery/jquery-ui+* Includes: jquery.ui.widget.js+* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */+(function(a,b){if(a.cleanData){var c=a.cleanData;a.cleanData=function(b){for(var d=0,e;(e=b[d])!=null;d++)try{a(e).triggerHandler("remove")}catch(f){}c(b)}}else{var d=a.fn.remove;a.fn.remove=function(b,c){return this.each(function(){return c||(!b||a.filter(b,[this]).length)&&a("*",this).add([this]).each(function(){try{a(this).triggerHandler("remove")}catch(b){}}),d.call(a(this),b,c)})}}a.widget=function(b,c,d){var e=b.split(".")[0],f;b=b.split(".")[1],f=e+"-"+b,d||(d=c,c=a.Widget),a.expr[":"][f]=function(c){return!!a.data(c,b)},a[e]=a[e]||{},a[e][b]=function(a,b){arguments.length&&this._createWidget(a,b)};var g=new c;g.options=a.extend(!0,{},g.options),a[e][b].prototype=a.extend(!0,g,{namespace:e,widgetName:b,widgetEventPrefix:a[e][b].prototype.widgetEventPrefix||b,widgetBaseClass:f},d),a.widget.bridge(b,a[e][b])},a.widget.bridge=function(c,d){a.fn[c]=function(e){var f=typeof e=="string",g=Array.prototype.slice.call(arguments,1),h=this;return e=!f&&g.length?a.extend.apply(null,[!0,e].concat(g)):e,f&&e.charAt(0)==="_"?h:(f?this.each(function(){var d=a.data(this,c),f=d&&a.isFunction(d[e])?d[e].apply(d,g):d;if(f!==d&&f!==b)return h=f,!1}):this.each(function(){var b=a.data(this,c);b?b.option(e||{})._init():a.data(this,c,new d(e,this))}),h)}},a.Widget=function(a,b){arguments.length&&this._createWidget(a,b)},a.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:!1},_createWidget:function(b,c){a.data(c,this.widgetName,this),this.element=a(c),this.options=a.extend(!0,{},this.options,this._getCreateOptions(),b);var d=this;this.element.bind("remove."+this.widgetName,function(){d.destroy()}),this._create(),this._trigger("create"),this._init()},_getCreateOptions:function(){return a.metadata&&a.metadata.get(this.element[0])[this.widgetName]},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName),this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+"-disabled "+"ui-state-disabled")},widget:function(){return this.element},option:function(c,d){var e=c;if(arguments.length===0)return a.extend({},this.options);if(typeof c=="string"){if(d===b)return this.options[c];e={},e[c]=d}return this._setOptions(e),this},_setOptions:function(b){var c=this;return a.each(b,function(a,b){c._setOption(a,b)}),this},_setOption:function(a,b){return this.options[a]=b,a==="disabled"&&this.widget()[b?"addClass":"removeClass"](this.widgetBaseClass+"-disabled"+" "+"ui-state-disabled").attr("aria-disabled",b),this},enable:function(){return this._setOption("disabled",!1)},disable:function(){return this._setOption("disabled",!0)},_trigger:function(b,c,d){var e,f,g=this.options[b];d=d||{},c=a.Event(c),c.type=(b===this.widgetEventPrefix?b:this.widgetEventPrefix+b).toLowerCase(),c.target=this.element[0],f=c.originalEvent;if(f)for(e in f)e in c||(c[e]=f[e]);return this.element.trigger(c,d),!(a.isFunction(g)&&g.call(this.element[0],c,d)===!1||c.isDefaultPrevented())}}})(jQuery);;/*! jQuery UI - v1.8.23 - 2012-08-15+* https://github.com/jquery/jquery-ui+* Includes: jquery.ui.mouse.js+* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */+(function(a,b){var c=!1;a(document).mouseup(function(a){c=!1}),a.widget("ui.mouse",{options:{cancel:":input,option",distance:1,delay:0},_mouseInit:function(){var b=this;this.element.bind("mousedown."+this.widgetName,function(a){return b._mouseDown(a)}).bind("click."+this.widgetName,function(c){if(!0===a.data(c.target,b.widgetName+".preventClickEvent"))return a.removeData(c.target,b.widgetName+".preventClickEvent"),c.stopImmediatePropagation(),!1}),this.started=!1},_mouseDestroy:function(){this.element.unbind("."+this.widgetName),this._mouseMoveDelegate&&a(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(b){if(c)return;this._mouseStarted&&this._mouseUp(b),this._mouseDownEvent=b;var d=this,e=b.which==1,f=typeof this.options.cancel=="string"&&b.target.nodeName?a(b.target).closest(this.options.cancel).length:!1;if(!e||f||!this._mouseCapture(b))return!0;this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){d.mouseDelayMet=!0},this.options.delay));if(this._mouseDistanceMet(b)&&this._mouseDelayMet(b)){this._mouseStarted=this._mouseStart(b)!==!1;if(!this._mouseStarted)return b.preventDefault(),!0}return!0===a.data(b.target,this.widgetName+".preventClickEvent")&&a.removeData(b.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(a){return d._mouseMove(a)},this._mouseUpDelegate=function(a){return d._mouseUp(a)},a(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate),b.preventDefault(),c=!0,!0},_mouseMove:function(b){return!a.browser.msie||document.documentMode>=9||!!b.button?this._mouseStarted?(this._mouseDrag(b),b.preventDefault()):(this._mouseDistanceMet(b)&&this._mouseDelayMet(b)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,b)!==!1,this._mouseStarted?this._mouseDrag(b):this._mouseUp(b)),!this._mouseStarted):this._mouseUp(b)},_mouseUp:function(b){return a(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,b.target==this._mouseDownEvent.target&&a.data(b.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(b)),!1},_mouseDistanceMet:function(a){return Math.max(Math.abs(this._mouseDownEvent.pageX-a.pageX),Math.abs(this._mouseDownEvent.pageY-a.pageY))>=this.options.distance},_mouseDelayMet:function(a){return this.mouseDelayMet},_mouseStart:function(a){},_mouseDrag:function(a){},_mouseStop:function(a){},_mouseCapture:function(a){return!0}})})(jQuery);;/*! jQuery UI - v1.8.23 - 2012-08-15+* https://github.com/jquery/jquery-ui+* Includes: jquery.ui.position.js+* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */+(function(a,b){a.ui=a.ui||{};var c=/left|center|right/,d=/top|center|bottom/,e="center",f={},g=a.fn.position,h=a.fn.offset;a.fn.position=function(b){if(!b||!b.of)return g.apply(this,arguments);b=a.extend({},b);var h=a(b.of),i=h[0],j=(b.collision||"flip").split(" "),k=b.offset?b.offset.split(" "):[0,0],l,m,n;return i.nodeType===9?(l=h.width(),m=h.height(),n={top:0,left:0}):i.setTimeout?(l=h.width(),m=h.height(),n={top:h.scrollTop(),left:h.scrollLeft()}):i.preventDefault?(b.at="left top",l=m=0,n={top:b.of.pageY,left:b.of.pageX}):(l=h.outerWidth(),m=h.outerHeight(),n=h.offset()),a.each(["my","at"],function(){var a=(b[this]||"").split(" ");a.length===1&&(a=c.test(a[0])?a.concat([e]):d.test(a[0])?[e].concat(a):[e,e]),a[0]=c.test(a[0])?a[0]:e,a[1]=d.test(a[1])?a[1]:e,b[this]=a}),j.length===1&&(j[1]=j[0]),k[0]=parseInt(k[0],10)||0,k.length===1&&(k[1]=k[0]),k[1]=parseInt(k[1],10)||0,b.at[0]==="right"?n.left+=l:b.at[0]===e&&(n.left+=l/2),b.at[1]==="bottom"?n.top+=m:b.at[1]===e&&(n.top+=m/2),n.left+=k[0],n.top+=k[1],this.each(function(){var c=a(this),d=c.outerWidth(),g=c.outerHeight(),h=parseInt(a.curCSS(this,"marginLeft",!0))||0,i=parseInt(a.curCSS(this,"marginTop",!0))||0,o=d+h+(parseInt(a.curCSS(this,"marginRight",!0))||0),p=g+i+(parseInt(a.curCSS(this,"marginBottom",!0))||0),q=a.extend({},n),r;b.my[0]==="right"?q.left-=d:b.my[0]===e&&(q.left-=d/2),b.my[1]==="bottom"?q.top-=g:b.my[1]===e&&(q.top-=g/2),f.fractions||(q.left=Math.round(q.left),q.top=Math.round(q.top)),r={left:q.left-h,top:q.top-i},a.each(["left","top"],function(c,e){a.ui.position[j[c]]&&a.ui.position[j[c]][e](q,{targetWidth:l,targetHeight:m,elemWidth:d,elemHeight:g,collisionPosition:r,collisionWidth:o,collisionHeight:p,offset:k,my:b.my,at:b.at})}),a.fn.bgiframe&&c.bgiframe(),c.offset(a.extend(q,{using:b.using}))})},a.ui.position={fit:{left:function(b,c){var d=a(window),e=c.collisionPosition.left+c.collisionWidth-d.width()-d.scrollLeft();b.left=e>0?b.left-e:Math.max(b.left-c.collisionPosition.left,b.left)},top:function(b,c){var d=a(window),e=c.collisionPosition.top+c.collisionHeight-d.height()-d.scrollTop();b.top=e>0?b.top-e:Math.max(b.top-c.collisionPosition.top,b.top)}},flip:{left:function(b,c){if(c.at[0]===e)return;var d=a(window),f=c.collisionPosition.left+c.collisionWidth-d.width()-d.scrollLeft(),g=c.my[0]==="left"?-c.elemWidth:c.my[0]==="right"?c.elemWidth:0,h=c.at[0]==="left"?c.targetWidth:-c.targetWidth,i=-2*c.offset[0];b.left+=c.collisionPosition.left<0?g+h+i:f>0?g+h+i:0},top:function(b,c){if(c.at[1]===e)return;var d=a(window),f=c.collisionPosition.top+c.collisionHeight-d.height()-d.scrollTop(),g=c.my[1]==="top"?-c.elemHeight:c.my[1]==="bottom"?c.elemHeight:0,h=c.at[1]==="top"?c.targetHeight:-c.targetHeight,i=-2*c.offset[1];b.top+=c.collisionPosition.top<0?g+h+i:f>0?g+h+i:0}}},a.offset.setOffset||(a.offset.setOffset=function(b,c){/static/.test(a.curCSS(b,"position"))&&(b.style.position="relative");var d=a(b),e=d.offset(),f=parseInt(a.curCSS(b,"top",!0),10)||0,g=parseInt(a.curCSS(b,"left",!0),10)||0,h={top:c.top-e.top+f,left:c.left-e.left+g};"using"in c?c.using.call(b,h):d.css(h)},a.fn.offset=function(b){var c=this[0];return!c||!c.ownerDocument?null:b?a.isFunction(b)?this.each(function(c){a(this).offset(b.call(this,c,a(this).offset()))}):this.each(function(){a.offset.setOffset(this,b)}):h.call(this)}),a.curCSS||(a.curCSS=a.css),function(){var b=document.getElementsByTagName("body")[0],c=document.createElement("div"),d,e,g,h,i;d=document.createElement(b?"div":"body"),g={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},b&&a.extend(g,{position:"absolute",left:"-1000px",top:"-1000px"});for(var j in g)d.style[j]=g[j];d.appendChild(c),e=b||document.documentElement,e.insertBefore(d,e.firstChild),c.style.cssText="position: absolute; left: 10.7432222px; top: 10.432325px; height: 30px; width: 201px;",h=a(c).offset(function(a,b){return b}).offset(),d.innerHTML="",e.removeChild(d),i=h.top+h.left+(b?2e3:0),f.fractions=i>21&&i<22}()})(jQuery);;/*! jQuery UI - v1.8.23 - 2012-08-15+* https://github.com/jquery/jquery-ui+* Includes: jquery.ui.draggable.js+* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */+(function(a,b){a.widget("ui.draggable",a.ui.mouse,{widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1},_create:function(){this.options.helper=="original"&&!/^(?:r|a|f)/.test(this.element.css("position"))&&(this.element[0].style.position="relative"),this.options.addClasses&&this.element.addClass("ui-draggable"),this.options.disabled&&this.element.addClass("ui-draggable-disabled"),this._mouseInit()},destroy:function(){if(!this.element.data("draggable"))return;return this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled"),this._mouseDestroy(),this},_mouseCapture:function(b){var c=this.options;return this.helper||c.disabled||a(b.target).is(".ui-resizable-handle")?!1:(this.handle=this._getHandle(b),this.handle?(c.iframeFix&&a(c.iframeFix===!0?"iframe":c.iframeFix).each(function(){a('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1e3}).css(a(this).offset()).appendTo("body")}),!0):!1)},_mouseStart:function(b){var c=this.options;return this.helper=this._createHelper(b),this.helper.addClass("ui-draggable-dragging"),this._cacheHelperProportions(),a.ui.ddmanager&&(a.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(),this.offset=this.positionAbs=this.element.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},a.extend(this.offset,{click:{left:b.pageX-this.offset.left,top:b.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.originalPosition=this.position=this._generatePosition(b),this.originalPageX=b.pageX,this.originalPageY=b.pageY,c.cursorAt&&this._adjustOffsetFromHelper(c.cursorAt),c.containment&&this._setContainment(),this._trigger("start",b)===!1?(this._clear(),!1):(this._cacheHelperProportions(),a.ui.ddmanager&&!c.dropBehaviour&&a.ui.ddmanager.prepareOffsets(this,b),this._mouseDrag(b,!0),a.ui.ddmanager&&a.ui.ddmanager.dragStart(this,b),!0)},_mouseDrag:function(b,c){this.position=this._generatePosition(b),this.positionAbs=this._convertPositionTo("absolute");if(!c){var d=this._uiHash();if(this._trigger("drag",b,d)===!1)return this._mouseUp({}),!1;this.position=d.position}if(!this.options.axis||this.options.axis!="y")this.helper[0].style.left=this.position.left+"px";if(!this.options.axis||this.options.axis!="x")this.helper[0].style.top=this.position.top+"px";return a.ui.ddmanager&&a.ui.ddmanager.drag(this,b),!1},_mouseStop:function(b){var c=!1;a.ui.ddmanager&&!this.options.dropBehaviour&&(c=a.ui.ddmanager.drop(this,b)),this.dropped&&(c=this.dropped,this.dropped=!1);var d=this.element[0],e=!1;while(d&&(d=d.parentNode))d==document&&(e=!0);if(!e&&this.options.helper==="original")return!1;if(this.options.revert=="invalid"&&!c||this.options.revert=="valid"&&c||this.options.revert===!0||a.isFunction(this.options.revert)&&this.options.revert.call(this.element,c)){var f=this;a(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){f._trigger("stop",b)!==!1&&f._clear()})}else this._trigger("stop",b)!==!1&&this._clear();return!1},_mouseUp:function(b){return this.options.iframeFix===!0&&a("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)}),a.ui.ddmanager&&a.ui.ddmanager.dragStop(this,b),a.ui.mouse.prototype._mouseUp.call(this,b)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear(),this},_getHandle:function(b){var c=!this.options.handle||!a(this.options.handle,this.element).length?!0:!1;return a(this.options.handle,this.element).find("*").andSelf().each(function(){this==b.target&&(c=!0)}),c},_createHelper:function(b){var c=this.options,d=a.isFunction(c.helper)?a(c.helper.apply(this.element[0],[b])):c.helper=="clone"?this.element.clone().removeAttr("id"):this.element;return d.parents("body").length||d.appendTo(c.appendTo=="parent"?this.element[0].parentNode:c.appendTo),d[0]!=this.element[0]&&!/(fixed|absolute)/.test(d.css("position"))&&d.css("position","absolute"),d},_adjustOffsetFromHelper:function(b){typeof b=="string"&&(b=b.split(" ")),a.isArray(b)&&(b={left:+b[0],top:+b[1]||0}),"left"in b&&(this.offset.click.left=b.left+this.margins.left),"right"in b&&(this.offset.click.left=this.helperProportions.width-b.right+this.margins.left),"top"in b&&(this.offset.click.top=b.top+this.margins.top),"bottom"in b&&(this.offset.click.top=this.helperProportions.height-b.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var b=this.offsetParent.offset();this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0])&&(b.left+=this.scrollParent.scrollLeft(),b.top+=this.scrollParent.scrollTop());if(this.offsetParent[0]==document.body||this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&a.browser.msie)b={top:0,left:0};return{top:b.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:b.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var a=this.element.position();return{top:a.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:a.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var b=this.options;b.containment=="parent"&&(b.containment=this.helper[0].parentNode);if(b.containment=="document"||b.containment=="window")this.containment=[b.containment=="document"?0:a(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,b.containment=="document"?0:a(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,(b.containment=="document"?0:a(window).scrollLeft())+a(b.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(b.containment=="document"?0:a(window).scrollTop())+(a(b.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!/^(document|window|parent)$/.test(b.containment)&&b.containment.constructor!=Array){var c=a(b.containment),d=c[0];if(!d)return;var e=c.offset(),f=a(d).css("overflow")!="hidden";this.containment=[(parseInt(a(d).css("borderLeftWidth"),10)||0)+(parseInt(a(d).css("paddingLeft"),10)||0),(parseInt(a(d).css("borderTopWidth"),10)||0)+(parseInt(a(d).css("paddingTop"),10)||0),(f?Math.max(d.scrollWidth,d.offsetWidth):d.offsetWidth)-(parseInt(a(d).css("borderLeftWidth"),10)||0)-(parseInt(a(d).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(f?Math.max(d.scrollHeight,d.offsetHeight):d.offsetHeight)-(parseInt(a(d).css("borderTopWidth"),10)||0)-(parseInt(a(d).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relative_container=c}else b.containment.constructor==Array&&(this.containment=b.containment)},_convertPositionTo:function(b,c){c||(c=this.position);var d=b=="absolute"?1:-1,e=this.options,f=this.cssPosition=="absolute"&&(this.scrollParent[0]==document||!a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,g=/(html|body)/i.test(f[0].tagName);return{top:c.top+this.offset.relative.top*d+this.offset.parent.top*d-(a.browser.safari&&a.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():g?0:f.scrollTop())*d),left:c.left+this.offset.relative.left*d+this.offset.parent.left*d-(a.browser.safari&&a.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():g?0:f.scrollLeft())*d)}},_generatePosition:function(b){var c=this.options,d=this.cssPosition=="absolute"&&(this.scrollParent[0]==document||!a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,e=/(html|body)/i.test(d[0].tagName),f=b.pageX,g=b.pageY;if(this.originalPosition){var h;if(this.containment){if(this.relative_container){var i=this.relative_container.offset();h=[this.containment[0]+i.left,this.containment[1]+i.top,this.containment[2]+i.left,this.containment[3]+i.top]}else h=this.containment;b.pageX-this.offset.click.left<h[0]&&(f=h[0]+this.offset.click.left),b.pageY-this.offset.click.top<h[1]&&(g=h[1]+this.offset.click.top),b.pageX-this.offset.click.left>h[2]&&(f=h[2]+this.offset.click.left),b.pageY-this.offset.click.top>h[3]&&(g=h[3]+this.offset.click.top)}if(c.grid){var j=c.grid[1]?this.originalPageY+Math.round((g-this.originalPageY)/c.grid[1])*c.grid[1]:this.originalPageY;g=h?j-this.offset.click.top<h[1]||j-this.offset.click.top>h[3]?j-this.offset.click.top<h[1]?j+c.grid[1]:j-c.grid[1]:j:j;var k=c.grid[0]?this.originalPageX+Math.round((f-this.originalPageX)/c.grid[0])*c.grid[0]:this.originalPageX;f=h?k-this.offset.click.left<h[0]||k-this.offset.click.left>h[2]?k-this.offset.click.left<h[0]?k+c.grid[0]:k-c.grid[0]:k:k}}return{top:g-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(a.browser.safari&&a.browser.version<526&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollTop():e?0:d.scrollTop()),left:f-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(a.browser.safari&&a.browser.version<526&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():e?0:d.scrollLeft())}},_clear:function(){this.helper.removeClass("ui-draggable-dragging"),this.helper[0]!=this.element[0]&&!this.cancelHelperRemoval&&this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1},_trigger:function(b,c,d){return d=d||this._uiHash(),a.ui.plugin.call(this,b,[c,d]),b=="drag"&&(this.positionAbs=this._convertPositionTo("absolute")),a.Widget.prototype._trigger.call(this,b,c,d)},plugins:{},_uiHash:function(a){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),a.extend(a.ui.draggable,{version:"1.8.23"}),a.ui.plugin.add("draggable","connectToSortable",{start:function(b,c){var d=a(this).data("draggable"),e=d.options,f=a.extend({},c,{item:d.element});d.sortables=[],a(e.connectToSortable).each(function(){var c=a.data(this,"sortable");c&&!c.options.disabled&&(d.sortables.push({instance:c,shouldRevert:c.options.revert}),c.refreshPositions(),c._trigger("activate",b,f))})},stop:function(b,c){var d=a(this).data("draggable"),e=a.extend({},c,{item:d.element});a.each(d.sortables,function(){this.instance.isOver?(this.instance.isOver=0,d.cancelHelperRemoval=!0,this.instance.cancelHelperRemoval=!1,this.shouldRevert&&(this.instance.options.revert=!0),this.instance._mouseStop(b),this.instance.options.helper=this.instance.options._helper,d.options.helper=="original"&&this.instance.currentItem.css({top:"auto",left:"auto"})):(this.instance.cancelHelperRemoval=!1,this.instance._trigger("deactivate",b,e))})},drag:function(b,c){var d=a(this).data("draggable"),e=this,f=function(b){var c=this.offset.click.top,d=this.offset.click.left,e=this.positionAbs.top,f=this.positionAbs.left,g=b.height,h=b.width,i=b.top,j=b.left;return a.ui.isOver(e+c,f+d,i,j,g,h)};a.each(d.sortables,function(f){this.instance.positionAbs=d.positionAbs,this.instance.helperProportions=d.helperProportions,this.instance.offset.click=d.offset.click,this.instance._intersectsWith(this.instance.containerCache)?(this.instance.isOver||(this.instance.isOver=1,this.instance.currentItem=a(e).clone().removeAttr("id").appendTo(this.instance.element).data("sortable-item",!0),this.instance.options._helper=this.instance.options.helper,this.instance.options.helper=function(){return c.helper[0]},b.target=this.instance.currentItem[0],this.instance._mouseCapture(b,!0),this.instance._mouseStart(b,!0,!0),this.instance.offset.click.top=d.offset.click.top,this.instance.offset.click.left=d.offset.click.left,this.instance.offset.parent.left-=d.offset.parent.left-this.instance.offset.parent.left,this.instance.offset.parent.top-=d.offset.parent.top-this.instance.offset.parent.top,d._trigger("toSortable",b),d.dropped=this.instance.element,d.currentItem=d.element,this.instance.fromOutside=d),this.instance.currentItem&&this.instance._mouseDrag(b)):this.instance.isOver&&(this.instance.isOver=0,this.instance.cancelHelperRemoval=!0,this.instance.options.revert=!1,this.instance._trigger("out",b,this.instance._uiHash(this.instance)),this.instance._mouseStop(b,!0),this.instance.options.helper=this.instance.options._helper,this.instance.currentItem.remove(),this.instance.placeholder&&this.instance.placeholder.remove(),d._trigger("fromSortable",b),d.dropped=!1)})}}),a.ui.plugin.add("draggable","cursor",{start:function(b,c){var d=a("body"),e=a(this).data("draggable").options;d.css("cursor")&&(e._cursor=d.css("cursor")),d.css("cursor",e.cursor)},stop:function(b,c){var d=a(this).data("draggable").options;d._cursor&&a("body").css("cursor",d._cursor)}}),a.ui.plugin.add("draggable","opacity",{start:function(b,c){var d=a(c.helper),e=a(this).data("draggable").options;d.css("opacity")&&(e._opacity=d.css("opacity")),d.css("opacity",e.opacity)},stop:function(b,c){var d=a(this).data("draggable").options;d._opacity&&a(c.helper).css("opacity",d._opacity)}}),a.ui.plugin.add("draggable","scroll",{start:function(b,c){var d=a(this).data("draggable");d.scrollParent[0]!=document&&d.scrollParent[0].tagName!="HTML"&&(d.overflowOffset=d.scrollParent.offset())},drag:function(b,c){var d=a(this).data("draggable"),e=d.options,f=!1;if(d.scrollParent[0]!=document&&d.scrollParent[0].tagName!="HTML"){if(!e.axis||e.axis!="x")d.overflowOffset.top+d.scrollParent[0].offsetHeight-b.pageY<e.scrollSensitivity?d.scrollParent[0].scrollTop=f=d.scrollParent[0].scrollTop+e.scrollSpeed:b.pageY-d.overflowOffset.top<e.scrollSensitivity&&(d.scrollParent[0].scrollTop=f=d.scrollParent[0].scrollTop-e.scrollSpeed);if(!e.axis||e.axis!="y")d.overflowOffset.left+d.scrollParent[0].offsetWidth-b.pageX<e.scrollSensitivity?d.scrollParent[0].scrollLeft=f=d.scrollParent[0].scrollLeft+e.scrollSpeed:b.pageX-d.overflowOffset.left<e.scrollSensitivity&&(d.scrollParent[0].scrollLeft=f=d.scrollParent[0].scrollLeft-e.scrollSpeed)}else{if(!e.axis||e.axis!="x")b.pageY-a(document).scrollTop()<e.scrollSensitivity?f=a(document).scrollTop(a(document).scrollTop()-e.scrollSpeed):a(window).height()-(b.pageY-a(document).scrollTop())<e.scrollSensitivity&&(f=a(document).scrollTop(a(document).scrollTop()+e.scrollSpeed));if(!e.axis||e.axis!="y")b.pageX-a(document).scrollLeft()<e.scrollSensitivity?f=a(document).scrollLeft(a(document).scrollLeft()-e.scrollSpeed):a(window).width()-(b.pageX-a(document).scrollLeft())<e.scrollSensitivity&&(f=a(document).scrollLeft(a(document).scrollLeft()+e.scrollSpeed))}f!==!1&&a.ui.ddmanager&&!e.dropBehaviour&&a.ui.ddmanager.prepareOffsets(d,b)}}),a.ui.plugin.add("draggable","snap",{start:function(b,c){var d=a(this).data("draggable"),e=d.options;d.snapElements=[],a(e.snap.constructor!=String?e.snap.items||":data(draggable)":e.snap).each(function(){var b=a(this),c=b.offset();this!=d.element[0]&&d.snapElements.push({item:this,width:b.outerWidth(),height:b.outerHeight(),top:c.top,left:c.left})})},drag:function(b,c){var d=a(this).data("draggable"),e=d.options,f=e.snapTolerance,g=c.offset.left,h=g+d.helperProportions.width,i=c.offset.top,j=i+d.helperProportions.height;for(var k=d.snapElements.length-1;k>=0;k--){var l=d.snapElements[k].left,m=l+d.snapElements[k].width,n=d.snapElements[k].top,o=n+d.snapElements[k].height;if(!(l-f<g&&g<m+f&&n-f<i&&i<o+f||l-f<g&&g<m+f&&n-f<j&&j<o+f||l-f<h&&h<m+f&&n-f<i&&i<o+f||l-f<h&&h<m+f&&n-f<j&&j<o+f)){d.snapElements[k].snapping&&d.options.snap.release&&d.options.snap.release.call(d.element,b,a.extend(d._uiHash(),{snapItem:d.snapElements[k].item})),d.snapElements[k].snapping=!1;continue}if(e.snapMode!="inner"){var p=Math.abs(n-j)<=f,q=Math.abs(o-i)<=f,r=Math.abs(l-h)<=f,s=Math.abs(m-g)<=f;p&&(c.position.top=d._convertPositionTo("relative",{top:n-d.helperProportions.height,left:0}).top-d.margins.top),q&&(c.position.top=d._convertPositionTo("relative",{top:o,left:0}).top-d.margins.top),r&&(c.position.left=d._convertPositionTo("relative",{top:0,left:l-d.helperProportions.width}).left-d.margins.left),s&&(c.position.left=d._convertPositionTo("relative",{top:0,left:m}).left-d.margins.left)}var t=p||q||r||s;if(e.snapMode!="outer"){var p=Math.abs(n-i)<=f,q=Math.abs(o-j)<=f,r=Math.abs(l-g)<=f,s=Math.abs(m-h)<=f;p&&(c.position.top=d._convertPositionTo("relative",{top:n,left:0}).top-d.margins.top),q&&(c.position.top=d._convertPositionTo("relative",{top:o-d.helperProportions.height,left:0}).top-d.margins.top),r&&(c.position.left=d._convertPositionTo("relative",{top:0,left:l}).left-d.margins.left),s&&(c.position.left=d._convertPositionTo("relative",{top:0,left:m-d.helperProportions.width}).left-d.margins.left)}!d.snapElements[k].snapping&&(p||q||r||s||t)&&d.options.snap.snap&&d.options.snap.snap.call(d.element,b,a.extend(d._uiHash(),{snapItem:d.snapElements[k].item})),d.snapElements[k].snapping=p||q||r||s||t}}}),a.ui.plugin.add("draggable","stack",{start:function(b,c){var d=a(this).data("draggable").options,e=a.makeArray(a(d.stack)).sort(function(b,c){return(parseInt(a(b).css("zIndex"),10)||0)-(parseInt(a(c).css("zIndex"),10)||0)});if(!e.length)return;var f=parseInt(e[0].style.zIndex)||0;a(e).each(function(a){this.style.zIndex=f+a}),this[0].style.zIndex=f+e.length}}),a.ui.plugin.add("draggable","zIndex",{start:function(b,c){var d=a(c.helper),e=a(this).data("draggable").options;d.css("zIndex")&&(e._zIndex=d.css("zIndex")),d.css("zIndex",e.zIndex)},stop:function(b,c){var d=a(this).data("draggable").options;d._zIndex&&a(c.helper).css("zIndex",d._zIndex)}})})(jQuery);;/*! jQuery UI - v1.8.23 - 2012-08-15+* https://github.com/jquery/jquery-ui+* Includes: jquery.ui.droppable.js+* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */+(function(a,b){a.widget("ui.droppable",{widgetEventPrefix:"drop",options:{accept:"*",activeClass:!1,addClasses:!0,greedy:!1,hoverClass:!1,scope:"default",tolerance:"intersect"},_create:function(){var b=this.options,c=b.accept;this.isover=0,this.isout=1,this.accept=a.isFunction(c)?c:function(a){return a.is(c)},this.proportions={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight},a.ui.ddmanager.droppables[b.scope]=a.ui.ddmanager.droppables[b.scope]||[],a.ui.ddmanager.droppables[b.scope].push(this),b.addClasses&&this.element.addClass("ui-droppable")},destroy:function(){var b=a.ui.ddmanager.droppables[this.options.scope];for(var c=0;c<b.length;c++)b[c]==this&&b.splice(c,1);return this.element.removeClass("ui-droppable ui-droppable-disabled").removeData("droppable").unbind(".droppable"),this},_setOption:function(b,c){b=="accept"&&(this.accept=a.isFunction(c)?c:function(a){return a.is(c)}),a.Widget.prototype._setOption.apply(this,arguments)},_activate:function(b){var c=a.ui.ddmanager.current;this.options.activeClass&&this.element.addClass(this.options.activeClass),c&&this._trigger("activate",b,this.ui(c))},_deactivate:function(b){var c=a.ui.ddmanager.current;this.options.activeClass&&this.element.removeClass(this.options.activeClass),c&&this._trigger("deactivate",b,this.ui(c))},_over:function(b){var c=a.ui.ddmanager.current;if(!c||(c.currentItem||c.element)[0]==this.element[0])return;this.accept.call(this.element[0],c.currentItem||c.element)&&(this.options.hoverClass&&this.element.addClass(this.options.hoverClass),this._trigger("over",b,this.ui(c)))},_out:function(b){var c=a.ui.ddmanager.current;if(!c||(c.currentItem||c.element)[0]==this.element[0])return;this.accept.call(this.element[0],c.currentItem||c.element)&&(this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("out",b,this.ui(c)))},_drop:function(b,c){var d=c||a.ui.ddmanager.current;if(!d||(d.currentItem||d.element)[0]==this.element[0])return!1;var e=!1;return this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function(){var b=a.data(this,"droppable");if(b.options.greedy&&!b.options.disabled&&b.options.scope==d.options.scope&&b.accept.call(b.element[0],d.currentItem||d.element)&&a.ui.intersect(d,a.extend(b,{offset:b.element.offset()}),b.options.tolerance))return e=!0,!1}),e?!1:this.accept.call(this.element[0],d.currentItem||d.element)?(this.options.activeClass&&this.element.removeClass(this.options.activeClass),this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("drop",b,this.ui(d)),this.element):!1},ui:function(a){return{draggable:a.currentItem||a.element,helper:a.helper,position:a.position,offset:a.positionAbs}}}),a.extend(a.ui.droppable,{version:"1.8.23"}),a.ui.intersect=function(b,c,d){if(!c.offset)return!1;var e=(b.positionAbs||b.position.absolute).left,f=e+b.helperProportions.width,g=(b.positionAbs||b.position.absolute).top,h=g+b.helperProportions.height,i=c.offset.left,j=i+c.proportions.width,k=c.offset.top,l=k+c.proportions.height;switch(d){case"fit":return i<=e&&f<=j&&k<=g&&h<=l;case"intersect":return i<e+b.helperProportions.width/2&&f-b.helperProportions.width/2<j&&k<g+b.helperProportions.height/2&&h-b.helperProportions.height/2<l;case"pointer":var m=(b.positionAbs||b.position.absolute).left+(b.clickOffset||b.offset.click).left,n=(b.positionAbs||b.position.absolute).top+(b.clickOffset||b.offset.click).top,o=a.ui.isOver(n,m,k,i,c.proportions.height,c.proportions.width);return o;case"touch":return(g>=k&&g<=l||h>=k&&h<=l||g<k&&h>l)&&(e>=i&&e<=j||f>=i&&f<=j||e<i&&f>j);default:return!1}},a.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(b,c){var d=a.ui.ddmanager.droppables[b.options.scope]||[],e=c?c.type:null,f=(b.currentItem||b.element).find(":data(droppable)").andSelf();g:for(var h=0;h<d.length;h++){if(d[h].options.disabled||b&&!d[h].accept.call(d[h].element[0],b.currentItem||b.element))continue;for(var i=0;i<f.length;i++)if(f[i]==d[h].element[0]){d[h].proportions.height=0;continue g}d[h].visible=d[h].element.css("display")!="none";if(!d[h].visible)continue;e=="mousedown"&&d[h]._activate.call(d[h],c),d[h].offset=d[h].element.offset(),d[h].proportions={width:d[h].element[0].offsetWidth,height:d[h].element[0].offsetHeight}}},drop:function(b,c){var d=!1;return a.each(a.ui.ddmanager.droppables[b.options.scope]||[],function(){if(!this.options)return;!this.options.disabled&&this.visible&&a.ui.intersect(b,this,this.options.tolerance)&&(d=this._drop.call(this,c)||d),!this.options.disabled&&this.visible&&this.accept.call(this.element[0],b.currentItem||b.element)&&(this.isout=1,this.isover=0,this._deactivate.call(this,c))}),d},dragStart:function(b,c){b.element.parents(":not(body,html)").bind("scroll.droppable",function(){b.options.refreshPositions||a.ui.ddmanager.prepareOffsets(b,c)})},drag:function(b,c){b.options.refreshPositions&&a.ui.ddmanager.prepareOffsets(b,c),a.each(a.ui.ddmanager.droppables[b.options.scope]||[],function(){if(this.options.disabled||this.greedyChild||!this.visible)return;var d=a.ui.intersect(b,this,this.options.tolerance),e=!d&&this.isover==1?"isout":d&&this.isover==0?"isover":null;if(!e)return;var f;if(this.options.greedy){var g=this.element.parents(":data(droppable):eq(0)");g.length&&(f=a.data(g[0],"droppable"),f.greedyChild=e=="isover"?1:0)}f&&e=="isover"&&(f.isover=0,f.isout=1,f._out.call(f,c)),this[e]=1,this[e=="isout"?"isover":"isout"]=0,this[e=="isover"?"_over":"_out"].call(this,c),f&&e=="isout"&&(f.isout=0,f.isover=1,f._over.call(f,c))})},dragStop:function(b,c){b.element.parents(":not(body,html)").unbind("scroll.droppable"),b.options.refreshPositions||a.ui.ddmanager.prepareOffsets(b,c)}}})(jQuery);;/*! jQuery UI - v1.8.23 - 2012-08-15+* https://github.com/jquery/jquery-ui+* Includes: jquery.ui.resizable.js+* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */+(function(a,b){a.widget("ui.resizable",a.ui.mouse,{widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:1e3},_create:function(){var b=this,c=this.options;this.element.addClass("ui-resizable"),a.extend(this,{_aspectRatio:!!c.aspectRatio,aspectRatio:c.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:c.helper||c.ghost||c.animate?c.helper||"ui-resizable-helper":null}),this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)&&(this.element.wrap(a('<div class="ui-wrapper" style="overflow: hidden;"></div>').css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})),this.element=this.element.parent().data("resizable",this.element.data("resizable")),this.elementIsWrapper=!0,this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")}),this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0}),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css({margin:this.originalElement.css("margin")}),this._proportionallyResize()),this.handles=c.handles||(a(".ui-resizable-handle",this.element).length?{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}:"e,s,se");if(this.handles.constructor==String){this.handles=="all"&&(this.handles="n,e,s,w,se,sw,ne,nw");var d=this.handles.split(",");this.handles={};for(var e=0;e<d.length;e++){var f=a.trim(d[e]),g="ui-resizable-"+f,h=a('<div class="ui-resizable-handle '+g+'"></div>');h.css({zIndex:c.zIndex}),"se"==f&&h.addClass("ui-icon ui-icon-gripsmall-diagonal-se"),this.handles[f]=".ui-resizable-"+f,this.element.append(h)}}this._renderAxis=function(b){b=b||this.element;for(var c in this.handles){this.handles[c].constructor==String&&(this.handles[c]=a(this.handles[c],this.element).show());if(this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)){var d=a(this.handles[c],this.element),e=0;e=/sw|ne|nw|se|n|s/.test(c)?d.outerHeight():d.outerWidth();var f=["padding",/ne|nw|n/.test(c)?"Top":/se|sw|s/.test(c)?"Bottom":/^e$/.test(c)?"Right":"Left"].join("");b.css(f,e),this._proportionallyResize()}if(!a(this.handles[c]).length)continue}},this._renderAxis(this.element),this._handles=a(".ui-resizable-handle",this.element).disableSelection(),this._handles.mouseover(function(){if(!b.resizing){if(this.className)var a=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);b.axis=a&&a[1]?a[1]:"se"}}),c.autoHide&&(this._handles.hide(),a(this.element).addClass("ui-resizable-autohide").hover(function(){if(c.disabled)return;a(this).removeClass("ui-resizable-autohide"),b._handles.show()},function(){if(c.disabled)return;b.resizing||(a(this).addClass("ui-resizable-autohide"),b._handles.hide())})),this._mouseInit()},destroy:function(){this._mouseDestroy();var b=function(b){a(b).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};if(this.elementIsWrapper){b(this.element);var c=this.element;c.after(this.originalElement.css({position:c.css("position"),width:c.outerWidth(),height:c.outerHeight(),top:c.css("top"),left:c.css("left")})).remove()}return this.originalElement.css("resize",this.originalResizeStyle),b(this.originalElement),this},_mouseCapture:function(b){var c=!1;for(var d in this.handles)a(this.handles[d])[0]==b.target&&(c=!0);return!this.options.disabled&&c},_mouseStart:function(b){var d=this.options,e=this.element.position(),f=this.element;this.resizing=!0,this.documentScroll={top:a(document).scrollTop(),left:a(document).scrollLeft()},(f.is(".ui-draggable")||/absolute/.test(f.css("position")))&&f.css({position:"absolute",top:e.top,left:e.left}),this._renderProxy();var g=c(this.helper.css("left")),h=c(this.helper.css("top"));d.containment&&(g+=a(d.containment).scrollLeft()||0,h+=a(d.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:g,top:h},this.size=this._helper?{width:f.outerWidth(),height:f.outerHeight()}:{width:f.width(),height:f.height()},this.originalSize=this._helper?{width:f.outerWidth(),height:f.outerHeight()}:{width:f.width(),height:f.height()},this.originalPosition={left:g,top:h},this.sizeDiff={width:f.outerWidth()-f.width(),height:f.outerHeight()-f.height()},this.originalMousePosition={left:b.pageX,top:b.pageY},this.aspectRatio=typeof d.aspectRatio=="number"?d.aspectRatio:this.originalSize.width/this.originalSize.height||1;var i=a(".ui-resizable-"+this.axis).css("cursor");return a("body").css("cursor",i=="auto"?this.axis+"-resize":i),f.addClass("ui-resizable-resizing"),this._propagate("start",b),!0},_mouseDrag:function(b){var c=this.helper,d=this.options,e={},f=this,g=this.originalMousePosition,h=this.axis,i=b.pageX-g.left||0,j=b.pageY-g.top||0,k=this._change[h];if(!k)return!1;var l=k.apply(this,[b,i,j]),m=a.browser.msie&&a.browser.version<7,n=this.sizeDiff;this._updateVirtualBoundaries(b.shiftKey);if(this._aspectRatio||b.shiftKey)l=this._updateRatio(l,b);return l=this._respectSize(l,b),this._propagate("resize",b),c.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"}),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),this._updateCache(l),this._trigger("resize",b,this.ui()),!1},_mouseStop:function(b){this.resizing=!1;var c=this.options,d=this;if(this._helper){var e=this._proportionallyResizeElements,f=e.length&&/textarea/i.test(e[0].nodeName),g=f&&a.ui.hasScroll(e[0],"left")?0:d.sizeDiff.height,h=f?0:d.sizeDiff.width,i={width:d.helper.width()-h,height:d.helper.height()-g},j=parseInt(d.element.css("left"),10)+(d.position.left-d.originalPosition.left)||null,k=parseInt(d.element.css("top"),10)+(d.position.top-d.originalPosition.top)||null;c.animate||this.element.css(a.extend(i,{top:k,left:j})),d.helper.height(d.size.height),d.helper.width(d.size.width),this._helper&&!c.animate&&this._proportionallyResize()}return a("body").css("cursor","auto"),this.element.removeClass("ui-resizable-resizing"),this._propagate("stop",b),this._helper&&this.helper.remove(),!1},_updateVirtualBoundaries:function(a){var b=this.options,c,e,f,g,h;h={minWidth:d(b.minWidth)?b.minWidth:0,maxWidth:d(b.maxWidth)?b.maxWidth:Infinity,minHeight:d(b.minHeight)?b.minHeight:0,maxHeight:d(b.maxHeight)?b.maxHeight:Infinity};if(this._aspectRatio||a)c=h.minHeight*this.aspectRatio,f=h.minWidth/this.aspectRatio,e=h.maxHeight*this.aspectRatio,g=h.maxWidth/this.aspectRatio,c>h.minWidth&&(h.minWidth=c),f>h.minHeight&&(h.minHeight=f),e<h.maxWidth&&(h.maxWidth=e),g<h.maxHeight&&(h.maxHeight=g);this._vBoundaries=h},_updateCache:function(a){var b=this.options;this.offset=this.helper.offset(),d(a.left)&&(this.position.left=a.left),d(a.top)&&(this.position.top=a.top),d(a.height)&&(this.size.height=a.height),d(a.width)&&(this.size.width=a.width)},_updateRatio:function(a,b){var c=this.options,e=this.position,f=this.size,g=this.axis;return d(a.height)?a.width=a.height*this.aspectRatio:d(a.width)&&(a.height=a.width/this.aspectRatio),g=="sw"&&(a.left=e.left+(f.width-a.width),a.top=null),g=="nw"&&(a.top=e.top+(f.height-a.height),a.left=e.left+(f.width-a.width)),a},_respectSize:function(a,b){var c=this.helper,e=this._vBoundaries,f=this._aspectRatio||b.shiftKey,g=this.axis,h=d(a.width)&&e.maxWidth&&e.maxWidth<a.width,i=d(a.height)&&e.maxHeight&&e.maxHeight<a.height,j=d(a.width)&&e.minWidth&&e.minWidth>a.width,k=d(a.height)&&e.minHeight&&e.minHeight>a.height;j&&(a.width=e.minWidth),k&&(a.height=e.minHeight),h&&(a.width=e.maxWidth),i&&(a.height=e.maxHeight);var l=this.originalPosition.left+this.originalSize.width,m=this.position.top+this.size.height,n=/sw|nw|w/.test(g),o=/nw|ne|n/.test(g);j&&n&&(a.left=l-e.minWidth),h&&n&&(a.left=l-e.maxWidth),k&&o&&(a.top=m-e.minHeight),i&&o&&(a.top=m-e.maxHeight);var p=!a.width&&!a.height;return p&&!a.left&&a.top?a.top=null:p&&!a.top&&a.left&&(a.left=null),a},_proportionallyResize:function(){var b=this.options;if(!this._proportionallyResizeElements.length)return;var c=this.helper||this.element;for(var d=0;d<this._proportionallyResizeElements.length;d++){var e=this._proportionallyResizeElements[d];if(!this.borderDif){var f=[e.css("borderTopWidth"),e.css("borderRightWidth"),e.css("borderBottomWidth"),e.css("borderLeftWidth")],g=[e.css("paddingTop"),e.css("paddingRight"),e.css("paddingBottom"),e.css("paddingLeft")];this.borderDif=a.map(f,function(a,b){var c=parseInt(a,10)||0,d=parseInt(g[b],10)||0;return c+d})}if(!a.browser.msie||!a(c).is(":hidden")&&!a(c).parents(":hidden").length)e.css({height:c.height()-this.borderDif[0]-this.borderDif[2]||0,width:c.width()-this.borderDif[1]-this.borderDif[3]||0});else continue}},_renderProxy:function(){var b=this.element,c=this.options;this.elementOffset=b.offset();if(this._helper){this.helper=this.helper||a('<div style="overflow:hidden;"></div>');var d=a.browser.msie&&a.browser.version<7,e=d?1:0,f=d?2:-1;this.helper.addClass(this._helper).css({width:this.element.outerWidth()+f,height:this.element.outerHeight()+f,position:"absolute",left:this.elementOffset.left-e+"px",top:this.elementOffset.top-e+"px",zIndex:++c.zIndex}),this.helper.appendTo("body").disableSelection()}else this.helper=this.element},_change:{e:function(a,b,c){return{width:this.originalSize.width+b}},w:function(a,b,c){var d=this.options,e=this.originalSize,f=this.originalPosition;return{left:f.left+b,width:e.width-b}},n:function(a,b,c){var d=this.options,e=this.originalSize,f=this.originalPosition;return{top:f.top+c,height:e.height-c}},s:function(a,b,c){return{height:this.originalSize.height+c}},se:function(b,c,d){return a.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[b,c,d]))},sw:function(b,c,d){return a.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[b,c,d]))},ne:function(b,c,d){return a.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[b,c,d]))},nw:function(b,c,d){return a.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[b,c,d]))}},_propagate:function(b,c){a.ui.plugin.call(this,b,[c,this.ui()]),b!="resize"&&this._trigger(b,c,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}),a.extend(a.ui.resizable,{version:"1.8.23"}),a.ui.plugin.add("resizable","alsoResize",{start:function(b,c){var d=a(this).data("resizable"),e=d.options,f=function(b){a(b).each(function(){var b=a(this);b.data("resizable-alsoresize",{width:parseInt(b.width(),10),height:parseInt(b.height(),10),left:parseInt(b.css("left"),10),top:parseInt(b.css("top"),10)})})};typeof e.alsoResize=="object"&&!e.alsoResize.parentNode?e.alsoResize.length?(e.alsoResize=e.alsoResize[0],f(e.alsoResize)):a.each(e.alsoResize,function(a){f(a)}):f(e.alsoResize)},resize:function(b,c){var d=a(this).data("resizable"),e=d.options,f=d.originalSize,g=d.originalPosition,h={height:d.size.height-f.height||0,width:d.size.width-f.width||0,top:d.position.top-g.top||0,left:d.position.left-g.left||0},i=function(b,d){a(b).each(function(){var b=a(this),e=a(this).data("resizable-alsoresize"),f={},g=d&&d.length?d:b.parents(c.originalElement[0]).length?["width","height"]:["width","height","top","left"];a.each(g,function(a,b){var c=(e[b]||0)+(h[b]||0);c&&c>=0&&(f[b]=c||null)}),b.css(f)})};typeof e.alsoResize=="object"&&!e.alsoResize.nodeType?a.each(e.alsoResize,function(a,b){i(a,b)}):i(e.alsoResize)},stop:function(b,c){a(this).removeData("resizable-alsoresize")}}),a.ui.plugin.add("resizable","animate",{stop:function(b,c){var d=a(this).data("resizable"),e=d.options,f=d._proportionallyResizeElements,g=f.length&&/textarea/i.test(f[0].nodeName),h=g&&a.ui.hasScroll(f[0],"left")?0:d.sizeDiff.height,i=g?0:d.sizeDiff.width,j={width:d.size.width-i,height:d.size.height-h},k=parseInt(d.element.css("left"),10)+(d.position.left-d.originalPosition.left)||null,l=parseInt(d.element.css("top"),10)+(d.position.top-d.originalPosition.top)||null;d.element.animate(a.extend(j,l&&k?{top:l,left:k}:{}),{duration:e.animateDuration,easing:e.animateEasing,step:function(){var c={width:parseInt(d.element.css("width"),10),height:parseInt(d.element.css("height"),10),top:parseInt(d.element.css("top"),10),left:parseInt(d.element.css("left"),10)};f&&f.length&&a(f[0]).css({width:c.width,height:c.height}),d._updateCache(c),d._propagate("resize",b)}})}}),a.ui.plugin.add("resizable","containment",{start:function(b,d){var e=a(this).data("resizable"),f=e.options,g=e.element,h=f.containment,i=h instanceof a?h.get(0):/parent/.test(h)?g.parent().get(0):h;if(!i)return;e.containerElement=a(i);if(/document/.test(h)||h==document)e.containerOffset={left:0,top:0},e.containerPosition={left:0,top:0},e.parentData={element:a(document),left:0,top:0,width:a(document).width(),height:a(document).height()||document.body.parentNode.scrollHeight};else{var j=a(i),k=[];a(["Top","Right","Left","Bottom"]).each(function(a,b){k[a]=c(j.css("padding"+b))}),e.containerOffset=j.offset(),e.containerPosition=j.position(),e.containerSize={height:j.innerHeight()-k[3],width:j.innerWidth()-k[1]};var l=e.containerOffset,m=e.containerSize.height,n=e.containerSize.width,o=a.ui.hasScroll(i,"left")?i.scrollWidth:n,p=a.ui.hasScroll(i)?i.scrollHeight:m;e.parentData={element:i,left:l.left,top:l.top,width:o,height:p}}},resize:function(b,c){var d=a(this).data("resizable"),e=d.options,f=d.containerSize,g=d.containerOffset,h=d.size,i=d.position,j=d._aspectRatio||b.shiftKey,k={top:0,left:0},l=d.containerElement;l[0]!=document&&/static/.test(l.css("position"))&&(k=g),i.left<(d._helper?g.left:0)&&(d.size.width=d.size.width+(d._helper?d.position.left-g.left:d.position.left-k.left),j&&(d.size.height=d.size.width/d.aspectRatio),d.position.left=e.helper?g.left:0),i.top<(d._helper?g.top:0)&&(d.size.height=d.size.height+(d._helper?d.position.top-g.top:d.position.top),j&&(d.size.width=d.size.height*d.aspectRatio),d.position.top=d._helper?g.top:0),d.offset.left=d.parentData.left+d.position.left,d.offset.top=d.parentData.top+d.position.top;var m=Math.abs((d._helper?d.offset.left-k.left:d.offset.left-k.left)+d.sizeDiff.width),n=Math.abs((d._helper?d.offset.top-k.top:d.offset.top-g.top)+d.sizeDiff.height),o=d.containerElement.get(0)==d.element.parent().get(0),p=/relative|absolute/.test(d.containerElement.css("position"));o&&p&&(m-=d.parentData.left),m+d.size.width>=d.parentData.width&&(d.size.width=d.parentData.width-m,j&&(d.size.height=d.size.width/d.aspectRatio)),n+d.size.height>=d.parentData.height&&(d.size.height=d.parentData.height-n,j&&(d.size.width=d.size.height*d.aspectRatio))},stop:function(b,c){var d=a(this).data("resizable"),e=d.options,f=d.position,g=d.containerOffset,h=d.containerPosition,i=d.containerElement,j=a(d.helper),k=j.offset(),l=j.outerWidth()-d.sizeDiff.width,m=j.outerHeight()-d.sizeDiff.height;d._helper&&!e.animate&&/relative/.test(i.css("position"))&&a(this).css({left:k.left-h.left-g.left,width:l,height:m}),d._helper&&!e.animate&&/static/.test(i.css("position"))&&a(this).css({left:k.left-h.left-g.left,width:l,height:m})}}),a.ui.plugin.add("resizable","ghost",{start:function(b,c){var d=a(this).data("resizable"),e=d.options,f=d.size;d.ghost=d.originalElement.clone(),d.ghost.css({opacity:.25,display:"block",position:"relative",height:f.height,width:f.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof e.ghost=="string"?e.ghost:""),d.ghost.appendTo(d.helper)},resize:function(b,c){var d=a(this).data("resizable"),e=d.options;d.ghost&&d.ghost.css({position:"relative",height:d.size.height,width:d.size.width})},stop:function(b,c){var d=a(this).data("resizable"),e=d.options;d.ghost&&d.helper&&d.helper.get(0).removeChild(d.ghost.get(0))}}),a.ui.plugin.add("resizable","grid",{resize:function(b,c){var d=a(this).data("resizable"),e=d.options,f=d.size,g=d.originalSize,h=d.originalPosition,i=d.axis,j=e._aspectRatio||b.shiftKey;e.grid=typeof e.grid=="number"?[e.grid,e.grid]:e.grid;var k=Math.round((f.width-g.width)/(e.grid[0]||1))*(e.grid[0]||1),l=Math.round((f.height-g.height)/(e.grid[1]||1))*(e.grid[1]||1);/^(se|s|e)$/.test(i)?(d.size.width=g.width+k,d.size.height=g.height+l):/^(ne)$/.test(i)?(d.size.width=g.width+k,d.size.height=g.height+l,d.position.top=h.top-l):/^(sw)$/.test(i)?(d.size.width=g.width+k,d.size.height=g.height+l,d.position.left=h.left-k):(d.size.width=g.width+k,d.size.height=g.height+l,d.position.top=h.top-l,d.position.left=h.left-k)}});var c=function(a){return parseInt(a,10)||0},d=function(a){return!isNaN(parseInt(a,10))}})(jQuery);;/*! jQuery UI - v1.8.23 - 2012-08-15+* https://github.com/jquery/jquery-ui+* Includes: jquery.ui.selectable.js+* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */+(function(a,b){a.widget("ui.selectable",a.ui.mouse,{options:{appendTo:"body",autoRefresh:!0,distance:0,filter:"*",tolerance:"touch"},_create:function(){var b=this;this.element.addClass("ui-selectable"),this.dragged=!1;var c;this.refresh=function(){c=a(b.options.filter,b.element[0]),c.addClass("ui-selectee"),c.each(function(){var b=a(this),c=b.offset();a.data(this,"selectable-item",{element:this,$element:b,left:c.left,top:c.top,right:c.left+b.outerWidth(),bottom:c.top+b.outerHeight(),startselected:!1,selected:b.hasClass("ui-selected"),selecting:b.hasClass("ui-selecting"),unselecting:b.hasClass("ui-unselecting")})})},this.refresh(),this.selectees=c.addClass("ui-selectee"),this._mouseInit(),this.helper=a("<div class='ui-selectable-helper'></div>")},destroy:function(){return this.selectees.removeClass("ui-selectee").removeData("selectable-item"),this.element.removeClass("ui-selectable ui-selectable-disabled").removeData("selectable").unbind(".selectable"),this._mouseDestroy(),this},_mouseStart:function(b){var c=this;this.opos=[b.pageX,b.pageY];if(this.options.disabled)return;var d=this.options;this.selectees=a(d.filter,this.element[0]),this._trigger("start",b),a(d.appendTo).append(this.helper),this.helper.css({left:b.clientX,top:b.clientY,width:0,height:0}),d.autoRefresh&&this.refresh(),this.selectees.filter(".ui-selected").each(function(){var d=a.data(this,"selectable-item");d.startselected=!0,!b.metaKey&&!b.ctrlKey&&(d.$element.removeClass("ui-selected"),d.selected=!1,d.$element.addClass("ui-unselecting"),d.unselecting=!0,c._trigger("unselecting",b,{unselecting:d.element}))}),a(b.target).parents().andSelf().each(function(){var d=a.data(this,"selectable-item");if(d){var e=!b.metaKey&&!b.ctrlKey||!d.$element.hasClass("ui-selected");return d.$element.removeClass(e?"ui-unselecting":"ui-selected").addClass(e?"ui-selecting":"ui-unselecting"),d.unselecting=!e,d.selecting=e,d.selected=e,e?c._trigger("selecting",b,{selecting:d.element}):c._trigger("unselecting",b,{unselecting:d.element}),!1}})},_mouseDrag:function(b){var c=this;this.dragged=!0;if(this.options.disabled)return;var d=this.options,e=this.opos[0],f=this.opos[1],g=b.pageX,h=b.pageY;if(e>g){var i=g;g=e,e=i}if(f>h){var i=h;h=f,f=i}return this.helper.css({left:e,top:f,width:g-e,height:h-f}),this.selectees.each(function(){var i=a.data(this,"selectable-item");if(!i||i.element==c.element[0])return;var j=!1;d.tolerance=="touch"?j=!(i.left>g||i.right<e||i.top>h||i.bottom<f):d.tolerance=="fit"&&(j=i.left>e&&i.right<g&&i.top>f&&i.bottom<h),j?(i.selected&&(i.$element.removeClass("ui-selected"),i.selected=!1),i.unselecting&&(i.$element.removeClass("ui-unselecting"),i.unselecting=!1),i.selecting||(i.$element.addClass("ui-selecting"),i.selecting=!0,c._trigger("selecting",b,{selecting:i.element}))):(i.selecting&&((b.metaKey||b.ctrlKey)&&i.startselected?(i.$element.removeClass("ui-selecting"),i.selecting=!1,i.$element.addClass("ui-selected"),i.selected=!0):(i.$element.removeClass("ui-selecting"),i.selecting=!1,i.startselected&&(i.$element.addClass("ui-unselecting"),i.unselecting=!0),c._trigger("unselecting",b,{unselecting:i.element}))),i.selected&&!b.metaKey&&!b.ctrlKey&&!i.startselected&&(i.$element.removeClass("ui-selected"),i.selected=!1,i.$element.addClass("ui-unselecting"),i.unselecting=!0,c._trigger("unselecting",b,{unselecting:i.element})))}),!1},_mouseStop:function(b){var c=this;this.dragged=!1;var d=this.options;return a(".ui-unselecting",this.element[0]).each(function(){var d=a.data(this,"selectable-item");d.$element.removeClass("ui-unselecting"),d.unselecting=!1,d.startselected=!1,c._trigger("unselected",b,{unselected:d.element})}),a(".ui-selecting",this.element[0]).each(function(){var d=a.data(this,"selectable-item");d.$element.removeClass("ui-selecting").addClass("ui-selected"),d.selecting=!1,d.selected=!0,d.startselected=!0,c._trigger("selected",b,{selected:d.element})}),this._trigger("stop",b),this.helper.remove(),!1}}),a.extend(a.ui.selectable,{version:"1.8.23"})})(jQuery);;/*! jQuery UI - v1.8.23 - 2012-08-15+* https://github.com/jquery/jquery-ui+* Includes: jquery.ui.sortable.js+* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */+(function(a,b){a.widget("ui.sortable",a.ui.mouse,{widgetEventPrefix:"sort",ready:!1,options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:"> *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3},_create:function(){var a=this.options;this.containerCache={},this.element.addClass("ui-sortable"),this.refresh(),this.floating=this.items.length?a.axis==="x"||/left|right/.test(this.items[0].item.css("float"))||/inline|table-cell/.test(this.items[0].item.css("display")):!1,this.offset=this.element.offset(),this._mouseInit(),this.ready=!0},destroy:function(){a.Widget.prototype.destroy.call(this),this.element.removeClass("ui-sortable ui-sortable-disabled"),this._mouseDestroy();for(var b=this.items.length-1;b>=0;b--)this.items[b].item.removeData(this.widgetName+"-item");return this},_setOption:function(b,c){b==="disabled"?(this.options[b]=c,this.widget()[c?"addClass":"removeClass"]("ui-sortable-disabled")):a.Widget.prototype._setOption.apply(this,arguments)},_mouseCapture:function(b,c){var d=this;if(this.reverting)return!1;if(this.options.disabled||this.options.type=="static")return!1;this._refreshItems(b);var e=null,f=this,g=a(b.target).parents().each(function(){if(a.data(this,d.widgetName+"-item")==f)return e=a(this),!1});a.data(b.target,d.widgetName+"-item")==f&&(e=a(b.target));if(!e)return!1;if(this.options.handle&&!c){var h=!1;a(this.options.handle,e).find("*").andSelf().each(function(){this==b.target&&(h=!0)});if(!h)return!1}return this.currentItem=e,this._removeCurrentsFromItems(),!0},_mouseStart:function(b,c,d){var e=this.options,f=this;this.currentContainer=this,this.refreshPositions(),this.helper=this._createHelper(b),this._cacheHelperProportions(),this._cacheMargins(),this.scrollParent=this.helper.scrollParent(),this.offset=this.currentItem.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},a.extend(this.offset,{click:{left:b.pageX-this.offset.left,top:b.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.helper.css("position","absolute"),this.cssPosition=this.helper.css("position"),this.originalPosition=this._generatePosition(b),this.originalPageX=b.pageX,this.originalPageY=b.pageY,e.cursorAt&&this._adjustOffsetFromHelper(e.cursorAt),this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]},this.helper[0]!=this.currentItem[0]&&this.currentItem.hide(),this._createPlaceholder(),e.containment&&this._setContainment(),e.cursor&&(a("body").css("cursor")&&(this._storedCursor=a("body").css("cursor")),a("body").css("cursor",e.cursor)),e.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",e.opacity)),e.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",e.zIndex)),this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",b,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions();if(!d)for(var g=this.containers.length-1;g>=0;g--)this.containers[g]._trigger("activate",b,f._uiHash(this));return a.ui.ddmanager&&(a.ui.ddmanager.current=this),a.ui.ddmanager&&!e.dropBehaviour&&a.ui.ddmanager.prepareOffsets(this,b),this.dragging=!0,this.helper.addClass("ui-sortable-helper"),this._mouseDrag(b),!0},_mouseDrag:function(b){this.position=this._generatePosition(b),this.positionAbs=this._convertPositionTo("absolute"),this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs);if(this.options.scroll){var c=this.options,d=!1;this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-b.pageY<c.scrollSensitivity?this.scrollParent[0].scrollTop=d=this.scrollParent[0].scrollTop+c.scrollSpeed:b.pageY-this.overflowOffset.top<c.scrollSensitivity&&(this.scrollParent[0].scrollTop=d=this.scrollParent[0].scrollTop-c.scrollSpeed),this.overflowOffset.left+this.scrollParent[0].offsetWidth-b.pageX<c.scrollSensitivity?this.scrollParent[0].scrollLeft=d=this.scrollParent[0].scrollLeft+c.scrollSpeed:b.pageX-this.overflowOffset.left<c.scrollSensitivity&&(this.scrollParent[0].scrollLeft=d=this.scrollParent[0].scrollLeft-c.scrollSpeed)):(b.pageY-a(document).scrollTop()<c.scrollSensitivity?d=a(document).scrollTop(a(document).scrollTop()-c.scrollSpeed):a(window).height()-(b.pageY-a(document).scrollTop())<c.scrollSensitivity&&(d=a(document).scrollTop(a(document).scrollTop()+c.scrollSpeed)),b.pageX-a(document).scrollLeft()<c.scrollSensitivity?d=a(document).scrollLeft(a(document).scrollLeft()-c.scrollSpeed):a(window).width()-(b.pageX-a(document).scrollLeft())<c.scrollSensitivity&&(d=a(document).scrollLeft(a(document).scrollLeft()+c.scrollSpeed))),d!==!1&&a.ui.ddmanager&&!c.dropBehaviour&&a.ui.ddmanager.prepareOffsets(this,b)}this.positionAbs=this._convertPositionTo("absolute");if(!this.options.axis||this.options.axis!="y")this.helper[0].style.left=this.position.left+"px";if(!this.options.axis||this.options.axis!="x")this.helper[0].style.top=this.position.top+"px";for(var e=this.items.length-1;e>=0;e--){var f=this.items[e],g=f.item[0],h=this._intersectsWithPointer(f);if(!h)continue;if(g!=this.currentItem[0]&&this.placeholder[h==1?"next":"prev"]()[0]!=g&&!a.ui.contains(this.placeholder[0],g)&&(this.options.type=="semi-dynamic"?!a.ui.contains(this.element[0],g):!0)){this.direction=h==1?"down":"up";if(this.options.tolerance=="pointer"||this._intersectsWithSides(f))this._rearrange(b,f);else break;this._trigger("change",b,this._uiHash());break}}return this._contactContainers(b),a.ui.ddmanager&&a.ui.ddmanager.drag(this,b),this._trigger("sort",b,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(b,c){if(!b)return;a.ui.ddmanager&&!this.options.dropBehaviour&&a.ui.ddmanager.drop(this,b);if(this.options.revert){var d=this,e=d.placeholder.offset();d.reverting=!0,a(this.helper).animate({left:e.left-this.offset.parent.left-d.margins.left+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollLeft),top:e.top-this.offset.parent.top-d.margins.top+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollTop)},parseInt(this.options.revert,10)||500,function(){d._clear(b)})}else this._clear(b,c);return!1},cancel:function(){var b=this;if(this.dragging){this._mouseUp({target:null}),this.options.helper=="original"?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"):this.currentItem.show();for(var c=this.containers.length-1;c>=0;c--)this.containers[c]._trigger("deactivate",null,b._uiHash(this)),this.containers[c].containerCache.over&&(this.containers[c]._trigger("out",null,b._uiHash(this)),this.containers[c].containerCache.over=0)}return this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.options.helper!="original"&&this.helper&&this.helper[0].parentNode&&this.helper.remove(),a.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?a(this.domPosition.prev).after(this.currentItem):a(this.domPosition.parent).prepend(this.currentItem)),this},serialize:function(b){var c=this._getItemsAsjQuery(b&&b.connected),d=[];return b=b||{},a(c).each(function(){var c=(a(b.item||this).attr(b.attribute||"id")||"").match(b.expression||/(.+)[-=_](.+)/);c&&d.push((b.key||c[1]+"[]")+"="+(b.key&&b.expression?c[1]:c[2]))}),!d.length&&b.key&&d.push(b.key+"="),d.join("&")},toArray:function(b){var c=this._getItemsAsjQuery(b&&b.connected),d=[];return b=b||{},c.each(function(){d.push(a(b.item||this).attr(b.attribute||"id")||"")}),d},_intersectsWith:function(a){var b=this.positionAbs.left,c=b+this.helperProportions.width,d=this.positionAbs.top,e=d+this.helperProportions.height,f=a.left,g=f+a.width,h=a.top,i=h+a.height,j=this.offset.click.top,k=this.offset.click.left,l=d+j>h&&d+j<i&&b+k>f&&b+k<g;return this.options.tolerance=="pointer"||this.options.forcePointerForContainers||this.options.tolerance!="pointer"&&this.helperProportions[this.floating?"width":"height"]>a[this.floating?"width":"height"]?l:f<b+this.helperProportions.width/2&&c-this.helperProportions.width/2<g&&h<d+this.helperProportions.height/2&&e-this.helperProportions.height/2<i},_intersectsWithPointer:function(b){var c=this.options.axis==="x"||a.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,b.top,b.height),d=this.options.axis==="y"||a.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,b.left,b.width),e=c&&d,f=this._getDragVerticalDirection(),g=this._getDragHorizontalDirection();return e?this.floating?g&&g=="right"||f=="down"?2:1:f&&(f=="down"?2:1):!1},_intersectsWithSides:function(b){var c=a.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,b.top+b.height/2,b.height),d=a.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,b.left+b.width/2,b.width),e=this._getDragVerticalDirection(),f=this._getDragHorizontalDirection();return this.floating&&f?f=="right"&&d||f=="left"&&!d:e&&(e=="down"&&c||e=="up"&&!c)},_getDragVerticalDirection:function(){var a=this.positionAbs.top-this.lastPositionAbs.top;return a!=0&&(a>0?"down":"up")},_getDragHorizontalDirection:function(){var a=this.positionAbs.left-this.lastPositionAbs.left;return a!=0&&(a>0?"right":"left")},refresh:function(a){return this._refreshItems(a),this.refreshPositions(),this},_connectWith:function(){var a=this.options;return a.connectWith.constructor==String?[a.connectWith]:a.connectWith},_getItemsAsjQuery:function(b){var c=this,d=[],e=[],f=this._connectWith();if(f&&b)for(var g=f.length-1;g>=0;g--){var h=a(f[g]);for(var i=h.length-1;i>=0;i--){var j=a.data(h[i],this.widgetName);j&&j!=this&&!j.options.disabled&&e.push([a.isFunction(j.options.items)?j.options.items.call(j.element):a(j.options.items,j.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),j])}}e.push([a.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):a(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]);for(var g=e.length-1;g>=0;g--)e[g][0].each(function(){d.push(this)});return a(d)},_removeCurrentsFromItems:function(){var a=this.currentItem.find(":data("+this.widgetName+"-item)");for(var b=0;b<this.items.length;b++)for(var c=0;c<a.length;c++)a[c]==this.items[b].item[0]&&this.items.splice(b,1)},_refreshItems:function(b){this.items=[],this.containers=[this];var c=this.items,d=this,e=[[a.isFunction(this.options.items)?this.options.items.call(this.element[0],b,{item:this.currentItem}):a(this.options.items,this.element),this]],f=this._connectWith();if(f&&this.ready)for(var g=f.length-1;g>=0;g--){var h=a(f[g]);for(var i=h.length-1;i>=0;i--){var j=a.data(h[i],this.widgetName);j&&j!=this&&!j.options.disabled&&(e.push([a.isFunction(j.options.items)?j.options.items.call(j.element[0],b,{item:this.currentItem}):a(j.options.items,j.element),j]),this.containers.push(j))}}for(var g=e.length-1;g>=0;g--){var k=e[g][1],l=e[g][0];for(var i=0,m=l.length;i<m;i++){var n=a(l[i]);n.data(this.widgetName+"-item",k),c.push({item:n,instance:k,width:0,height:0,left:0,top:0})}}},refreshPositions:function(b){this.offsetParent&&this.helper&&(this.offset.parent=this._getParentOffset());for(var c=this.items.length-1;c>=0;c--){var d=this.items[c];if(d.instance!=this.currentContainer&&this.currentContainer&&d.item[0]!=this.currentItem[0])continue;var e=this.options.toleranceElement?a(this.options.toleranceElement,d.item):d.item;b||(d.width=e.outerWidth(),d.height=e.outerHeight());var f=e.offset();d.left=f.left,d.top=f.top}if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(var c=this.containers.length-1;c>=0;c--){var f=this.containers[c].element.offset();this.containers[c].containerCache.left=f.left,this.containers[c].containerCache.top=f.top,this.containers[c].containerCache.width=this.containers[c].element.outerWidth(),this.containers[c].containerCache.height=this.containers[c].element.outerHeight()}return this},_createPlaceholder:function(b){var c=b||this,d=c.options;if(!d.placeholder||d.placeholder.constructor==String){var e=d.placeholder;d.placeholder={element:function(){var b=a(document.createElement(c.currentItem[0].nodeName)).addClass(e||c.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper")[0];return e||(b.style.visibility="hidden"),b},update:function(a,b){if(e&&!d.forcePlaceholderSize)return;b.height()||b.height(c.currentItem.innerHeight()-parseInt(c.currentItem.css("paddingTop")||0,10)-parseInt(c.currentItem.css("paddingBottom")||0,10)),b.width()||b.width(c.currentItem.innerWidth()-parseInt(c.currentItem.css("paddingLeft")||0,10)-parseInt(c.currentItem.css("paddingRight")||0,10))}}}c.placeholder=a(d.placeholder.element.call(c.element,c.currentItem)),c.currentItem.after(c.placeholder),d.placeholder.update(c,c.placeholder)},_contactContainers:function(b){var c=null,d=null;for(var e=this.containers.length-1;e>=0;e--){if(a.ui.contains(this.currentItem[0],this.containers[e].element[0]))continue;if(this._intersectsWith(this.containers[e].containerCache)){if(c&&a.ui.contains(this.containers[e].element[0],c.element[0]))continue;c=this.containers[e],d=e}else this.containers[e].containerCache.over&&(this.containers[e]._trigger("out",b,this._uiHash(this)),this.containers[e].containerCache.over=0)}if(!c)return;if(this.containers.length===1)this.containers[d]._trigger("over",b,this._uiHash(this)),this.containers[d].containerCache.over=1;else if(this.currentContainer!=this.containers[d]){var f=1e4,g=null,h=this.positionAbs[this.containers[d].floating?"left":"top"];for(var i=this.items.length-1;i>=0;i--){if(!a.ui.contains(this.containers[d].element[0],this.items[i].item[0]))continue;var j=this.containers[d].floating?this.items[i].item.offset().left:this.items[i].item.offset().top;Math.abs(j-h)<f&&(f=Math.abs(j-h),g=this.items[i],this.direction=j-h>0?"down":"up")}if(!g&&!this.options.dropOnEmpty)return;this.currentContainer=this.containers[d],g?this._rearrange(b,g,null,!0):this._rearrange(b,null,this.containers[d].element,!0),this._trigger("change",b,this._uiHash()),this.containers[d]._trigger("change",b,this._uiHash(this)),this.options.placeholder.update(this.currentContainer,this.placeholder),this.containers[d]._trigger("over",b,this._uiHash(this)),this.containers[d].containerCache.over=1}},_createHelper:function(b){var c=this.options,d=a.isFunction(c.helper)?a(c.helper.apply(this.element[0],[b,this.currentItem])):c.helper=="clone"?this.currentItem.clone():this.currentItem;return d.parents("body").length||a(c.appendTo!="parent"?c.appendTo:this.currentItem[0].parentNode)[0].appendChild(d[0]),d[0]==this.currentItem[0]&&(this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}),(d[0].style.width==""||c.forceHelperSize)&&d.width(this.currentItem.width()),(d[0].style.height==""||c.forceHelperSize)&&d.height(this.currentItem.height()),d},_adjustOffsetFromHelper:function(b){typeof b=="string"&&(b=b.split(" ")),a.isArray(b)&&(b={left:+b[0],top:+b[1]||0}),"left"in b&&(this.offset.click.left=b.left+this.margins.left),"right"in b&&(this.offset.click.left=this.helperProportions.width-b.right+this.margins.left),"top"in b&&(this.offset.click.top=b.top+this.margins.top),"bottom"in b&&(this.offset.click.top=this.helperProportions.height-b.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var b=this.offsetParent.offset();this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0])&&(b.left+=this.scrollParent.scrollLeft(),b.top+=this.scrollParent.scrollTop());if(this.offsetParent[0]==document.body||this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&a.browser.msie)b={top:0,left:0};return{top:b.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:b.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var a=this.currentItem.position();return{top:a.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:a.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var b=this.options;b.containment=="parent"&&(b.containment=this.helper[0].parentNode);if(b.containment=="document"||b.containment=="window")this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,a(b.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(a(b.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!/^(document|window|parent)$/.test(b.containment)){var c=a(b.containment)[0],d=a(b.containment).offset(),e=a(c).css("overflow")!="hidden";this.containment=[d.left+(parseInt(a(c).css("borderLeftWidth"),10)||0)+(parseInt(a(c).css("paddingLeft"),10)||0)-this.margins.left,d.top+(parseInt(a(c).css("borderTopWidth"),10)||0)+(parseInt(a(c).css("paddingTop"),10)||0)-this.margins.top,d.left+(e?Math.max(c.scrollWidth,c.offsetWidth):c.offsetWidth)-(parseInt(a(c).css("borderLeftWidth"),10)||0)-(parseInt(a(c).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,d.top+(e?Math.max(c.scrollHeight,c.offsetHeight):c.offsetHeight)-(parseInt(a(c).css("borderTopWidth"),10)||0)-(parseInt(a(c).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top]}},_convertPositionTo:function(b,c){c||(c=this.position);var d=b=="absolute"?1:-1,e=this.options,f=this.cssPosition=="absolute"&&(this.scrollParent[0]==document||!a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,g=/(html|body)/i.test(f[0].tagName);return{top:c.top+this.offset.relative.top*d+this.offset.parent.top*d-(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():g?0:f.scrollTop())*d),left:c.left+this.offset.relative.left*d+this.offset.parent.left*d-(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():g?0:f.scrollLeft())*d)}},_generatePosition:function(b){var c=this.options,d=this.cssPosition=="absolute"&&(this.scrollParent[0]==document||!a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,e=/(html|body)/i.test(d[0].tagName);this.cssPosition=="relative"&&(this.scrollParent[0]==document||this.scrollParent[0]==this.offsetParent[0])&&(this.offset.relative=this._getRelativeOffset());var f=b.pageX,g=b.pageY;if(this.originalPosition){this.containment&&(b.pageX-this.offset.click.left<this.containment[0]&&(f=this.containment[0]+this.offset.click.left),b.pageY-this.offset.click.top<this.containment[1]&&(g=this.containment[1]+this.offset.click.top),b.pageX-this.offset.click.left>this.containment[2]&&(f=this.containment[2]+this.offset.click.left),b.pageY-this.offset.click.top>this.containment[3]&&(g=this.containment[3]+this.offset.click.top));if(c.grid){var h=this.originalPageY+Math.round((g-this.originalPageY)/c.grid[1])*c.grid[1];g=this.containment?h-this.offset.click.top<this.containment[1]||h-this.offset.click.top>this.containment[3]?h-this.offset.click.top<this.containment[1]?h+c.grid[1]:h-c.grid[1]:h:h;var i=this.originalPageX+Math.round((f-this.originalPageX)/c.grid[0])*c.grid[0];f=this.containment?i-this.offset.click.left<this.containment[0]||i-this.offset.click.left>this.containment[2]?i-this.offset.click.left<this.containment[0]?i+c.grid[0]:i-c.grid[0]:i:i}}return{top:g-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(a.browser.safari&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollTop():e?0:d.scrollTop()),left:f-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(a.browser.safari&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():e?0:d.scrollLeft())}},_rearrange:function(a,b,c,d){c?c[0].appendChild(this.placeholder[0]):b.item[0].parentNode.insertBefore(this.placeholder[0],this.direction=="down"?b.item[0]:b.item[0].nextSibling),this.counter=this.counter?++this.counter:1;var e=this,f=this.counter;window.setTimeout(function(){f==e.counter&&e.refreshPositions(!d)},0)},_clear:function(b,c){this.reverting=!1;var d=[],e=this;!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem),this._noFinalSort=null;if(this.helper[0]==this.currentItem[0]){for(var f in this._storedCSS)if(this._storedCSS[f]=="auto"||this._storedCSS[f]=="static")this._storedCSS[f]="";this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else this.currentItem.show();this.fromOutside&&!c&&d.push(function(a){this._trigger("receive",a,this._uiHash(this.fromOutside))}),(this.fromOutside||this.domPosition.prev!=this.currentItem.prev().not(".ui-sortable-helper")[0]||this.domPosition.parent!=this.currentItem.parent()[0])&&!c&&d.push(function(a){this._trigger("update",a,this._uiHash())});if(!a.ui.contains(this.element[0],this.currentItem[0])){c||d.push(function(a){this._trigger("remove",a,this._uiHash())});for(var f=this.containers.length-1;f>=0;f--)a.ui.contains(this.containers[f].element[0],this.currentItem[0])&&!c&&(d.push(function(a){return function(b){a._trigger("receive",b,this._uiHash(this))}}.call(this,this.containers[f])),d.push(function(a){return function(b){a._trigger("update",b,this._uiHash(this))}}.call(this,this.containers[f])))}for(var f=this.containers.length-1;f>=0;f--)c||d.push(function(a){return function(b){a._trigger("deactivate",b,this._uiHash(this))}}.call(this,this.containers[f])),this.containers[f].containerCache.over&&(d.push(function(a){return function(b){a._trigger("out",b,this._uiHash(this))}}.call(this,this.containers[f])),this.containers[f].containerCache.over=0);this._storedCursor&&a("body").css("cursor",this._storedCursor),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex",this._storedZIndex=="auto"?"":this._storedZIndex),this.dragging=!1;if(this.cancelHelperRemoval){if(!c){this._trigger("beforeStop",b,this._uiHash());for(var f=0;f<d.length;f++)d[f].call(this,b);this._trigger("stop",b,this._uiHash())}return this.fromOutside=!1,!1}c||this._trigger("beforeStop",b,this._uiHash()),this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.helper[0]!=this.currentItem[0]&&this.helper.remove(),this.helper=null;if(!c){for(var f=0;f<d.length;f++)d[f].call(this,b);this._trigger("stop",b,this._uiHash())}return this.fromOutside=!1,!0},_trigger:function(){a.Widget.prototype._trigger.apply(this,arguments)===!1&&this.cancel()},_uiHash:function(b){var c=b||this;return{helper:c.helper,placeholder:c.placeholder||a([]),position:c.position,originalPosition:c.originalPosition,offset:c.positionAbs,item:c.currentItem,sender:b?b.element:null}}}),a.extend(a.ui.sortable,{version:"1.8.23"})})(jQuery);;/*! jQuery UI - v1.8.23 - 2012-08-15+* https://github.com/jquery/jquery-ui+* Includes: jquery.ui.accordion.js+* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */+(function(a,b){a.widget("ui.accordion",{options:{active:0,animated:"slide",autoHeight:!0,clearStyle:!1,collapsible:!1,event:"click",fillSpace:!1,header:"> li > :first-child,> :not(li):even",icons:{header:"ui-icon-triangle-1-e",headerSelected:"ui-icon-triangle-1-s"},navigation:!1,navigationFilter:function(){return this.href.toLowerCase()===location.href.toLowerCase()}},_create:function(){var b=this,c=b.options;b.running=0,b.element.addClass("ui-accordion ui-widget ui-helper-reset").children("li").addClass("ui-accordion-li-fix"),b.headers=b.element.find(c.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all").bind("mouseenter.accordion",function(){if(c.disabled)return;a(this).addClass("ui-state-hover")}).bind("mouseleave.accordion",function(){if(c.disabled)return;a(this).removeClass("ui-state-hover")}).bind("focus.accordion",function(){if(c.disabled)return;a(this).addClass("ui-state-focus")}).bind("blur.accordion",function(){if(c.disabled)return;a(this).removeClass("ui-state-focus")}),b.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom");if(c.navigation){var d=b.element.find("a").filter(c.navigationFilter).eq(0);if(d.length){var e=d.closest(".ui-accordion-header");e.length?b.active=e:b.active=d.closest(".ui-accordion-content").prev()}}b.active=b._findActive(b.active||c.active).addClass("ui-state-default ui-state-active").toggleClass("ui-corner-all").toggleClass("ui-corner-top"),b.active.next().addClass("ui-accordion-content-active"),b._createIcons(),b.resize(),b.element.attr("role","tablist"),b.headers.attr("role","tab").bind("keydown.accordion",function(a){return b._keydown(a)}).next().attr("role","tabpanel"),b.headers.not(b.active||"").attr({"aria-expanded":"false","aria-selected":"false",tabIndex:-1}).next().hide(),b.active.length?b.active.attr({"aria-expanded":"true","aria-selected":"true",tabIndex:0}):b.headers.eq(0).attr("tabIndex",0),a.browser.safari||b.headers.find("a").attr("tabIndex",-1),c.event&&b.headers.bind(c.event.split(" ").join(".accordion ")+".accordion",function(a){b._clickHandler.call(b,a,this),a.preventDefault()})},_createIcons:function(){var b=this.options;b.icons&&(a("<span></span>").addClass("ui-icon "+b.icons.header).prependTo(this.headers),this.active.children(".ui-icon").toggleClass(b.icons.header).toggleClass(b.icons.headerSelected),this.element.addClass("ui-accordion-icons"))},_destroyIcons:function(){this.headers.children(".ui-icon").remove(),this.element.removeClass("ui-accordion-icons")},destroy:function(){var b=this.options;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role"),this.headers.unbind(".accordion").removeClass("ui-accordion-header ui-accordion-disabled ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("aria-selected").removeAttr("tabIndex"),this.headers.find("a").removeAttr("tabIndex"),this._destroyIcons();var c=this.headers.next().css("display","").removeAttr("role").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-accordion-disabled ui-state-disabled");return(b.autoHeight||b.fillHeight)&&c.css("height",""),a.Widget.prototype.destroy.call(this)},_setOption:function(b,c){a.Widget.prototype._setOption.apply(this,arguments),b=="active"&&this.activate(c),b=="icons"&&(this._destroyIcons(),c&&this._createIcons()),b=="disabled"&&this.headers.add(this.headers.next())[c?"addClass":"removeClass"]("ui-accordion-disabled ui-state-disabled")},_keydown:function(b){if(this.options.disabled||b.altKey||b.ctrlKey)return;var c=a.ui.keyCode,d=this.headers.length,e=this.headers.index(b.target),f=!1;switch(b.keyCode){case c.RIGHT:case c.DOWN:f=this.headers[(e+1)%d];break;case c.LEFT:case c.UP:f=this.headers[(e-1+d)%d];break;case c.SPACE:case c.ENTER:this._clickHandler({target:b.target},b.target),b.preventDefault()}return f?(a(b.target).attr("tabIndex",-1),a(f).attr("tabIndex",0),f.focus(),!1):!0},resize:function(){var b=this.options,c;if(b.fillSpace){if(a.browser.msie){var d=this.element.parent().css("overflow");this.element.parent().css("overflow","hidden")}c=this.element.parent().height(),a.browser.msie&&this.element.parent().css("overflow",d),this.headers.each(function(){c-=a(this).outerHeight(!0)}),this.headers.next().each(function(){a(this).height(Math.max(0,c-a(this).innerHeight()+a(this).height()))}).css("overflow","auto")}else b.autoHeight&&(c=0,this.headers.next().each(function(){c=Math.max(c,a(this).height("").height())}).height(c));return this},activate:function(a){this.options.active=a;var b=this._findActive(a)[0];return this._clickHandler({target:b},b),this},_findActive:function(b){return b?typeof b=="number"?this.headers.filter(":eq("+b+")"):this.headers.not(this.headers.not(b)):b===!1?a([]):this.headers.filter(":eq(0)")},_clickHandler:function(b,c){var d=this.options;if(d.disabled)return;if(!b.target){if(!d.collapsible)return;this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").children(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header),this.active.next().addClass("ui-accordion-content-active");var e=this.active.next(),f={options:d,newHeader:a([]),oldHeader:d.active,newContent:a([]),oldContent:e},g=this.active=a([]);this._toggle(g,e,f);return}var h=a(b.currentTarget||c),i=h[0]===this.active[0];d.active=d.collapsible&&i?!1:this.headers.index(h);if(this.running||!d.collapsible&&i)return;var j=this.active,g=h.next(),e=this.active.next(),f={options:d,newHeader:i&&d.collapsible?a([]):h,oldHeader:this.active,newContent:i&&d.collapsible?a([]):g,oldContent:e},k=this.headers.index(this.active[0])>this.headers.index(h[0]);this.active=i?a([]):h,this._toggle(g,e,f,i,k),j.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").children(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header),i||(h.removeClass("ui-state-default ui-corner-all").addClass("ui-state-active ui-corner-top").children(".ui-icon").removeClass(d.icons.header).addClass(d.icons.headerSelected),h.next().addClass("ui-accordion-content-active"));return},_toggle:function(b,c,d,e,f){var g=this,h=g.options;g.toShow=b,g.toHide=c,g.data=d;var i=function(){if(!g)return;return g._completed.apply(g,arguments)};g._trigger("changestart",null,g.data),g.running=c.size()===0?b.size():c.size();if(h.animated){var j={};h.collapsible&&e?j={toShow:a([]),toHide:c,complete:i,down:f,autoHeight:h.autoHeight||h.fillSpace}:j={toShow:b,toHide:c,complete:i,down:f,autoHeight:h.autoHeight||h.fillSpace},h.proxied||(h.proxied=h.animated),h.proxiedDuration||(h.proxiedDuration=h.duration),h.animated=a.isFunction(h.proxied)?h.proxied(j):h.proxied,h.duration=a.isFunction(h.proxiedDuration)?h.proxiedDuration(j):h.proxiedDuration;var k=a.ui.accordion.animations,l=h.duration,m=h.animated;m&&!k[m]&&!a.easing[m]&&(m="slide"),k[m]||(k[m]=function(a){this.slide(a,{easing:m,duration:l||700})}),k[m](j)}else h.collapsible&&e?b.toggle():(c.hide(),b.show()),i(!0);c.prev().attr({"aria-expanded":"false","aria-selected":"false",tabIndex:-1}).blur(),b.prev().attr({"aria-expanded":"true","aria-selected":"true",tabIndex:0}).focus()},_completed:function(a){this.running=a?0:--this.running;if(this.running)return;this.options.clearStyle&&this.toShow.add(this.toHide).css({height:"",overflow:""}),this.toHide.removeClass("ui-accordion-content-active"),this.toHide.length&&(this.toHide.parent()[0].className=this.toHide.parent()[0].className),this._trigger("change",null,this.data)}}),a.extend(a.ui.accordion,{version:"1.8.23",animations:{slide:function(b,c){b=a.extend({easing:"swing",duration:300},b,c);if(!b.toHide.size()){b.toShow.animate({height:"show",paddingTop:"show",paddingBottom:"show"},b);return}if(!b.toShow.size()){b.toHide.animate({height:"hide",paddingTop:"hide",paddingBottom:"hide"},b);return}var d=b.toShow.css("overflow"),e=0,f={},g={},h=["height","paddingTop","paddingBottom"],i,j=b.toShow;i=j[0].style.width,j.width(j.parent().width()-parseFloat(j.css("paddingLeft"))-parseFloat(j.css("paddingRight"))-(parseFloat(j.css("borderLeftWidth"))||0)-(parseFloat(j.css("borderRightWidth"))||0)),a.each(h,function(c,d){g[d]="hide";var e=(""+a.css(b.toShow[0],d)).match(/^([\d+-.]+)(.*)$/);f[d]={value:e[1],unit:e[2]||"px"}}),b.toShow.css({height:0,overflow:"hidden"}).show(),b.toHide.filter(":hidden").each(b.complete).end().filter(":visible").animate(g,{step:function(a,c){c.prop=="height"&&(e=c.end-c.start===0?0:(c.now-c.start)/(c.end-c.start)),b.toShow[0].style[c.prop]=e*f[c.prop].value+f[c.prop].unit},duration:b.duration,easing:b.easing,complete:function(){b.autoHeight||b.toShow.css("height",""),b.toShow.css({width:i,overflow:d}),b.complete()}})},bounceslide:function(a){this.slide(a,{easing:a.down?"easeOutBounce":"swing",duration:a.down?1e3:200})}}})})(jQuery);;/*! jQuery UI - v1.8.23 - 2012-08-15+* https://github.com/jquery/jquery-ui+* Includes: jquery.ui.autocomplete.js+* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */+(function(a,b){var c=0;a.widget("ui.autocomplete",{options:{appendTo:"body",autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null},pending:0,_create:function(){var b=this,c=this.element[0].ownerDocument,d;this.isMultiLine=this.element.is("textarea"),this.element.addClass("ui-autocomplete-input").attr("autocomplete","off").attr({role:"textbox","aria-autocomplete":"list","aria-haspopup":"true"}).bind("keydown.autocomplete",function(c){if(b.options.disabled||b.element.propAttr("readOnly"))return;d=!1;var e=a.ui.keyCode;switch(c.keyCode){case e.PAGE_UP:b._move("previousPage",c);break;case e.PAGE_DOWN:b._move("nextPage",c);break;case e.UP:b._keyEvent("previous",c);break;case e.DOWN:b._keyEvent("next",c);break;case e.ENTER:case e.NUMPAD_ENTER:b.menu.active&&(d=!0,c.preventDefault());case e.TAB:if(!b.menu.active)return;b.menu.select(c);break;case e.ESCAPE:b.element.val(b.term),b.close(c);break;default:clearTimeout(b.searching),b.searching=setTimeout(function(){b.term!=b.element.val()&&(b.selectedItem=null,b.search(null,c))},b.options.delay)}}).bind("keypress.autocomplete",function(a){d&&(d=!1,a.preventDefault())}).bind("focus.autocomplete",function(){if(b.options.disabled)return;b.selectedItem=null,b.previous=b.element.val()}).bind("blur.autocomplete",function(a){if(b.options.disabled)return;clearTimeout(b.searching),b.closing=setTimeout(function(){b.close(a),b._change(a)},150)}),this._initSource(),this.menu=a("<ul></ul>").addClass("ui-autocomplete").appendTo(a(this.options.appendTo||"body",c)[0]).mousedown(function(c){var d=b.menu.element[0];a(c.target).closest(".ui-menu-item").length||setTimeout(function(){a(document).one("mousedown",function(c){c.target!==b.element[0]&&c.target!==d&&!a.ui.contains(d,c.target)&&b.close()})},1),setTimeout(function(){clearTimeout(b.closing)},13)}).menu({focus:function(a,c){var d=c.item.data("item.autocomplete");!1!==b._trigger("focus",a,{item:d})&&/^key/.test(a.originalEvent.type)&&b.element.val(d.value)},selected:function(a,d){var e=d.item.data("item.autocomplete"),f=b.previous;b.element[0]!==c.activeElement&&(b.element.focus(),b.previous=f,setTimeout(function(){b.previous=f,b.selectedItem=e},1)),!1!==b._trigger("select",a,{item:e})&&b.element.val(e.value),b.term=b.element.val(),b.close(a),b.selectedItem=e},blur:function(a,c){b.menu.element.is(":visible")&&b.element.val()!==b.term&&b.element.val(b.term)}}).zIndex(this.element.zIndex()+1).css({top:0,left:0}).hide().data("menu"),a.fn.bgiframe&&this.menu.element.bgiframe(),b.beforeunloadHandler=function(){b.element.removeAttr("autocomplete")},a(window).bind("beforeunload",b.beforeunloadHandler)},destroy:function(){this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete").removeAttr("role").removeAttr("aria-autocomplete").removeAttr("aria-haspopup"),this.menu.element.remove(),a(window).unbind("beforeunload",this.beforeunloadHandler),a.Widget.prototype.destroy.call(this)},_setOption:function(b,c){a.Widget.prototype._setOption.apply(this,arguments),b==="source"&&this._initSource(),b==="appendTo"&&this.menu.element.appendTo(a(c||"body",this.element[0].ownerDocument)[0]),b==="disabled"&&c&&this.xhr&&this.xhr.abort()},_initSource:function(){var b=this,c,d;a.isArray(this.options.source)?(c=this.options.source,this.source=function(b,d){d(a.ui.autocomplete.filter(c,b.term))}):typeof this.options.source=="string"?(d=this.options.source,this.source=function(c,e){b.xhr&&b.xhr.abort(),b.xhr=a.ajax({url:d,data:c,dataType:"json",success:function(a,b){e(a)},error:function(){e([])}})}):this.source=this.options.source},search:function(a,b){a=a!=null?a:this.element.val(),this.term=this.element.val();if(a.length<this.options.minLength)return this.close(b);clearTimeout(this.closing);if(this._trigger("search",b)===!1)return;return this._search(a)},_search:function(a){this.pending++,this.element.addClass("ui-autocomplete-loading"),this.source({term:a},this._response())},_response:function(){var a=this,b=++c;return function(d){b===c&&a.__response(d),a.pending--,a.pending||a.element.removeClass("ui-autocomplete-loading")}},__response:function(a){!this.options.disabled&&a&&a.length?(a=this._normalize(a),this._suggest(a),this._trigger("open")):this.close()},close:function(a){clearTimeout(this.closing),this.menu.element.is(":visible")&&(this.menu.element.hide(),this.menu.deactivate(),this._trigger("close",a))},_change:function(a){this.previous!==this.element.val()&&this._trigger("change",a,{item:this.selectedItem})},_normalize:function(b){return b.length&&b[0].label&&b[0].value?b:a.map(b,function(b){return typeof b=="string"?{label:b,value:b}:a.extend({label:b.label||b.value,value:b.value||b.label},b)})},_suggest:function(b){var c=this.menu.element.empty().zIndex(this.element.zIndex()+1);this._renderMenu(c,b),this.menu.deactivate(),this.menu.refresh(),c.show(),this._resizeMenu(),c.position(a.extend({of:this.element},this.options.position)),this.options.autoFocus&&this.menu.next(new a.Event("mouseover"))},_resizeMenu:function(){var a=this.menu.element;a.outerWidth(Math.max(a.width("").outerWidth()+1,this.element.outerWidth()))},_renderMenu:function(b,c){var d=this;a.each(c,function(a,c){d._renderItem(b,c)})},_renderItem:function(b,c){return a("<li></li>").data("item.autocomplete",c).append(a("<a></a>").text(c.label)).appendTo(b)},_move:function(a,b){if(!this.menu.element.is(":visible")){this.search(null,b);return}if(this.menu.first()&&/^previous/.test(a)||this.menu.last()&&/^next/.test(a)){this.element.val(this.term),this.menu.deactivate();return}this.menu[a](b)},widget:function(){return this.menu.element},_keyEvent:function(a,b){if(!this.isMultiLine||this.menu.element.is(":visible"))this._move(a,b),b.preventDefault()}}),a.extend(a.ui.autocomplete,{escapeRegex:function(a){return a.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")},filter:function(b,c){var d=new RegExp(a.ui.autocomplete.escapeRegex(c),"i");return a.grep(b,function(a){return d.test(a.label||a.value||a)})}})})(jQuery),function(a){a.widget("ui.menu",{_create:function(){var b=this;this.element.addClass("ui-menu ui-widget ui-widget-content ui-corner-all").attr({role:"listbox","aria-activedescendant":"ui-active-menuitem"}).click(function(c){if(!a(c.target).closest(".ui-menu-item a").length)return;c.preventDefault(),b.select(c)}),this.refresh()},refresh:function(){var b=this,c=this.element.children("li:not(.ui-menu-item):has(a)").addClass("ui-menu-item").attr("role","menuitem");c.children("a").addClass("ui-corner-all").attr("tabindex",-1).mouseenter(function(c){b.activate(c,a(this).parent())}).mouseleave(function(){b.deactivate()})},activate:function(a,b){this.deactivate();if(this.hasScroll()){var c=b.offset().top-this.element.offset().top,d=this.element.scrollTop(),e=this.element.height();c<0?this.element.scrollTop(d+c):c>=e&&this.element.scrollTop(d+c-e+b.height())}this.active=b.eq(0).children("a").addClass("ui-state-hover").attr("id","ui-active-menuitem").end(),this._trigger("focus",a,{item:b})},deactivate:function(){if(!this.active)return;this.active.children("a").removeClass("ui-state-hover").removeAttr("id"),this._trigger("blur"),this.active=null},next:function(a){this.move("next",".ui-menu-item:first",a)},previous:function(a){this.move("prev",".ui-menu-item:last",a)},first:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},last:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},move:function(a,b,c){if(!this.active){this.activate(c,this.element.children(b));return}var d=this.active[a+"All"](".ui-menu-item").eq(0);d.length?this.activate(c,d):this.activate(c,this.element.children(b))},nextPage:function(b){if(this.hasScroll()){if(!this.active||this.last()){this.activate(b,this.element.children(".ui-menu-item:first"));return}var c=this.active.offset().top,d=this.element.height(),e=this.element.children(".ui-menu-item").filter(function(){var b=a(this).offset().top-c-d+a(this).height();return b<10&&b>-10});e.length||(e=this.element.children(".ui-menu-item:last")),this.activate(b,e)}else this.activate(b,this.element.children(".ui-menu-item").filter(!this.active||this.last()?":first":":last"))},previousPage:function(b){if(this.hasScroll()){if(!this.active||this.first()){this.activate(b,this.element.children(".ui-menu-item:last"));return}var c=this.active.offset().top,d=this.element.height(),e=this.element.children(".ui-menu-item").filter(function(){var b=a(this).offset().top-c+d-a(this).height();return b<10&&b>-10});e.length||(e=this.element.children(".ui-menu-item:first")),this.activate(b,e)}else this.activate(b,this.element.children(".ui-menu-item").filter(!this.active||this.first()?":last":":first"))},hasScroll:function(){return this.element.height()<this.element[a.fn.prop?"prop":"attr"]("scrollHeight")},select:function(a){this._trigger("selected",a,{item:this.active})}})}(jQuery);;/*! jQuery UI - v1.8.23 - 2012-08-15+* https://github.com/jquery/jquery-ui+* Includes: jquery.ui.button.js+* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */+(function(a,b){var c,d,e,f,g="ui-button ui-widget ui-state-default ui-corner-all",h="ui-state-hover ui-state-active ",i="ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only",j=function(){var b=a(this).find(":ui-button");setTimeout(function(){b.button("refresh")},1)},k=function(b){var c=b.name,d=b.form,e=a([]);return c&&(d?e=a(d).find("[name='"+c+"']"):e=a("[name='"+c+"']",b.ownerDocument).filter(function(){return!this.form})),e};a.widget("ui.button",{options:{disabled:null,text:!0,label:null,icons:{primary:null,secondary:null}},_create:function(){this.element.closest("form").unbind("reset.button").bind("reset.button",j),typeof this.options.disabled!="boolean"?this.options.disabled=!!this.element.propAttr("disabled"):this.element.propAttr("disabled",this.options.disabled),this._determineButtonType(),this.hasTitle=!!this.buttonElement.attr("title");var b=this,h=this.options,i=this.type==="checkbox"||this.type==="radio",l="ui-state-hover"+(i?"":" ui-state-active"),m="ui-state-focus";h.label===null&&(h.label=this.buttonElement.html()),this.buttonElement.addClass(g).attr("role","button").bind("mouseenter.button",function(){if(h.disabled)return;a(this).addClass("ui-state-hover"),this===c&&a(this).addClass("ui-state-active")}).bind("mouseleave.button",function(){if(h.disabled)return;a(this).removeClass(l)}).bind("click.button",function(a){h.disabled&&(a.preventDefault(),a.stopImmediatePropagation())}),this.element.bind("focus.button",function(){b.buttonElement.addClass(m)}).bind("blur.button",function(){b.buttonElement.removeClass(m)}),i&&(this.element.bind("change.button",function(){if(f)return;b.refresh()}),this.buttonElement.bind("mousedown.button",function(a){if(h.disabled)return;f=!1,d=a.pageX,e=a.pageY}).bind("mouseup.button",function(a){if(h.disabled)return;if(d!==a.pageX||e!==a.pageY)f=!0})),this.type==="checkbox"?this.buttonElement.bind("click.button",function(){if(h.disabled||f)return!1;a(this).toggleClass("ui-state-active"),b.buttonElement.attr("aria-pressed",b.element[0].checked)}):this.type==="radio"?this.buttonElement.bind("click.button",function(){if(h.disabled||f)return!1;a(this).addClass("ui-state-active"),b.buttonElement.attr("aria-pressed","true");var c=b.element[0];k(c).not(c).map(function(){return a(this).button("widget")[0]}).removeClass("ui-state-active").attr("aria-pressed","false")}):(this.buttonElement.bind("mousedown.button",function(){if(h.disabled)return!1;a(this).addClass("ui-state-active"),c=this,a(document).one("mouseup",function(){c=null})}).bind("mouseup.button",function(){if(h.disabled)return!1;a(this).removeClass("ui-state-active")}).bind("keydown.button",function(b){if(h.disabled)return!1;(b.keyCode==a.ui.keyCode.SPACE||b.keyCode==a.ui.keyCode.ENTER)&&a(this).addClass("ui-state-active")}).bind("keyup.button",function(){a(this).removeClass("ui-state-active")}),this.buttonElement.is("a")&&this.buttonElement.keyup(function(b){b.keyCode===a.ui.keyCode.SPACE&&a(this).click()})),this._setOption("disabled",h.disabled),this._resetButton()},_determineButtonType:function(){this.element.is(":checkbox")?this.type="checkbox":this.element.is(":radio")?this.type="radio":this.element.is("input")?this.type="input":this.type="button";if(this.type==="checkbox"||this.type==="radio"){var a=this.element.parents().filter(":last"),b="label[for='"+this.element.attr("id")+"']";this.buttonElement=a.find(b),this.buttonElement.length||(a=a.length?a.siblings():this.element.siblings(),this.buttonElement=a.filter(b),this.buttonElement.length||(this.buttonElement=a.find(b))),this.element.addClass("ui-helper-hidden-accessible");var c=this.element.is(":checked");c&&this.buttonElement.addClass("ui-state-active"),this.buttonElement.attr("aria-pressed",c)}else this.buttonElement=this.element},widget:function(){return this.buttonElement},destroy:function(){this.element.removeClass("ui-helper-hidden-accessible"),this.buttonElement.removeClass(g+" "+h+" "+i).removeAttr("role").removeAttr("aria-pressed").html(this.buttonElement.find(".ui-button-text").html()),this.hasTitle||this.buttonElement.removeAttr("title"),a.Widget.prototype.destroy.call(this)},_setOption:function(b,c){a.Widget.prototype._setOption.apply(this,arguments);if(b==="disabled"){c?this.element.propAttr("disabled",!0):this.element.propAttr("disabled",!1);return}this._resetButton()},refresh:function(){var b=this.element.is(":disabled");b!==this.options.disabled&&this._setOption("disabled",b),this.type==="radio"?k(this.element[0]).each(function(){a(this).is(":checked")?a(this).button("widget").addClass("ui-state-active").attr("aria-pressed","true"):a(this).button("widget").removeClass("ui-state-active").attr("aria-pressed","false")}):this.type==="checkbox"&&(this.element.is(":checked")?this.buttonElement.addClass("ui-state-active").attr("aria-pressed","true"):this.buttonElement.removeClass("ui-state-active").attr("aria-pressed","false"))},_resetButton:function(){if(this.type==="input"){this.options.label&&this.element.val(this.options.label);return}var b=this.buttonElement.removeClass(i),c=a("<span></span>",this.element[0].ownerDocument).addClass("ui-button-text").html(this.options.label).appendTo(b.empty()).text(),d=this.options.icons,e=d.primary&&d.secondary,f=[];d.primary||d.secondary?(this.options.text&&f.push("ui-button-text-icon"+(e?"s":d.primary?"-primary":"-secondary")),d.primary&&b.prepend("<span class='ui-button-icon-primary ui-icon "+d.primary+"'></span>"),d.secondary&&b.append("<span class='ui-button-icon-secondary ui-icon "+d.secondary+"'></span>"),this.options.text||(f.push(e?"ui-button-icons-only":"ui-button-icon-only"),this.hasTitle||b.attr("title",c))):f.push("ui-button-text-only"),b.addClass(f.join(" "))}}),a.widget("ui.buttonset",{options:{items:":button, :submit, :reset, :checkbox, :radio, a, :data(button)"},_create:function(){this.element.addClass("ui-buttonset")},_init:function(){this.refresh()},_setOption:function(b,c){b==="disabled"&&this.buttons.button("option",b,c),a.Widget.prototype._setOption.apply(this,arguments)},refresh:function(){var b=this.element.css("direction")==="rtl";this.buttons=this.element.find(this.options.items).filter(":ui-button").button("refresh").end().not(":ui-button").button().end().map(function(){return a(this).button("widget")[0]}).removeClass("ui-corner-all ui-corner-left ui-corner-right").filter(":first").addClass(b?"ui-corner-right":"ui-corner-left").end().filter(":last").addClass(b?"ui-corner-left":"ui-corner-right").end().end()},destroy:function(){this.element.removeClass("ui-buttonset"),this.buttons.map(function(){return a(this).button("widget")[0]}).removeClass("ui-corner-left ui-corner-right").end().button("destroy"),a.Widget.prototype.destroy.call(this)}})})(jQuery);;/*! jQuery UI - v1.8.23 - 2012-08-15+* https://github.com/jquery/jquery-ui+* Includes: jquery.ui.dialog.js+* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */+(function(a,b){var c="ui-dialog ui-widget ui-widget-content ui-corner-all ",d={buttons:!0,height:!0,maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0,width:!0},e={maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0};a.widget("ui.dialog",{options:{autoOpen:!0,buttons:{},closeOnEscape:!0,closeText:"close",dialogClass:"",draggable:!0,hide:null,height:"auto",maxHeight:!1,maxWidth:!1,minHeight:150,minWidth:150,modal:!1,position:{my:"center",at:"center",collision:"fit",using:function(b){var c=a(this).css(b).offset().top;c<0&&a(this).css("top",b.top-c)}},resizable:!0,show:null,stack:!0,title:"",width:300,zIndex:1e3},_create:function(){this.originalTitle=this.element.attr("title"),typeof this.originalTitle!="string"&&(this.originalTitle=""),this.options.title=this.options.title||this.originalTitle;var b=this,d=b.options,e=d.title||"&#160;",f=a.ui.dialog.getTitleId(b.element),g=(b.uiDialog=a("<div></div>")).appendTo(document.body).hide().addClass(c+d.dialogClass).css({zIndex:d.zIndex}).attr("tabIndex",-1).css("outline",0).keydown(function(c){d.closeOnEscape&&!c.isDefaultPrevented()&&c.keyCode&&c.keyCode===a.ui.keyCode.ESCAPE&&(b.close(c),c.preventDefault())}).attr({role:"dialog","aria-labelledby":f}).mousedown(function(a){b.moveToTop(!1,a)}),h=b.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(g),i=(b.uiDialogTitlebar=a("<div></div>")).addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(g),j=a('<a href="#"></a>').addClass("ui-dialog-titlebar-close ui-corner-all").attr("role","button").hover(function(){j.addClass("ui-state-hover")},function(){j.removeClass("ui-state-hover")}).focus(function(){j.addClass("ui-state-focus")}).blur(function(){j.removeClass("ui-state-focus")}).click(function(a){return b.close(a),!1}).appendTo(i),k=(b.uiDialogTitlebarCloseText=a("<span></span>")).addClass("ui-icon ui-icon-closethick").text(d.closeText).appendTo(j),l=a("<span></span>").addClass("ui-dialog-title").attr("id",f).html(e).prependTo(i);a.isFunction(d.beforeclose)&&!a.isFunction(d.beforeClose)&&(d.beforeClose=d.beforeclose),i.find("*").add(i).disableSelection(),d.draggable&&a.fn.draggable&&b._makeDraggable(),d.resizable&&a.fn.resizable&&b._makeResizable(),b._createButtons(d.buttons),b._isOpen=!1,a.fn.bgiframe&&g.bgiframe()},_init:function(){this.options.autoOpen&&this.open()},destroy:function(){var a=this;return a.overlay&&a.overlay.destroy(),a.uiDialog.hide(),a.element.unbind(".dialog").removeData("dialog").removeClass("ui-dialog-content ui-widget-content").hide().appendTo("body"),a.uiDialog.remove(),a.originalTitle&&a.element.attr("title",a.originalTitle),a},widget:function(){return this.uiDialog},close:function(b){var c=this,d,e;if(!1===c._trigger("beforeClose",b))return;return c.overlay&&c.overlay.destroy(),c.uiDialog.unbind("keypress.ui-dialog"),c._isOpen=!1,c.options.hide?c.uiDialog.hide(c.options.hide,function(){c._trigger("close",b)}):(c.uiDialog.hide(),c._trigger("close",b)),a.ui.dialog.overlay.resize(),c.options.modal&&(d=0,a(".ui-dialog").each(function(){this!==c.uiDialog[0]&&(e=a(this).css("z-index"),isNaN(e)||(d=Math.max(d,e)))}),a.ui.dialog.maxZ=d),c},isOpen:function(){return this._isOpen},moveToTop:function(b,c){var d=this,e=d.options,f;return e.modal&&!b||!e.stack&&!e.modal?d._trigger("focus",c):(e.zIndex>a.ui.dialog.maxZ&&(a.ui.dialog.maxZ=e.zIndex),d.overlay&&(a.ui.dialog.maxZ+=1,d.overlay.$el.css("z-index",a.ui.dialog.overlay.maxZ=a.ui.dialog.maxZ)),f={scrollTop:d.element.scrollTop(),scrollLeft:d.element.scrollLeft()},a.ui.dialog.maxZ+=1,d.uiDialog.css("z-index",a.ui.dialog.maxZ),d.element.attr(f),d._trigger("focus",c),d)},open:function(){if(this._isOpen)return;var b=this,c=b.options,d=b.uiDialog;return b.overlay=c.modal?new a.ui.dialog.overlay(b):null,b._size(),b._position(c.position),d.show(c.show),b.moveToTop(!0),c.modal&&d.bind("keydown.ui-dialog",function(b){if(b.keyCode!==a.ui.keyCode.TAB)return;var c=a(":tabbable",this),d=c.filter(":first"),e=c.filter(":last");if(b.target===e[0]&&!b.shiftKey)return d.focus(1),!1;if(b.target===d[0]&&b.shiftKey)return e.focus(1),!1}),a(b.element.find(":tabbable").get().concat(d.find(".ui-dialog-buttonpane :tabbable").get().concat(d.get()))).eq(0).focus(),b._isOpen=!0,b._trigger("open"),b},_createButtons:function(b){var c=this,d=!1,e=a("<div></div>").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"),f=a("<div></div>").addClass("ui-dialog-buttonset").appendTo(e);c.uiDialog.find(".ui-dialog-buttonpane").remove(),typeof b=="object"&&b!==null&&a.each(b,function(){return!(d=!0)}),d&&(a.each(b,function(b,d){d=a.isFunction(d)?{click:d,text:b}:d;var e=a('<button type="button"></button>').click(function(){d.click.apply(c.element[0],arguments)}).appendTo(f);a.each(d,function(a,b){if(a==="click")return;a in e?e[a](b):e.attr(a,b)}),a.fn.button&&e.button()}),e.appendTo(c.uiDialog))},_makeDraggable:function(){function f(a){return{position:a.position,offset:a.offset}}var b=this,c=b.options,d=a(document),e;b.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(d,g){e=c.height==="auto"?"auto":a(this).height(),a(this).height(a(this).height()).addClass("ui-dialog-dragging"),b._trigger("dragStart",d,f(g))},drag:function(a,c){b._trigger("drag",a,f(c))},stop:function(g,h){c.position=[h.position.left-d.scrollLeft(),h.position.top-d.scrollTop()],a(this).removeClass("ui-dialog-dragging").height(e),b._trigger("dragStop",g,f(h)),a.ui.dialog.overlay.resize()}})},_makeResizable:function(c){function h(a){return{originalPosition:a.originalPosition,originalSize:a.originalSize,position:a.position,size:a.size}}c=c===b?this.options.resizable:c;var d=this,e=d.options,f=d.uiDialog.css("position"),g=typeof c=="string"?c:"n,e,s,w,se,sw,ne,nw";d.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:d.element,maxWidth:e.maxWidth,maxHeight:e.maxHeight,minWidth:e.minWidth,minHeight:d._minHeight(),handles:g,start:function(b,c){a(this).addClass("ui-dialog-resizing"),d._trigger("resizeStart",b,h(c))},resize:function(a,b){d._trigger("resize",a,h(b))},stop:function(b,c){a(this).removeClass("ui-dialog-resizing"),e.height=a(this).height(),e.width=a(this).width(),d._trigger("resizeStop",b,h(c)),a.ui.dialog.overlay.resize()}}).css("position",f).find(".ui-resizable-se").addClass("ui-icon ui-icon-grip-diagonal-se")},_minHeight:function(){var a=this.options;return a.height==="auto"?a.minHeight:Math.min(a.minHeight,a.height)},_position:function(b){var c=[],d=[0,0],e;if(b){if(typeof b=="string"||typeof b=="object"&&"0"in b)c=b.split?b.split(" "):[b[0],b[1]],c.length===1&&(c[1]=c[0]),a.each(["left","top"],function(a,b){+c[a]===c[a]&&(d[a]=c[a],c[a]=b)}),b={my:c.join(" "),at:c.join(" "),offset:d.join(" ")};b=a.extend({},a.ui.dialog.prototype.options.position,b)}else b=a.ui.dialog.prototype.options.position;e=this.uiDialog.is(":visible"),e||this.uiDialog.show(),this.uiDialog.css({top:0,left:0}).position(a.extend({of:window},b)),e||this.uiDialog.hide()},_setOptions:function(b){var c=this,f={},g=!1;a.each(b,function(a,b){c._setOption(a,b),a in d&&(g=!0),a in e&&(f[a]=b)}),g&&this._size(),this.uiDialog.is(":data(resizable)")&&this.uiDialog.resizable("option",f)},_setOption:function(b,d){var e=this,f=e.uiDialog;switch(b){case"beforeclose":b="beforeClose";break;case"buttons":e._createButtons(d);break;case"closeText":e.uiDialogTitlebarCloseText.text(""+d);break;case"dialogClass":f.removeClass(e.options.dialogClass).addClass(c+d);break;case"disabled":d?f.addClass("ui-dialog-disabled"):f.removeClass("ui-dialog-disabled");break;case"draggable":var g=f.is(":data(draggable)");g&&!d&&f.draggable("destroy"),!g&&d&&e._makeDraggable();break;case"position":e._position(d);break;case"resizable":var h=f.is(":data(resizable)");h&&!d&&f.resizable("destroy"),h&&typeof d=="string"&&f.resizable("option","handles",d),!h&&d!==!1&&e._makeResizable(d);break;case"title":a(".ui-dialog-title",e.uiDialogTitlebar).html(""+(d||"&#160;"))}a.Widget.prototype._setOption.apply(e,arguments)},_size:function(){var b=this.options,c,d,e=this.uiDialog.is(":visible");this.element.show().css({width:"auto",minHeight:0,height:0}),b.minWidth>b.width&&(b.width=b.minWidth),c=this.uiDialog.css({height:"auto",width:b.width}).height(),d=Math.max(0,b.minHeight-c);if(b.height==="auto")if(a.support.minHeight)this.element.css({minHeight:d,height:"auto"});else{this.uiDialog.show();var f=this.element.css("height","auto").height();e||this.uiDialog.hide(),this.element.height(Math.max(f,d))}else this.element.height(Math.max(b.height-c,0));this.uiDialog.is(":data(resizable)")&&this.uiDialog.resizable("option","minHeight",this._minHeight())}}),a.extend(a.ui.dialog,{version:"1.8.23",uuid:0,maxZ:0,getTitleId:function(a){var b=a.attr("id");return b||(this.uuid+=1,b=this.uuid),"ui-dialog-title-"+b},overlay:function(b){this.$el=a.ui.dialog.overlay.create(b)}}),a.extend(a.ui.dialog.overlay,{instances:[],oldInstances:[],maxZ:0,events:a.map("focus,mousedown,mouseup,keydown,keypress,click".split(","),function(a){return a+".dialog-overlay"}).join(" "),create:function(b){this.instances.length===0&&(setTimeout(function(){a.ui.dialog.overlay.instances.length&&a(document).bind(a.ui.dialog.overlay.events,function(b){if(a(b.target).zIndex()<a.ui.dialog.overlay.maxZ)return!1})},1),a(document).bind("keydown.dialog-overlay",function(c){b.options.closeOnEscape&&!c.isDefaultPrevented()&&c.keyCode&&c.keyCode===a.ui.keyCode.ESCAPE&&(b.close(c),c.preventDefault())}),a(window).bind("resize.dialog-overlay",a.ui.dialog.overlay.resize));var c=(this.oldInstances.pop()||a("<div></div>").addClass("ui-widget-overlay")).appendTo(document.body).css({width:this.width(),height:this.height()});return a.fn.bgiframe&&c.bgiframe(),this.instances.push(c),c},destroy:function(b){var c=a.inArray(b,this.instances);c!=-1&&this.oldInstances.push(this.instances.splice(c,1)[0]),this.instances.length===0&&a([document,window]).unbind(".dialog-overlay"),b.remove();var d=0;a.each(this.instances,function(){d=Math.max(d,this.css("z-index"))}),this.maxZ=d},height:function(){var b,c;return a.browser.msie&&a.browser.version<7?(b=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight),c=Math.max(document.documentElement.offsetHeight,document.body.offsetHeight),b<c?a(window).height()+"px":b+"px"):a(document).height()+"px"},width:function(){var b,c;return a.browser.msie?(b=Math.max(document.documentElement.scrollWidth,document.body.scrollWidth),c=Math.max(document.documentElement.offsetWidth,document.body.offsetWidth),b<c?a(window).width()+"px":b+"px"):a(document).width()+"px"},resize:function(){var b=a([]);a.each(a.ui.dialog.overlay.instances,function(){b=b.add(this)}),b.css({width:0,height:0}).css({width:a.ui.dialog.overlay.width(),height:a.ui.dialog.overlay.height()})}}),a.extend(a.ui.dialog.overlay.prototype,{destroy:function(){a.ui.dialog.overlay.destroy(this.$el)}})})(jQuery);;/*! jQuery UI - v1.8.23 - 2012-08-15+* https://github.com/jquery/jquery-ui+* Includes: jquery.ui.slider.js+* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */+(function(a,b){var c=5;a.widget("ui.slider",a.ui.mouse,{widgetEventPrefix:"slide",options:{animate:!1,distance:0,max:100,min:0,orientation:"horizontal",range:!1,step:1,value:0,values:null},_create:function(){var b=this,d=this.options,e=this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),f="<a class='ui-slider-handle ui-state-default ui-corner-all' href='#'></a>",g=d.values&&d.values.length||1,h=[];this._keySliding=!1,this._mouseSliding=!1,this._animateOff=!0,this._handleIndex=null,this._detectOrientation(),this._mouseInit(),this.element.addClass("ui-slider ui-slider-"+this.orientation+" ui-widget"+" ui-widget-content"+" ui-corner-all"+(d.disabled?" ui-slider-disabled ui-disabled":"")),this.range=a([]),d.range&&(d.range===!0&&(d.values||(d.values=[this._valueMin(),this._valueMin()]),d.values.length&&d.values.length!==2&&(d.values=[d.values[0],d.values[0]])),this.range=a("<div></div>").appendTo(this.element).addClass("ui-slider-range ui-widget-header"+(d.range==="min"||d.range==="max"?" ui-slider-range-"+d.range:"")));for(var i=e.length;i<g;i+=1)h.push(f);this.handles=e.add(a(h.join("")).appendTo(b.element)),this.handle=this.handles.eq(0),this.handles.add(this.range).filter("a").click(function(a){a.preventDefault()}).hover(function(){d.disabled||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")}).focus(function(){d.disabled?a(this).blur():(a(".ui-slider .ui-state-focus").removeClass("ui-state-focus"),a(this).addClass("ui-state-focus"))}).blur(function(){a(this).removeClass("ui-state-focus")}),this.handles.each(function(b){a(this).data("index.ui-slider-handle",b)}),this.handles.keydown(function(d){var e=a(this).data("index.ui-slider-handle"),f,g,h,i;if(b.options.disabled)return;switch(d.keyCode){case a.ui.keyCode.HOME:case a.ui.keyCode.END:case a.ui.keyCode.PAGE_UP:case a.ui.keyCode.PAGE_DOWN:case a.ui.keyCode.UP:case a.ui.keyCode.RIGHT:case a.ui.keyCode.DOWN:case a.ui.keyCode.LEFT:d.preventDefault();if(!b._keySliding){b._keySliding=!0,a(this).addClass("ui-state-active"),f=b._start(d,e);if(f===!1)return}}i=b.options.step,b.options.values&&b.options.values.length?g=h=b.values(e):g=h=b.value();switch(d.keyCode){case a.ui.keyCode.HOME:h=b._valueMin();break;case a.ui.keyCode.END:h=b._valueMax();break;case a.ui.keyCode.PAGE_UP:h=b._trimAlignValue(g+(b._valueMax()-b._valueMin())/c);break;case a.ui.keyCode.PAGE_DOWN:h=b._trimAlignValue(g-(b._valueMax()-b._valueMin())/c);break;case a.ui.keyCode.UP:case a.ui.keyCode.RIGHT:if(g===b._valueMax())return;h=b._trimAlignValue(g+i);break;case a.ui.keyCode.DOWN:case a.ui.keyCode.LEFT:if(g===b._valueMin())return;h=b._trimAlignValue(g-i)}b._slide(d,e,h)}).keyup(function(c){var d=a(this).data("index.ui-slider-handle");b._keySliding&&(b._keySliding=!1,b._stop(c,d),b._change(c,d),a(this).removeClass("ui-state-active"))}),this._refreshValue(),this._animateOff=!1},destroy:function(){return this.handles.remove(),this.range.remove(),this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-slider-disabled ui-widget ui-widget-content ui-corner-all").removeData("slider").unbind(".slider"),this._mouseDestroy(),this},_mouseCapture:function(b){var c=this.options,d,e,f,g,h,i,j,k,l;return c.disabled?!1:(this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()},this.elementOffset=this.element.offset(),d={x:b.pageX,y:b.pageY},e=this._normValueFromMouse(d),f=this._valueMax()-this._valueMin()+1,h=this,this.handles.each(function(b){var c=Math.abs(e-h.values(b));f>c&&(f=c,g=a(this),i=b)}),c.range===!0&&this.values(1)===c.min&&(i+=1,g=a(this.handles[i])),j=this._start(b,i),j===!1?!1:(this._mouseSliding=!0,h._handleIndex=i,g.addClass("ui-state-active").focus(),k=g.offset(),l=!a(b.target).parents().andSelf().is(".ui-slider-handle"),this._clickOffset=l?{left:0,top:0}:{left:b.pageX-k.left-g.width()/2,top:b.pageY-k.top-g.height()/2-(parseInt(g.css("borderTopWidth"),10)||0)-(parseInt(g.css("borderBottomWidth"),10)||0)+(parseInt(g.css("marginTop"),10)||0)},this.handles.hasClass("ui-state-hover")||this._slide(b,i,e),this._animateOff=!0,!0))},_mouseStart:function(a){return!0},_mouseDrag:function(a){var b={x:a.pageX,y:a.pageY},c=this._normValueFromMouse(b);return this._slide(a,this._handleIndex,c),!1},_mouseStop:function(a){return this.handles.removeClass("ui-state-active"),this._mouseSliding=!1,this._stop(a,this._handleIndex),this._change(a,this._handleIndex),this._handleIndex=null,this._clickOffset=null,this._animateOff=!1,!1},_detectOrientation:function(){this.orientation=this.options.orientation==="vertical"?"vertical":"horizontal"},_normValueFromMouse:function(a){var b,c,d,e,f;return this.orientation==="horizontal"?(b=this.elementSize.width,c=a.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(b=this.elementSize.height,c=a.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)),d=c/b,d>1&&(d=1),d<0&&(d=0),this.orientation==="vertical"&&(d=1-d),e=this._valueMax()-this._valueMin(),f=this._valueMin()+d*e,this._trimAlignValue(f)},_start:function(a,b){var c={handle:this.handles[b],value:this.value()};return this.options.values&&this.options.values.length&&(c.value=this.values(b),c.values=this.values()),this._trigger("start",a,c)},_slide:function(a,b,c){var d,e,f;this.options.values&&this.options.values.length?(d=this.values(b?0:1),this.options.values.length===2&&this.options.range===!0&&(b===0&&c>d||b===1&&c<d)&&(c=d),c!==this.values(b)&&(e=this.values(),e[b]=c,f=this._trigger("slide",a,{handle:this.handles[b],value:c,values:e}),d=this.values(b?0:1),f!==!1&&this.values(b,c,!0))):c!==this.value()&&(f=this._trigger("slide",a,{handle:this.handles[b],value:c}),f!==!1&&this.value(c))},_stop:function(a,b){var c={handle:this.handles[b],value:this.value()};this.options.values&&this.options.values.length&&(c.value=this.values(b),c.values=this.values()),this._trigger("stop",a,c)},_change:function(a,b){if(!this._keySliding&&!this._mouseSliding){var c={handle:this.handles[b],value:this.value()};this.options.values&&this.options.values.length&&(c.value=this.values(b),c.values=this.values()),this._trigger("change",a,c)}},value:function(a){if(arguments.length){this.options.value=this._trimAlignValue(a),this._refreshValue(),this._change(null,0);return}return this._value()},values:function(b,c){var d,e,f;if(arguments.length>1){this.options.values[b]=this._trimAlignValue(c),this._refreshValue(),this._change(null,b);return}if(!arguments.length)return this._values();if(!a.isArray(arguments[0]))return this.options.values&&this.options.values.length?this._values(b):this.value();d=this.options.values,e=arguments[0];for(f=0;f<d.length;f+=1)d[f]=this._trimAlignValue(e[f]),this._change(null,f);this._refreshValue()},_setOption:function(b,c){var d,e=0;a.isArray(this.options.values)&&(e=this.options.values.length),a.Widget.prototype._setOption.apply(this,arguments);switch(b){case"disabled":c?(this.handles.filter(".ui-state-focus").blur(),this.handles.removeClass("ui-state-hover"),this.handles.propAttr("disabled",!0),this.element.addClass("ui-disabled")):(this.handles.propAttr("disabled",!1),this.element.removeClass("ui-disabled"));break;case"orientation":this._detectOrientation(),this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation),this._refreshValue();break;case"value":this._animateOff=!0,this._refreshValue(),this._change(null,0),this._animateOff=!1;break;case"values":this._animateOff=!0,this._refreshValue();for(d=0;d<e;d+=1)this._change(null,d);this._animateOff=!1}},_value:function(){var a=this.options.value;return a=this._trimAlignValue(a),a},_values:function(a){var b,c,d;if(arguments.length)return b=this.options.values[a],b=this._trimAlignValue(b),b;c=this.options.values.slice();for(d=0;d<c.length;d+=1)c[d]=this._trimAlignValue(c[d]);return c},_trimAlignValue:function(a){if(a<=this._valueMin())return this._valueMin();if(a>=this._valueMax())return this._valueMax();var b=this.options.step>0?this.options.step:1,c=(a-this._valueMin())%b,d=a-c;return Math.abs(c)*2>=b&&(d+=c>0?b:-b),parseFloat(d.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max},_refreshValue:function(){var b=this.options.range,c=this.options,d=this,e=this._animateOff?!1:c.animate,f,g={},h,i,j,k;this.options.values&&this.options.values.length?this.handles.each(function(b,i){f=(d.values(b)-d._valueMin())/(d._valueMax()-d._valueMin())*100,g[d.orientation==="horizontal"?"left":"bottom"]=f+"%",a(this).stop(1,1)[e?"animate":"css"](g,c.animate),d.options.range===!0&&(d.orientation==="horizontal"?(b===0&&d.range.stop(1,1)[e?"animate":"css"]({left:f+"%"},c.animate),b===1&&d.range[e?"animate":"css"]({width:f-h+"%"},{queue:!1,duration:c.animate})):(b===0&&d.range.stop(1,1)[e?"animate":"css"]({bottom:f+"%"},c.animate),b===1&&d.range[e?"animate":"css"]({height:f-h+"%"},{queue:!1,duration:c.animate}))),h=f}):(i=this.value(),j=this._valueMin(),k=this._valueMax(),f=k!==j?(i-j)/(k-j)*100:0,g[d.orientation==="horizontal"?"left":"bottom"]=f+"%",this.handle.stop(1,1)[e?"animate":"css"](g,c.animate),b==="min"&&this.orientation==="horizontal"&&this.range.stop(1,1)[e?"animate":"css"]({width:f+"%"},c.animate),b==="max"&&this.orientation==="horizontal"&&this.range[e?"animate":"css"]({width:100-f+"%"},{queue:!1,duration:c.animate}),b==="min"&&this.orientation==="vertical"&&this.range.stop(1,1)[e?"animate":"css"]({height:f+"%"},c.animate),b==="max"&&this.orientation==="vertical"&&this.range[e?"animate":"css"]({height:100-f+"%"},{queue:!1,duration:c.animate}))}}),a.extend(a.ui.slider,{version:"1.8.23"})})(jQuery);;/*! jQuery UI - v1.8.23 - 2012-08-15+* https://github.com/jquery/jquery-ui+* Includes: jquery.ui.tabs.js+* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */+(function(a,b){function e(){return++c}function f(){return++d}var c=0,d=0;a.widget("ui.tabs",{options:{add:null,ajaxOptions:null,cache:!1,cookie:null,collapsible:!1,disable:null,disabled:[],enable:null,event:"click",fx:null,idPrefix:"ui-tabs-",load:null,panelTemplate:"<div></div>",remove:null,select:null,show:null,spinner:"<em>Loading&#8230;</em>",tabTemplate:"<li><a href='#{href}'><span>#{label}</span></a></li>"},_create:function(){this._tabify(!0)},_setOption:function(a,b){if(a=="selected"){if(this.options.collapsible&&b==this.options.selected)return;this.select(b)}else this.options[a]=b,this._tabify()},_tabId:function(a){return a.title&&a.title.replace(/\s/g,"_").replace(/[^\w\u00c0-\uFFFF-]/g,"")||this.options.idPrefix+e()},_sanitizeSelector:function(a){return a.replace(/:/g,"\\:")},_cookie:function(){var b=this.cookie||(this.cookie=this.options.cookie.name||"ui-tabs-"+f());return a.cookie.apply(null,[b].concat(a.makeArray(arguments)))},_ui:function(a,b){return{tab:a,panel:b,index:this.anchors.index(a)}},_cleanup:function(){this.lis.filter(".ui-state-processing").removeClass("ui-state-processing").find("span:data(label.tabs)").each(function(){var b=a(this);b.html(b.data("label.tabs")).removeData("label.tabs")})},_tabify:function(c){function m(b,c){b.css("display",""),!a.support.opacity&&c.opacity&&b[0].style.removeAttribute("filter")}var d=this,e=this.options,f=/^#.+/;this.list=this.element.find("ol,ul").eq(0),this.lis=a(" > li:has(a[href])",this.list),this.anchors=this.lis.map(function(){return a("a",this)[0]}),this.panels=a([]),this.anchors.each(function(b,c){var g=a(c).attr("href"),h=g.split("#")[0],i;h&&(h===location.toString().split("#")[0]||(i=a("base")[0])&&h===i.href)&&(g=c.hash,c.href=g);if(f.test(g))d.panels=d.panels.add(d.element.find(d._sanitizeSelector(g)));else if(g&&g!=="#"){a.data(c,"href.tabs",g),a.data(c,"load.tabs",g.replace(/#.*$/,""));var j=d._tabId(c);c.href="#"+j;var k=d.element.find("#"+j);k.length||(k=a(e.panelTemplate).attr("id",j).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").insertAfter(d.panels[b-1]||d.list),k.data("destroy.tabs",!0)),d.panels=d.panels.add(k)}else e.disabled.push(b)}),c?(this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all"),this.list.addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all"),this.lis.addClass("ui-state-default ui-corner-top"),this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom"),e.selected===b?(location.hash&&this.anchors.each(function(a,b){if(b.hash==location.hash)return e.selected=a,!1}),typeof e.selected!="number"&&e.cookie&&(e.selected=parseInt(d._cookie(),10)),typeof e.selected!="number"&&this.lis.filter(".ui-tabs-selected").length&&(e.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"))),e.selected=e.selected||(this.lis.length?0:-1)):e.selected===null&&(e.selected=-1),e.selected=e.selected>=0&&this.anchors[e.selected]||e.selected<0?e.selected:0,e.disabled=a.unique(e.disabled.concat(a.map(this.lis.filter(".ui-state-disabled"),function(a,b){return d.lis.index(a)}))).sort(),a.inArray(e.selected,e.disabled)!=-1&&e.disabled.splice(a.inArray(e.selected,e.disabled),1),this.panels.addClass("ui-tabs-hide"),this.lis.removeClass("ui-tabs-selected ui-state-active"),e.selected>=0&&this.anchors.length&&(d.element.find(d._sanitizeSelector(d.anchors[e.selected].hash)).removeClass("ui-tabs-hide"),this.lis.eq(e.selected).addClass("ui-tabs-selected ui-state-active"),d.element.queue("tabs",function(){d._trigger("show",null,d._ui(d.anchors[e.selected],d.element.find(d._sanitizeSelector(d.anchors[e.selected].hash))[0]))}),this.load(e.selected)),a(window).bind("unload",function(){d.lis.add(d.anchors).unbind(".tabs"),d.lis=d.anchors=d.panels=null})):e.selected=this.lis.index(this.lis.filter(".ui-tabs-selected")),this.element[e.collapsible?"addClass":"removeClass"]("ui-tabs-collapsible"),e.cookie&&this._cookie(e.selected,e.cookie);for(var g=0,h;h=this.lis[g];g++)a(h)[a.inArray(g,e.disabled)!=-1&&!a(h).hasClass("ui-tabs-selected")?"addClass":"removeClass"]("ui-state-disabled");e.cache===!1&&this.anchors.removeData("cache.tabs"),this.lis.add(this.anchors).unbind(".tabs");if(e.event!=="mouseover"){var i=function(a,b){b.is(":not(.ui-state-disabled)")&&b.addClass("ui-state-"+a)},j=function(a,b){b.removeClass("ui-state-"+a)};this.lis.bind("mouseover.tabs",function(){i("hover",a(this))}),this.lis.bind("mouseout.tabs",function(){j("hover",a(this))}),this.anchors.bind("focus.tabs",function(){i("focus",a(this).closest("li"))}),this.anchors.bind("blur.tabs",function(){j("focus",a(this).closest("li"))})}var k,l;e.fx&&(a.isArray(e.fx)?(k=e.fx[0],l=e.fx[1]):k=l=e.fx);var n=l?function(b,c){a(b).closest("li").addClass("ui-tabs-selected ui-state-active"),c.hide().removeClass("ui-tabs-hide").animate(l,l.duration||"normal",function(){m(c,l),d._trigger("show",null,d._ui(b,c[0]))})}:function(b,c){a(b).closest("li").addClass("ui-tabs-selected ui-state-active"),c.removeClass("ui-tabs-hide"),d._trigger("show",null,d._ui(b,c[0]))},o=k?function(a,b){b.animate(k,k.duration||"normal",function(){d.lis.removeClass("ui-tabs-selected ui-state-active"),b.addClass("ui-tabs-hide"),m(b,k),d.element.dequeue("tabs")})}:function(a,b,c){d.lis.removeClass("ui-tabs-selected ui-state-active"),b.addClass("ui-tabs-hide"),d.element.dequeue("tabs")};this.anchors.bind(e.event+".tabs",function(){var b=this,c=a(b).closest("li"),f=d.panels.filter(":not(.ui-tabs-hide)"),g=d.element.find(d._sanitizeSelector(b.hash));if(c.hasClass("ui-tabs-selected")&&!e.collapsible||c.hasClass("ui-state-disabled")||c.hasClass("ui-state-processing")||d.panels.filter(":animated").length||d._trigger("select",null,d._ui(this,g[0]))===!1)return this.blur(),!1;e.selected=d.anchors.index(this),d.abort();if(e.collapsible){if(c.hasClass("ui-tabs-selected"))return e.selected=-1,e.cookie&&d._cookie(e.selected,e.cookie),d.element.queue("tabs",function(){o(b,f)}).dequeue("tabs"),this.blur(),!1;if(!f.length)return e.cookie&&d._cookie(e.selected,e.cookie),d.element.queue("tabs",function(){n(b,g)}),d.load(d.anchors.index(this)),this.blur(),!1}e.cookie&&d._cookie(e.selected,e.cookie);if(g.length)f.length&&d.element.queue("tabs",function(){o(b,f)}),d.element.queue("tabs",function(){n(b,g)}),d.load(d.anchors.index(this));else throw"jQuery UI Tabs: Mismatching fragment identifier.";a.browser.msie&&this.blur()}),this.anchors.bind("click.tabs",function(){return!1})},_getIndex:function(a){return typeof a=="string"&&(a=this.anchors.index(this.anchors.filter("[href$='"+a+"']"))),a},destroy:function(){var b=this.options;return this.abort(),this.element.unbind(".tabs").removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible").removeData("tabs"),this.list.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all"),this.anchors.each(function(){var b=a.data(this,"href.tabs");b&&(this.href=b);var c=a(this).unbind(".tabs");a.each(["href","load","cache"],function(a,b){c.removeData(b+".tabs")})}),this.lis.unbind(".tabs").add(this.panels).each(function(){a.data(this,"destroy.tabs")?a(this).remove():a(this).removeClass(["ui-state-default","ui-corner-top","ui-tabs-selected","ui-state-active","ui-state-hover","ui-state-focus","ui-state-disabled","ui-tabs-panel","ui-widget-content","ui-corner-bottom","ui-tabs-hide"].join(" "))}),b.cookie&&this._cookie(null,b.cookie),this},add:function(c,d,e){e===b&&(e=this.anchors.length);var f=this,g=this.options,h=a(g.tabTemplate.replace(/#\{href\}/g,c).replace(/#\{label\}/g,d)),i=c.indexOf("#")?this._tabId(a("a",h)[0]):c.replace("#","");h.addClass("ui-state-default ui-corner-top").data("destroy.tabs",!0);var j=f.element.find("#"+i);return j.length||(j=a(g.panelTemplate).attr("id",i).data("destroy.tabs",!0)),j.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide"),e>=this.lis.length?(h.appendTo(this.list),j.appendTo(this.list[0].parentNode)):(h.insertBefore(this.lis[e]),j.insertBefore(this.panels[e])),g.disabled=a.map(g.disabled,function(a,b){return a>=e?++a:a}),this._tabify(),this.anchors.length==1&&(g.selected=0,h.addClass("ui-tabs-selected ui-state-active"),j.removeClass("ui-tabs-hide"),this.element.queue("tabs",function(){f._trigger("show",null,f._ui(f.anchors[0],f.panels[0]))}),this.load(0)),this._trigger("add",null,this._ui(this.anchors[e],this.panels[e])),this},remove:function(b){b=this._getIndex(b);var c=this.options,d=this.lis.eq(b).remove(),e=this.panels.eq(b).remove();return d.hasClass("ui-tabs-selected")&&this.anchors.length>1&&this.select(b+(b+1<this.anchors.length?1:-1)),c.disabled=a.map(a.grep(c.disabled,function(a,c){return a!=b}),function(a,c){return a>=b?--a:a}),this._tabify(),this._trigger("remove",null,this._ui(d.find("a")[0],e[0])),this},enable:function(b){b=this._getIndex(b);var c=this.options;if(a.inArray(b,c.disabled)==-1)return;return this.lis.eq(b).removeClass("ui-state-disabled"),c.disabled=a.grep(c.disabled,function(a,c){return a!=b}),this._trigger("enable",null,this._ui(this.anchors[b],this.panels[b])),this},disable:function(a){a=this._getIndex(a);var b=this,c=this.options;return a!=c.selected&&(this.lis.eq(a).addClass("ui-state-disabled"),c.disabled.push(a),c.disabled.sort(),this._trigger("disable",null,this._ui(this.anchors[a],this.panels[a]))),this},select:function(a){a=this._getIndex(a);if(a==-1)if(this.options.collapsible&&this.options.selected!=-1)a=this.options.selected;else return this;return this.anchors.eq(a).trigger(this.options.event+".tabs"),this},load:function(b){b=this._getIndex(b);var c=this,d=this.options,e=this.anchors.eq(b)[0],f=a.data(e,"load.tabs");this.abort();if(!f||this.element.queue("tabs").length!==0&&a.data(e,"cache.tabs")){this.element.dequeue("tabs");return}this.lis.eq(b).addClass("ui-state-processing");if(d.spinner){var g=a("span",e);g.data("label.tabs",g.html()).html(d.spinner)}return this.xhr=a.ajax(a.extend({},d.ajaxOptions,{url:f,success:function(f,g){c.element.find(c._sanitizeSelector(e.hash)).html(f),c._cleanup(),d.cache&&a.data(e,"cache.tabs",!0),c._trigger("load",null,c._ui(c.anchors[b],c.panels[b]));try{d.ajaxOptions.success(f,g)}catch(h){}},error:function(a,f,g){c._cleanup(),c._trigger("load",null,c._ui(c.anchors[b],c.panels[b]));try{d.ajaxOptions.error(a,f,b,e)}catch(g){}}})),c.element.dequeue("tabs"),this},abort:function(){return this.element.queue([]),this.panels.stop(!1,!0),this.element.queue("tabs",this.element.queue("tabs").splice(-2,2)),this.xhr&&(this.xhr.abort(),delete this.xhr),this._cleanup(),this},url:function(a,b){return this.anchors.eq(a).removeData("cache.tabs").data("load.tabs",b),this},length:function(){return this.anchors.length}}),a.extend(a.ui.tabs,{version:"1.8.23"}),a.extend(a.ui.tabs.prototype,{rotation:null,rotate:function(a,b){var c=this,d=this.options,e=c._rotate||(c._rotate=function(b){clearTimeout(c.rotation),c.rotation=setTimeout(function(){var a=d.selected;c.select(++a<c.anchors.length?a:0)},a),b&&b.stopPropagation()}),f=c._unrotate||(c._unrotate=b?function(a){e()}:function(a){a.clientX&&c.rotate(null)});return a?(this.element.bind("tabsshow",e),this.anchors.bind(d.event+".tabs",f),e()):(clearTimeout(c.rotation),this.element.unbind("tabsshow",e),this.anchors.unbind(d.event+".tabs",f),delete this._rotate,delete this._unrotate),this}})})(jQuery);;/*! jQuery UI - v1.8.23 - 2012-08-15+* https://github.com/jquery/jquery-ui+* Includes: jquery.ui.datepicker.js+* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */+(function($,undefined){function Datepicker(){this.debug=!1,this._curInst=null,this._keyEvent=!1,this._disabledInputs=[],this._datepickerShowing=!1,this._inDialog=!1,this._mainDivId="ui-datepicker-div",this._inlineClass="ui-datepicker-inline",this._appendClass="ui-datepicker-append",this._triggerClass="ui-datepicker-trigger",this._dialogClass="ui-datepicker-dialog",this._disableClass="ui-datepicker-disabled",this._unselectableClass="ui-datepicker-unselectable",this._currentClass="ui-datepicker-current-day",this._dayOverClass="ui-datepicker-days-cell-over",this.regional=[],this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:!1,showMonthAfterYear:!1,yearSuffix:""},this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:!1,hideIfNoPrevNext:!1,navigationAsDateFormat:!1,gotoCurrent:!1,changeMonth:!1,changeYear:!1,yearRange:"c-10:c+10",showOtherMonths:!1,selectOtherMonths:!1,showWeek:!1,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:!0,showButtonPanel:!1,autoSize:!1,disabled:!1},$.extend(this._defaults,this.regional[""]),this.dpDiv=bindHover($('<div id="'+this._mainDivId+'" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>'))}function bindHover(a){var b="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return a.bind("mouseout",function(a){var c=$(a.target).closest(b);if(!c.length)return;c.removeClass("ui-state-hover ui-datepicker-prev-hover ui-datepicker-next-hover")}).bind("mouseover",function(c){var d=$(c.target).closest(b);if($.datepicker._isDisabledDatepicker(instActive.inline?a.parent()[0]:instActive.input[0])||!d.length)return;d.parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"),d.addClass("ui-state-hover"),d.hasClass("ui-datepicker-prev")&&d.addClass("ui-datepicker-prev-hover"),d.hasClass("ui-datepicker-next")&&d.addClass("ui-datepicker-next-hover")})}function extendRemove(a,b){$.extend(a,b);for(var c in b)if(b[c]==null||b[c]==undefined)a[c]=b[c];return a}function isArray(a){return a&&($.browser.safari&&typeof a=="object"&&a.length||a.constructor&&a.constructor.toString().match(/\Array\(\)/))}$.extend($.ui,{datepicker:{version:"1.8.23"}});var PROP_NAME="datepicker",dpuuid=(new Date).getTime(),instActive;$.extend(Datepicker.prototype,{markerClassName:"hasDatepicker",maxRows:4,log:function(){this.debug&&console.log.apply("",arguments)},_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(a){return extendRemove(this._defaults,a||{}),this},_attachDatepicker:function(target,settings){var inlineSettings=null;for(var attrName in this._defaults){var attrValue=target.getAttribute("date:"+attrName);if(attrValue){inlineSettings=inlineSettings||{};try{inlineSettings[attrName]=eval(attrValue)}catch(err){inlineSettings[attrName]=attrValue}}}var nodeName=target.nodeName.toLowerCase(),inline=nodeName=="div"||nodeName=="span";target.id||(this.uuid+=1,target.id="dp"+this.uuid);var inst=this._newInst($(target),inline);inst.settings=$.extend({},settings||{},inlineSettings||{}),nodeName=="input"?this._connectDatepicker(target,inst):inline&&this._inlineDatepicker(target,inst)},_newInst:function(a,b){var c=a[0].id.replace(/([^A-Za-z0-9_-])/g,"\\\\$1");return{id:c,input:a,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:b,dpDiv:b?bindHover($('<div class="'+this._inlineClass+' ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>')):this.dpDiv}},_connectDatepicker:function(a,b){var c=$(a);b.append=$([]),b.trigger=$([]);if(c.hasClass(this.markerClassName))return;this._attachments(c,b),c.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp).bind("setData.datepicker",function(a,c,d){b.settings[c]=d}).bind("getData.datepicker",function(a,c){return this._get(b,c)}),this._autoSize(b),$.data(a,PROP_NAME,b),b.settings.disabled&&this._disableDatepicker(a)},_attachments:function(a,b){var c=this._get(b,"appendText"),d=this._get(b,"isRTL");b.append&&b.append.remove(),c&&(b.append=$('<span class="'+this._appendClass+'">'+c+"</span>"),a[d?"before":"after"](b.append)),a.unbind("focus",this._showDatepicker),b.trigger&&b.trigger.remove();var e=this._get(b,"showOn");(e=="focus"||e=="both")&&a.focus(this._showDatepicker);if(e=="button"||e=="both"){var f=this._get(b,"buttonText"),g=this._get(b,"buttonImage");b.trigger=$(this._get(b,"buttonImageOnly")?$("<img/>").addClass(this._triggerClass).attr({src:g,alt:f,title:f}):$('<button type="button"></button>').addClass(this._triggerClass).html(g==""?f:$("<img/>").attr({src:g,alt:f,title:f}))),a[d?"before":"after"](b.trigger),b.trigger.click(function(){return $.datepicker._datepickerShowing&&$.datepicker._lastInput==a[0]?$.datepicker._hideDatepicker():$.datepicker._datepickerShowing&&$.datepicker._lastInput!=a[0]?($.datepicker._hideDatepicker(),$.datepicker._showDatepicker(a[0])):$.datepicker._showDatepicker(a[0]),!1})}},_autoSize:function(a){if(this._get(a,"autoSize")&&!a.inline){var b=new Date(2009,11,20),c=this._get(a,"dateFormat");if(c.match(/[DM]/)){var d=function(a){var b=0,c=0;for(var d=0;d<a.length;d++)a[d].length>b&&(b=a[d].length,c=d);return c};b.setMonth(d(this._get(a,c.match(/MM/)?"monthNames":"monthNamesShort"))),b.setDate(d(this._get(a,c.match(/DD/)?"dayNames":"dayNamesShort"))+20-b.getDay())}a.input.attr("size",this._formatDate(a,b).length)}},_inlineDatepicker:function(a,b){var c=$(a);if(c.hasClass(this.markerClassName))return;c.addClass(this.markerClassName).append(b.dpDiv).bind("setData.datepicker",function(a,c,d){b.settings[c]=d}).bind("getData.datepicker",function(a,c){return this._get(b,c)}),$.data(a,PROP_NAME,b),this._setDate(b,this._getDefaultDate(b),!0),this._updateDatepicker(b),this._updateAlternate(b),b.settings.disabled&&this._disableDatepicker(a),b.dpDiv.css("display","block")},_dialogDatepicker:function(a,b,c,d,e){var f=this._dialogInst;if(!f){this.uuid+=1;var g="dp"+this.uuid;this._dialogInput=$('<input type="text" id="'+g+'" style="position: absolute; top: -100px; width: 0px;"/>'),this._dialogInput.keydown(this._doKeyDown),$("body").append(this._dialogInput),f=this._dialogInst=this._newInst(this._dialogInput,!1),f.settings={},$.data(this._dialogInput[0],PROP_NAME,f)}extendRemove(f.settings,d||{}),b=b&&b.constructor==Date?this._formatDate(f,b):b,this._dialogInput.val(b),this._pos=e?e.length?e:[e.pageX,e.pageY]:null;if(!this._pos){var h=document.documentElement.clientWidth,i=document.documentElement.clientHeight,j=document.documentElement.scrollLeft||document.body.scrollLeft,k=document.documentElement.scrollTop||document.body.scrollTop;this._pos=[h/2-100+j,i/2-150+k]}return this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px"),f.settings.onSelect=c,this._inDialog=!0,this.dpDiv.addClass(this._dialogClass),this._showDatepicker(this._dialogInput[0]),$.blockUI&&$.blockUI(this.dpDiv),$.data(this._dialogInput[0],PROP_NAME,f),this},_destroyDatepicker:function(a){var b=$(a),c=$.data(a,PROP_NAME);if(!b.hasClass(this.markerClassName))return;var d=a.nodeName.toLowerCase();$.removeData(a,PROP_NAME),d=="input"?(c.append.remove(),c.trigger.remove(),b.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)):(d=="div"||d=="span")&&b.removeClass(this.markerClassName).empty()},_enableDatepicker:function(a){var b=$(a),c=$.data(a,PROP_NAME);if(!b.hasClass(this.markerClassName))return;var d=a.nodeName.toLowerCase();if(d=="input")a.disabled=!1,c.trigger.filter("button").each(function(){this.disabled=!1}).end().filter("img").css({opacity:"1.0",cursor:""});else if(d=="div"||d=="span"){var e=b.children("."+this._inlineClass);e.children().removeClass("ui-state-disabled"),e.find("select.ui-datepicker-month, select.ui-datepicker-year").removeAttr("disabled")}this._disabledInputs=$.map(this._disabledInputs,function(b){return b==a?null:b})},_disableDatepicker:function(a){var b=$(a),c=$.data(a,PROP_NAME);if(!b.hasClass(this.markerClassName))return;var d=a.nodeName.toLowerCase();if(d=="input")a.disabled=!0,c.trigger.filter("button").each(function(){this.disabled=!0}).end().filter("img").css({opacity:"0.5",cursor:"default"});else if(d=="div"||d=="span"){var e=b.children("."+this._inlineClass);e.children().addClass("ui-state-disabled"),e.find("select.ui-datepicker-month, select.ui-datepicker-year").attr("disabled","disabled")}this._disabledInputs=$.map(this._disabledInputs,function(b){return b==a?null:b}),this._disabledInputs[this._disabledInputs.length]=a},_isDisabledDatepicker:function(a){if(!a)return!1;for(var b=0;b<this._disabledInputs.length;b++)if(this._disabledInputs[b]==a)return!0;return!1},_getInst:function(a){try{return $.data(a,PROP_NAME)}catch(b){throw"Missing instance data for this datepicker"}},_optionDatepicker:function(a,b,c){var d=this._getInst(a);if(arguments.length==2&&typeof b=="string")return b=="defaults"?$.extend({},$.datepicker._defaults):d?b=="all"?$.extend({},d.settings):this._get(d,b):null;var e=b||{};typeof b=="string"&&(e={},e[b]=c);if(d){this._curInst==d&&this._hideDatepicker();var f=this._getDateDatepicker(a,!0),g=this._getMinMaxDate(d,"min"),h=this._getMinMaxDate(d,"max");extendRemove(d.settings,e),g!==null&&e.dateFormat!==undefined&&e.minDate===undefined&&(d.settings.minDate=this._formatDate(d,g)),h!==null&&e.dateFormat!==undefined&&e.maxDate===undefined&&(d.settings.maxDate=this._formatDate(d,h)),this._attachments($(a),d),this._autoSize(d),this._setDate(d,f),this._updateAlternate(d),this._updateDatepicker(d)}},_changeDatepicker:function(a,b,c){this._optionDatepicker(a,b,c)},_refreshDatepicker:function(a){var b=this._getInst(a);b&&this._updateDatepicker(b)},_setDateDatepicker:function(a,b){var c=this._getInst(a);c&&(this._setDate(c,b),this._updateDatepicker(c),this._updateAlternate(c))},_getDateDatepicker:function(a,b){var c=this._getInst(a);return c&&!c.inline&&this._setDateFromField(c,b),c?this._getDate(c):null},_doKeyDown:function(a){var b=$.datepicker._getInst(a.target),c=!0,d=b.dpDiv.is(".ui-datepicker-rtl");b._keyEvent=!0;if($.datepicker._datepickerShowing)switch(a.keyCode){case 9:$.datepicker._hideDatepicker(),c=!1;break;case 13:var e=$("td."+$.datepicker._dayOverClass+":not(."+$.datepicker._currentClass+")",b.dpDiv);e[0]&&$.datepicker._selectDay(a.target,b.selectedMonth,b.selectedYear,e[0]);var f=$.datepicker._get(b,"onSelect");if(f){var g=$.datepicker._formatDate(b);f.apply(b.input?b.input[0]:null,[g,b])}else $.datepicker._hideDatepicker();return!1;case 27:$.datepicker._hideDatepicker();break;case 33:$.datepicker._adjustDate(a.target,a.ctrlKey?-$.datepicker._get(b,"stepBigMonths"):-$.datepicker._get(b,"stepMonths"),"M");break;case 34:$.datepicker._adjustDate(a.target,a.ctrlKey?+$.datepicker._get(b,"stepBigMonths"):+$.datepicker._get(b,"stepMonths"),"M");break;case 35:(a.ctrlKey||a.metaKey)&&$.datepicker._clearDate(a.target),c=a.ctrlKey||a.metaKey;break;case 36:(a.ctrlKey||a.metaKey)&&$.datepicker._gotoToday(a.target),c=a.ctrlKey||a.metaKey;break;case 37:(a.ctrlKey||a.metaKey)&&$.datepicker._adjustDate(a.target,d?1:-1,"D"),c=a.ctrlKey||a.metaKey,a.originalEvent.altKey&&$.datepicker._adjustDate(a.target,a.ctrlKey?-$.datepicker._get(b,"stepBigMonths"):-$.datepicker._get(b,"stepMonths"),"M");break;case 38:(a.ctrlKey||a.metaKey)&&$.datepicker._adjustDate(a.target,-7,"D"),c=a.ctrlKey||a.metaKey;break;case 39:(a.ctrlKey||a.metaKey)&&$.datepicker._adjustDate(a.target,d?-1:1,"D"),c=a.ctrlKey||a.metaKey,a.originalEvent.altKey&&$.datepicker._adjustDate(a.target,a.ctrlKey?+$.datepicker._get(b,"stepBigMonths"):+$.datepicker._get(b,"stepMonths"),"M");break;case 40:(a.ctrlKey||a.metaKey)&&$.datepicker._adjustDate(a.target,7,"D"),c=a.ctrlKey||a.metaKey;break;default:c=!1}else a.keyCode==36&&a.ctrlKey?$.datepicker._showDatepicker(this):c=!1;c&&(a.preventDefault(),a.stopPropagation())},_doKeyPress:function(a){var b=$.datepicker._getInst(a.target);if($.datepicker._get(b,"constrainInput")){var c=$.datepicker._possibleChars($.datepicker._get(b,"dateFormat")),d=String.fromCharCode(a.charCode==undefined?a.keyCode:a.charCode);return a.ctrlKey||a.metaKey||d<" "||!c||c.indexOf(d)>-1}},_doKeyUp:function(a){var b=$.datepicker._getInst(a.target);if(b.input.val()!=b.lastVal)try{var c=$.datepicker.parseDate($.datepicker._get(b,"dateFormat"),b.input?b.input.val():null,$.datepicker._getFormatConfig(b));c&&($.datepicker._setDateFromField(b),$.datepicker._updateAlternate(b),$.datepicker._updateDatepicker(b))}catch(d){$.datepicker.log(d)}return!0},_showDatepicker:function(a){a=a.target||a,a.nodeName.toLowerCase()!="input"&&(a=$("input",a.parentNode)[0]);if($.datepicker._isDisabledDatepicker(a)||$.datepicker._lastInput==a)return;var b=$.datepicker._getInst(a);$.datepicker._curInst&&$.datepicker._curInst!=b&&($.datepicker._curInst.dpDiv.stop(!0,!0),b&&$.datepicker._datepickerShowing&&$.datepicker._hideDatepicker($.datepicker._curInst.input[0]));var c=$.datepicker._get(b,"beforeShow"),d=c?c.apply(a,[a,b]):{};if(d===!1)return;extendRemove(b.settings,d),b.lastVal=null,$.datepicker._lastInput=a,$.datepicker._setDateFromField(b),$.datepicker._inDialog&&(a.value=""),$.datepicker._pos||($.datepicker._pos=$.datepicker._findPos(a),$.datepicker._pos[1]+=a.offsetHeight);var e=!1;$(a).parents().each(function(){return e|=$(this).css("position")=="fixed",!e}),e&&$.browser.opera&&($.datepicker._pos[0]-=document.documentElement.scrollLeft,$.datepicker._pos[1]-=document.documentElement.scrollTop);var f={left:$.datepicker._pos[0],top:$.datepicker._pos[1]};$.datepicker._pos=null,b.dpDiv.empty(),b.dpDiv.css({position:"absolute",display:"block",top:"-1000px"}),$.datepicker._updateDatepicker(b),f=$.datepicker._checkOffset(b,f,e),b.dpDiv.css({position:$.datepicker._inDialog&&$.blockUI?"static":e?"fixed":"absolute",display:"none",left:f.left+"px",top:f.top+"px"});if(!b.inline){var g=$.datepicker._get(b,"showAnim"),h=$.datepicker._get(b,"duration"),i=function(){var a=b.dpDiv.find("iframe.ui-datepicker-cover");if(!!a.length){var c=$.datepicker._getBorders(b.dpDiv);a.css({left:-c[0],top:-c[1],width:b.dpDiv.outerWidth(),height:b.dpDiv.outerHeight()})}};b.dpDiv.zIndex($(a).zIndex()+1),$.datepicker._datepickerShowing=!0,$.effects&&$.effects[g]?b.dpDiv.show(g,$.datepicker._get(b,"showOptions"),h,i):b.dpDiv[g||"show"](g?h:null,i),(!g||!h)&&i(),b.input.is(":visible")&&!b.input.is(":disabled")&&b.input.focus(),$.datepicker._curInst=b}},_updateDatepicker:function(a){var b=this;b.maxRows=4;var c=$.datepicker._getBorders(a.dpDiv);instActive=a,a.dpDiv.empty().append(this._generateHTML(a)),this._attachHandlers(a);var d=a.dpDiv.find("iframe.ui-datepicker-cover");!d.length||d.css({left:-c[0],top:-c[1],width:a.dpDiv.outerWidth(),height:a.dpDiv.outerHeight()}),a.dpDiv.find("."+this._dayOverClass+" a").mouseover();var e=this._getNumberOfMonths(a),f=e[1],g=17;a.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""),f>1&&a.dpDiv.addClass("ui-datepicker-multi-"+f).css("width",g*f+"em"),a.dpDiv[(e[0]!=1||e[1]!=1?"add":"remove")+"Class"]("ui-datepicker-multi"),a.dpDiv[(this._get(a,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl"),a==$.datepicker._curInst&&$.datepicker._datepickerShowing&&a.input&&a.input.is(":visible")&&!a.input.is(":disabled")&&a.input[0]!=document.activeElement&&a.input.focus();if(a.yearshtml){var h=a.yearshtml;setTimeout(function(){h===a.yearshtml&&a.yearshtml&&a.dpDiv.find("select.ui-datepicker-year:first").replaceWith(a.yearshtml),h=a.yearshtml=null},0)}},_getBorders:function(a){var b=function(a){return{thin:1,medium:2,thick:3}[a]||a};return[parseFloat(b(a.css("border-left-width"))),parseFloat(b(a.css("border-top-width")))]},_checkOffset:function(a,b,c){var d=a.dpDiv.outerWidth(),e=a.dpDiv.outerHeight(),f=a.input?a.input.outerWidth():0,g=a.input?a.input.outerHeight():0,h=document.documentElement.clientWidth+(c?0:$(document).scrollLeft()),i=document.documentElement.clientHeight+(c?0:$(document).scrollTop());return b.left-=this._get(a,"isRTL")?d-f:0,b.left-=c&&b.left==a.input.offset().left?$(document).scrollLeft():0,b.top-=c&&b.top==a.input.offset().top+g?$(document).scrollTop():0,b.left-=Math.min(b.left,b.left+d>h&&h>d?Math.abs(b.left+d-h):0),b.top-=Math.min(b.top,b.top+e>i&&i>e?Math.abs(e+g):0),b},_findPos:function(a){var b=this._getInst(a),c=this._get(b,"isRTL");while(a&&(a.type=="hidden"||a.nodeType!=1||$.expr.filters.hidden(a)))a=a[c?"previousSibling":"nextSibling"];var d=$(a).offset();return[d.left,d.top]},_hideDatepicker:function(a){var b=this._curInst;if(!b||a&&b!=$.data(a,PROP_NAME))return;if(this._datepickerShowing){var c=this._get(b,"showAnim"),d=this._get(b,"duration"),e=function(){$.datepicker._tidyDialog(b)};$.effects&&$.effects[c]?b.dpDiv.hide(c,$.datepicker._get(b,"showOptions"),d,e):b.dpDiv[c=="slideDown"?"slideUp":c=="fadeIn"?"fadeOut":"hide"](c?d:null,e),c||e(),this._datepickerShowing=!1;var f=this._get(b,"onClose");f&&f.apply(b.input?b.input[0]:null,[b.input?b.input.val():"",b]),this._lastInput=null,this._inDialog&&(this._dialogInput.css({position:"absolute",left:"0",top:"-100px"}),$.blockUI&&($.unblockUI(),$("body").append(this.dpDiv))),this._inDialog=!1}},_tidyDialog:function(a){a.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(a){if(!$.datepicker._curInst)return;var b=$(a.target),c=$.datepicker._getInst(b[0]);(b[0].id!=$.datepicker._mainDivId&&b.parents("#"+$.datepicker._mainDivId).length==0&&!b.hasClass($.datepicker.markerClassName)&&!b.closest("."+$.datepicker._triggerClass).length&&$.datepicker._datepickerShowing&&(!$.datepicker._inDialog||!$.blockUI)||b.hasClass($.datepicker.markerClassName)&&$.datepicker._curInst!=c)&&$.datepicker._hideDatepicker()},_adjustDate:function(a,b,c){var d=$(a),e=this._getInst(d[0]);if(this._isDisabledDatepicker(d[0]))return;this._adjustInstDate(e,b+(c=="M"?this._get(e,"showCurrentAtPos"):0),c),this._updateDatepicker(e)},_gotoToday:function(a){var b=$(a),c=this._getInst(b[0]);if(this._get(c,"gotoCurrent")&&c.currentDay)c.selectedDay=c.currentDay,c.drawMonth=c.selectedMonth=c.currentMonth,c.drawYear=c.selectedYear=c.currentYear;else{var d=new Date;c.selectedDay=d.getDate(),c.drawMonth=c.selectedMonth=d.getMonth(),c.drawYear=c.selectedYear=d.getFullYear()}this._notifyChange(c),this._adjustDate(b)},_selectMonthYear:function(a,b,c){var d=$(a),e=this._getInst(d[0]);e["selected"+(c=="M"?"Month":"Year")]=e["draw"+(c=="M"?"Month":"Year")]=parseInt(b.options[b.selectedIndex].value,10),this._notifyChange(e),this._adjustDate(d)},_selectDay:function(a,b,c,d){var e=$(a);if($(d).hasClass(this._unselectableClass)||this._isDisabledDatepicker(e[0]))return;var f=this._getInst(e[0]);f.selectedDay=f.currentDay=$("a",d).html(),f.selectedMonth=f.currentMonth=b,f.selectedYear=f.currentYear=c,this._selectDate(a,this._formatDate(f,f.currentDay,f.currentMonth,f.currentYear))},_clearDate:function(a){var b=$(a),c=this._getInst(b[0]);this._selectDate(b,"")},_selectDate:function(a,b){var c=$(a),d=this._getInst(c[0]);b=b!=null?b:this._formatDate(d),d.input&&d.input.val(b),this._updateAlternate(d);var e=this._get(d,"onSelect");e?e.apply(d.input?d.input[0]:null,[b,d]):d.input&&d.input.trigger("change"),d.inline?this._updateDatepicker(d):(this._hideDatepicker(),this._lastInput=d.input[0],typeof d.input[0]!="object"&&d.input.focus(),this._lastInput=null)},_updateAlternate:function(a){var b=this._get(a,"altField");if(b){var c=this._get(a,"altFormat")||this._get(a,"dateFormat"),d=this._getDate(a),e=this.formatDate(c,d,this._getFormatConfig(a));$(b).each(function(){$(this).val(e)})}},noWeekends:function(a){var b=a.getDay();return[b>0&&b<6,""]},iso8601Week:function(a){var b=new Date(a.getTime());b.setDate(b.getDate()+4-(b.getDay()||7));var c=b.getTime();return b.setMonth(0),b.setDate(1),Math.floor(Math.round((c-b)/864e5)/7)+1},parseDate:function(a,b,c){if(a==null||b==null)throw"Invalid arguments";b=typeof b=="object"?b.toString():b+"";if(b=="")return null;var d=(c?c.shortYearCutoff:null)||this._defaults.shortYearCutoff;d=typeof d!="string"?d:(new Date).getFullYear()%100+parseInt(d,10);var e=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,f=(c?c.dayNames:null)||this._defaults.dayNames,g=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort,h=(c?c.monthNames:null)||this._defaults.monthNames,i=-1,j=-1,k=-1,l=-1,m=!1,n=function(b){var c=s+1<a.length&&a.charAt(s+1)==b;return c&&s++,c},o=function(a){var c=n(a),d=a=="@"?14:a=="!"?20:a=="y"&&c?4:a=="o"?3:2,e=new RegExp("^\\d{1,"+d+"}"),f=b.substring(r).match(e);if(!f)throw"Missing number at position "+r;return r+=f[0].length,parseInt(f[0],10)},p=function(a,c,d){var e=$.map(n(a)?d:c,function(a,b){return[[b,a]]}).sort(function(a,b){return-(a[1].length-b[1].length)}),f=-1;$.each(e,function(a,c){var d=c[1];if(b.substr(r,d.length).toLowerCase()==d.toLowerCase())return f=c[0],r+=d.length,!1});if(f!=-1)return f+1;throw"Unknown name at position "+r},q=function(){if(b.charAt(r)!=a.charAt(s))throw"Unexpected literal at position "+r;r++},r=0;for(var s=0;s<a.length;s++)if(m)a.charAt(s)=="'"&&!n("'")?m=!1:q();else switch(a.charAt(s)){case"d":k=o("d");break;case"D":p("D",e,f);break;case"o":l=o("o");break;case"m":j=o("m");break;case"M":j=p("M",g,h);break;case"y":i=o("y");break;case"@":var t=new Date(o("@"));i=t.getFullYear(),j=t.getMonth()+1,k=t.getDate();break;case"!":var t=new Date((o("!")-this._ticksTo1970)/1e4);i=t.getFullYear(),j=t.getMonth()+1,k=t.getDate();break;case"'":n("'")?q():m=!0;break;default:q()}if(r<b.length)throw"Extra/unparsed characters found in date: "+b.substring(r);i==-1?i=(new Date).getFullYear():i<100&&(i+=(new Date).getFullYear()-(new Date).getFullYear()%100+(i<=d?0:-100));if(l>-1){j=1,k=l;do{var u=this._getDaysInMonth(i,j-1);if(k<=u)break;j++,k-=u}while(!0)}var t=this._daylightSavingAdjust(new Date(i,j-1,k));if(t.getFullYear()!=i||t.getMonth()+1!=j||t.getDate()!=k)throw"Invalid date";return t},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925))*24*60*60*1e7,formatDate:function(a,b,c){if(!b)return"";var d=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,e=(c?c.dayNames:null)||this._defaults.dayNames,f=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort,g=(c?c.monthNames:null)||this._defaults.monthNames,h=function(b){var c=m+1<a.length&&a.charAt(m+1)==b;return c&&m++,c},i=function(a,b,c){var d=""+b;if(h(a))while(d.length<c)d="0"+d;return d},j=function(a,b,c,d){return h(a)?d[b]:c[b]},k="",l=!1;if(b)for(var m=0;m<a.length;m++)if(l)a.charAt(m)=="'"&&!h("'")?l=!1:k+=a.charAt(m);else switch(a.charAt(m)){case"d":k+=i("d",b.getDate(),2);break;case"D":k+=j("D",b.getDay(),d,e);break;case"o":k+=i("o",Math.round(((new Date(b.getFullYear(),b.getMonth(),b.getDate())).getTime()-(new Date(b.getFullYear(),0,0)).getTime())/864e5),3);break;case"m":k+=i("m",b.getMonth()+1,2);break;case"M":k+=j("M",b.getMonth(),f,g);break;case"y":k+=h("y")?b.getFullYear():(b.getYear()%100<10?"0":"")+b.getYear()%100;break;case"@":k+=b.getTime();break;case"!":k+=b.getTime()*1e4+this._ticksTo1970;break;case"'":h("'")?k+="'":l=!0;break;default:k+=a.charAt(m)}return k},_possibleChars:function(a){var b="",c=!1,d=function(b){var c=e+1<a.length&&a.charAt(e+1)==b;return c&&e++,c};for(var e=0;e<a.length;e++)if(c)a.charAt(e)=="'"&&!d("'")?c=!1:b+=a.charAt(e);else switch(a.charAt(e)){case"d":case"m":case"y":case"@":b+="0123456789";break;case"D":case"M":return null;case"'":d("'")?b+="'":c=!0;break;default:b+=a.charAt(e)}return b},_get:function(a,b){return a.settings[b]!==undefined?a.settings[b]:this._defaults[b]},_setDateFromField:function(a,b){if(a.input.val()==a.lastVal)return;var c=this._get(a,"dateFormat"),d=a.lastVal=a.input?a.input.val():null,e,f;e=f=this._getDefaultDate(a);var g=this._getFormatConfig(a);try{e=this.parseDate(c,d,g)||f}catch(h){this.log(h),d=b?"":d}a.selectedDay=e.getDate(),a.drawMonth=a.selectedMonth=e.getMonth(),a.drawYear=a.selectedYear=e.getFullYear(),a.currentDay=d?e.getDate():0,a.currentMonth=d?e.getMonth():0,a.currentYear=d?e.getFullYear():0,this._adjustInstDate(a)},_getDefaultDate:function(a){return this._restrictMinMax(a,this._determineDate(a,this._get(a,"defaultDate"),new Date))},_determineDate:function(a,b,c){var d=function(a){var b=new Date;return b.setDate(b.getDate()+a),b},e=function(b){try{return $.datepicker.parseDate($.datepicker._get(a,"dateFormat"),b,$.datepicker._getFormatConfig(a))}catch(c){}var d=(b.toLowerCase().match(/^c/)?$.datepicker._getDate(a):null)||new Date,e=d.getFullYear(),f=d.getMonth(),g=d.getDate(),h=/([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,i=h.exec(b);while(i){switch(i[2]||"d"){case"d":case"D":g+=parseInt(i[1],10);break;case"w":case"W":g+=parseInt(i[1],10)*7;break;case"m":case"M":f+=parseInt(i[1],10),g=Math.min(g,$.datepicker._getDaysInMonth(e,f));break;case"y":case"Y":e+=parseInt(i[1],10),g=Math.min(g,$.datepicker._getDaysInMonth(e,f))}i=h.exec(b)}return new Date(e,f,g)},f=b==null||b===""?c:typeof b=="string"?e(b):typeof b=="number"?isNaN(b)?c:d(b):new Date(b.getTime());return f=f&&f.toString()=="Invalid Date"?c:f,f&&(f.setHours(0),f.setMinutes(0),f.setSeconds(0),f.setMilliseconds(0)),this._daylightSavingAdjust(f)},_daylightSavingAdjust:function(a){return a?(a.setHours(a.getHours()>12?a.getHours()+2:0),a):null},_setDate:function(a,b,c){var d=!b,e=a.selectedMonth,f=a.selectedYear,g=this._restrictMinMax(a,this._determineDate(a,b,new Date));a.selectedDay=a.currentDay=g.getDate(),a.drawMonth=a.selectedMonth=a.currentMonth=g.getMonth(),a.drawYear=a.selectedYear=a.currentYear=g.getFullYear(),(e!=a.selectedMonth||f!=a.selectedYear)&&!c&&this._notifyChange(a),this._adjustInstDate(a),a.input&&a.input.val(d?"":this._formatDate(a))},_getDate:function(a){var b=!a.currentYear||a.input&&a.input.val()==""?null:this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay));return b},_attachHandlers:function(a){var b=this._get(a,"stepMonths"),c="#"+a.id.replace(/\\\\/g,"\\");a.dpDiv.find("[data-handler]").map(function(){var a={prev:function(){window["DP_jQuery_"+dpuuid].datepicker._adjustDate(c,-b,"M")},next:function(){window["DP_jQuery_"+dpuuid].datepicker._adjustDate(c,+b,"M")},hide:function(){window["DP_jQuery_"+dpuuid].datepicker._hideDatepicker()},today:function(){window["DP_jQuery_"+dpuuid].datepicker._gotoToday(c)},selectDay:function(){return window["DP_jQuery_"+dpuuid].datepicker._selectDay(c,+this.getAttribute("data-month"),+this.getAttribute("data-year"),this),!1},selectMonth:function(){return window["DP_jQuery_"+dpuuid].datepicker._selectMonthYear(c,this,"M"),!1},selectYear:function(){return window["DP_jQuery_"+dpuuid].datepicker._selectMonthYear(c,this,"Y"),!1}};$(this).bind(this.getAttribute("data-event"),a[this.getAttribute("data-handler")])})},_generateHTML:function(a){var b=new Date;b=this._daylightSavingAdjust(new Date(b.getFullYear(),b.getMonth(),b.getDate()));var c=this._get(a,"isRTL"),d=this._get(a,"showButtonPanel"),e=this._get(a,"hideIfNoPrevNext"),f=this._get(a,"navigationAsDateFormat"),g=this._getNumberOfMonths(a),h=this._get(a,"showCurrentAtPos"),i=this._get(a,"stepMonths"),j=g[0]!=1||g[1]!=1,k=this._daylightSavingAdjust(a.currentDay?new Date(a.currentYear,a.currentMonth,a.currentDay):new Date(9999,9,9)),l=this._getMinMaxDate(a,"min"),m=this._getMinMaxDate(a,"max"),n=a.drawMonth-h,o=a.drawYear;n<0&&(n+=12,o--);if(m){var p=this._daylightSavingAdjust(new Date(m.getFullYear(),m.getMonth()-g[0]*g[1]+1,m.getDate()));p=l&&p<l?l:p;while(this._daylightSavingAdjust(new Date(o,n,1))>p)n--,n<0&&(n=11,o--)}a.drawMonth=n,a.drawYear=o;var q=this._get(a,"prevText");q=f?this.formatDate(q,this._daylightSavingAdjust(new Date(o,n-i,1)),this._getFormatConfig(a)):q;var r=this._canAdjustMonth(a,-1,o,n)?'<a class="ui-datepicker-prev ui-corner-all" data-handler="prev" data-event="click" title="'+q+'"><span class="ui-icon ui-icon-circle-triangle-'+(c?"e":"w")+'">'+q+"</span></a>":e?"":'<a class="ui-datepicker-prev ui-corner-all ui-state-disabled" title="'+q+'"><span class="ui-icon ui-icon-circle-triangle-'+(c?"e":"w")+'">'+q+"</span></a>",s=this._get(a,"nextText");s=f?this.formatDate(s,this._daylightSavingAdjust(new Date(o,n+i,1)),this._getFormatConfig(a)):s;var t=this._canAdjustMonth(a,1,o,n)?'<a class="ui-datepicker-next ui-corner-all" data-handler="next" data-event="click" title="'+s+'"><span class="ui-icon ui-icon-circle-triangle-'+(c?"w":"e")+'">'+s+"</span></a>":e?"":'<a class="ui-datepicker-next ui-corner-all ui-state-disabled" title="'+s+'"><span class="ui-icon ui-icon-circle-triangle-'+(c?"w":"e")+'">'+s+"</span></a>",u=this._get(a,"currentText"),v=this._get(a,"gotoCurrent")&&a.currentDay?k:b;u=f?this.formatDate(u,v,this._getFormatConfig(a)):u;var w=a.inline?"":'<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" data-handler="hide" data-event="click">'+this._get(a,"closeText")+"</button>",x=d?'<div class="ui-datepicker-buttonpane ui-widget-content">'+(c?w:"")+(this._isInRange(a,v)?'<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" data-handler="today" data-event="click">'+u+"</button>":"")+(c?"":w)+"</div>":"",y=parseInt(this._get(a,"firstDay"),10);y=isNaN(y)?0:y;var z=this._get(a,"showWeek"),A=this._get(a,"dayNames"),B=this._get(a,"dayNamesShort"),C=this._get(a,"dayNamesMin"),D=this._get(a,"monthNames"),E=this._get(a,"monthNamesShort"),F=this._get(a,"beforeShowDay"),G=this._get(a,"showOtherMonths"),H=this._get(a,"selectOtherMonths"),I=this._get(a,"calculateWeek")||this.iso8601Week,J=this._getDefaultDate(a),K="";for(var L=0;L<g[0];L++){var M="";this.maxRows=4;for(var N=0;N<g[1];N++){var O=this._daylightSavingAdjust(new Date(o,n,a.selectedDay)),P=" ui-corner-all",Q="";if(j){Q+='<div class="ui-datepicker-group';if(g[1]>1)switch(N){case 0:Q+=" ui-datepicker-group-first",P=" ui-corner-"+(c?"right":"left");break;case g[1]-1:Q+=" ui-datepicker-group-last",P=" ui-corner-"+(c?"left":"right");break;default:Q+=" ui-datepicker-group-middle",P=""}Q+='">'}Q+='<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix'+P+'">'+(/all|left/.test(P)&&L==0?c?t:r:"")+(/all|right/.test(P)&&L==0?c?r:t:"")+this._generateMonthYearHeader(a,n,o,l,m,L>0||N>0,D,E)+'</div><table class="ui-datepicker-calendar"><thead>'+"<tr>";var R=z?'<th class="ui-datepicker-week-col">'+this._get(a,"weekHeader")+"</th>":"";for(var S=0;S<7;S++){var T=(S+y)%7;R+="<th"+((S+y+6)%7>=5?' class="ui-datepicker-week-end"':"")+">"+'<span title="'+A[T]+'">'+C[T]+"</span></th>"}Q+=R+"</tr></thead><tbody>";var U=this._getDaysInMonth(o,n);o==a.selectedYear&&n==a.selectedMonth&&(a.selectedDay=Math.min(a.selectedDay,U));var V=(this._getFirstDayOfMonth(o,n)-y+7)%7,W=Math.ceil((V+U)/7),X=j?this.maxRows>W?this.maxRows:W:W;this.maxRows=X;var Y=this._daylightSavingAdjust(new Date(o,n,1-V));for(var Z=0;Z<X;Z++){Q+="<tr>";var _=z?'<td class="ui-datepicker-week-col">'+this._get(a,"calculateWeek")(Y)+"</td>":"";for(var S=0;S<7;S++){var ba=F?F.apply(a.input?a.input[0]:null,[Y]):[!0,""],bb=Y.getMonth()!=n,bc=bb&&!H||!ba[0]||l&&Y<l||m&&Y>m;_+='<td class="'+((S+y+6)%7>=5?" ui-datepicker-week-end":"")+(bb?" ui-datepicker-other-month":"")+(Y.getTime()==O.getTime()&&n==a.selectedMonth&&a._keyEvent||J.getTime()==Y.getTime()&&J.getTime()==O.getTime()?" "+this._dayOverClass:"")+(bc?" "+this._unselectableClass+" ui-state-disabled":"")+(bb&&!G?"":" "+ba[1]+(Y.getTime()==k.getTime()?" "+this._currentClass:"")+(Y.getTime()==b.getTime()?" ui-datepicker-today":""))+'"'+((!bb||G)&&ba[2]?' title="'+ba[2]+'"':"")+(bc?"":' data-handler="selectDay" data-event="click" data-month="'+Y.getMonth()+'" data-year="'+Y.getFullYear()+'"')+">"+(bb&&!G?"&#xa0;":bc?'<span class="ui-state-default">'+Y.getDate()+"</span>":'<a class="ui-state-default'+(Y.getTime()==b.getTime()?" ui-state-highlight":"")+(Y.getTime()==k.getTime()?" ui-state-active":"")+(bb?" ui-priority-secondary":"")+'" href="#">'+Y.getDate()+"</a>")+"</td>",Y.setDate(Y.getDate()+1),Y=this._daylightSavingAdjust(Y)}Q+=_+"</tr>"}n++,n>11&&(n=0,o++),Q+="</tbody></table>"+(j?"</div>"+(g[0]>0&&N==g[1]-1?'<div class="ui-datepicker-row-break"></div>':""):""),M+=Q}K+=M}return K+=x+($.browser.msie&&parseInt($.browser.version,10)<7&&!a.inline?'<iframe src="javascript:false;" class="ui-datepicker-cover" frameborder="0"></iframe>':""),a._keyEvent=!1,K},_generateMonthYearHeader:function(a,b,c,d,e,f,g,h){var i=this._get(a,"changeMonth"),j=this._get(a,"changeYear"),k=this._get(a,"showMonthAfterYear"),l='<div class="ui-datepicker-title">',m="";if(f||!i)m+='<span class="ui-datepicker-month">'+g[b]+"</span>";else{var n=d&&d.getFullYear()==c,o=e&&e.getFullYear()==c;m+='<select class="ui-datepicker-month" data-handler="selectMonth" data-event="change">';for(var p=0;p<12;p++)(!n||p>=d.getMonth())&&(!o||p<=e.getMonth())&&(m+='<option value="'+p+'"'+(p==b?' selected="selected"':"")+">"+h[p]+"</option>");m+="</select>"}k||(l+=m+(f||!i||!j?"&#xa0;":""));if(!a.yearshtml){a.yearshtml="";if(f||!j)l+='<span class="ui-datepicker-year">'+c+"</span>";else{var q=this._get(a,"yearRange").split(":"),r=(new Date).getFullYear(),s=function(a){var b=a.match(/c[+-].*/)?c+parseInt(a.substring(1),10):a.match(/[+-].*/)?r+parseInt(a,10):parseInt(a,10);return isNaN(b)?r:b},t=s(q[0]),u=Math.max(t,s(q[1]||""));t=d?Math.max(t,d.getFullYear()):t,u=e?Math.min(u,e.getFullYear()):u,a.yearshtml+='<select class="ui-datepicker-year" data-handler="selectYear" data-event="change">';for(;t<=u;t++)a.yearshtml+='<option value="'+t+'"'+(t==c?' selected="selected"':"")+">"+t+"</option>";a.yearshtml+="</select>",l+=a.yearshtml,a.yearshtml=null}}return l+=this._get(a,"yearSuffix"),k&&(l+=(f||!i||!j?"&#xa0;":"")+m),l+="</div>",l},_adjustInstDate:function(a,b,c){var d=a.drawYear+(c=="Y"?b:0),e=a.drawMonth+(c=="M"?b:0),f=Math.min(a.selectedDay,this._getDaysInMonth(d,e))+(c=="D"?b:0),g=this._restrictMinMax(a,this._daylightSavingAdjust(new Date(d,e,f)));a.selectedDay=g.getDate(),a.drawMonth=a.selectedMonth=g.getMonth(),a.drawYear=a.selectedYear=g.getFullYear(),(c=="M"||c=="Y")&&this._notifyChange(a)},_restrictMinMax:function(a,b){var c=this._getMinMaxDate(a,"min"),d=this._getMinMaxDate(a,"max"),e=c&&b<c?c:b;return e=d&&e>d?d:e,e},_notifyChange:function(a){var b=this._get(a,"onChangeMonthYear");b&&b.apply(a.input?a.input[0]:null,[a.selectedYear,a.selectedMonth+1,a])},_getNumberOfMonths:function(a){var b=this._get(a,"numberOfMonths");return b==null?[1,1]:typeof b=="number"?[1,b]:b},_getMinMaxDate:function(a,b){return this._determineDate(a,this._get(a,b+"Date"),null)},_getDaysInMonth:function(a,b){return 32-this._daylightSavingAdjust(new Date(a,b,32)).getDate()},_getFirstDayOfMonth:function(a,b){return(new Date(a,b,1)).getDay()},_canAdjustMonth:function(a,b,c,d){var e=this._getNumberOfMonths(a),f=this._daylightSavingAdjust(new Date(c,d+(b<0?b:e[0]*e[1]),1));return b<0&&f.setDate(this._getDaysInMonth(f.getFullYear(),f.getMonth())),this._isInRange(a,f)},_isInRange:function(a,b){var c=this._getMinMaxDate(a,"min"),d=this._getMinMaxDate(a,"max");return(!c||b.getTime()>=c.getTime())&&(!d||b.getTime()<=d.getTime())},_getFormatConfig:function(a){var b=this._get(a,"shortYearCutoff");return b=typeof b!="string"?b:(new Date).getFullYear()%100+parseInt(b,10),{shortYearCutoff:b,dayNamesShort:this._get(a,"dayNamesShort"),dayNames:this._get(a,"dayNames"),monthNamesShort:this._get(a,"monthNamesShort"),monthNames:this._get(a,"monthNames")}},_formatDate:function(a,b,c,d){b||(a.currentDay=a.selectedDay,a.currentMonth=a.selectedMonth,a.currentYear=a.selectedYear);var e=b?typeof b=="object"?b:this._daylightSavingAdjust(new Date(d,c,b)):this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay));return this.formatDate(this._get(a,"dateFormat"),e,this._getFormatConfig(a))}}),$.fn.datepicker=function(a){if(!this.length)return this;$.datepicker.initialized||($(document).mousedown($.datepicker._checkExternalClick).find("body").append($.datepicker.dpDiv),$.datepicker.initialized=!0);var b=Array.prototype.slice.call(arguments,1);return typeof a!="string"||a!="isDisabled"&&a!="getDate"&&a!="widget"?a=="option"&&arguments.length==2&&typeof arguments[1]=="string"?$.datepicker["_"+a+"Datepicker"].apply($.datepicker,[this[0]].concat(b)):this.each(function(){typeof a=="string"?$.datepicker["_"+a+"Datepicker"].apply($.datepicker,[this].concat(b)):$.datepicker._attachDatepicker(this,a)}):$.datepicker["_"+a+"Datepicker"].apply($.datepicker,[this[0]].concat(b))},$.datepicker=new Datepicker,$.datepicker.initialized=!1,$.datepicker.uuid=(new Date).getTime(),$.datepicker.version="1.8.23",window["DP_jQuery_"+dpuuid]=$})(jQuery);;/*! jQuery UI - v1.8.23 - 2012-08-15+* https://github.com/jquery/jquery-ui+* Includes: jquery.ui.progressbar.js+* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */+(function(a,b){a.widget("ui.progressbar",{options:{value:0,max:100},min:0,_create:function(){this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this.min,"aria-valuemax":this.options.max,"aria-valuenow":this._value()}),this.valueDiv=a("<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>").appendTo(this.element),this.oldValue=this._value(),this._refreshValue()},destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"),this.valueDiv.remove(),a.Widget.prototype.destroy.apply(this,arguments)},value:function(a){return a===b?this._value():(this._setOption("value",a),this)},_setOption:function(b,c){b==="value"&&(this.options.value=c,this._refreshValue(),this._value()===this.options.max&&this._trigger("complete")),a.Widget.prototype._setOption.apply(this,arguments)},_value:function(){var a=this.options.value;return typeof a!="number"&&(a=0),Math.min(this.options.max,Math.max(this.min,a))},_percentage:function(){return 100*this._value()/this.options.max},_refreshValue:function(){var a=this.value(),b=this._percentage();this.oldValue!==a&&(this.oldValue=a,this._trigger("change")),this.valueDiv.toggle(a>this.min).toggleClass("ui-corner-right",a===this.options.max).width(b.toFixed(0)+"%"),this.element.attr("aria-valuenow",a)}}),a.extend(a.ui.progressbar,{version:"1.8.23"})})(jQuery);;/*! jQuery UI - v1.8.23 - 2012-08-15+* https://github.com/jquery/jquery-ui+* Includes: jquery.effects.core.js+* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */+jQuery.effects||function(a,b){function c(b){var c;return b&&b.constructor==Array&&b.length==3?b:(c=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(b))?[parseInt(c[1],10),parseInt(c[2],10),parseInt(c[3],10)]:(c=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(b))?[parseFloat(c[1])*2.55,parseFloat(c[2])*2.55,parseFloat(c[3])*2.55]:(c=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(b))?[parseInt(c[1],16),parseInt(c[2],16),parseInt(c[3],16)]:(c=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(b))?[parseInt(c[1]+c[1],16),parseInt(c[2]+c[2],16),parseInt(c[3]+c[3],16)]:(c=/rgba\(0, 0, 0, 0\)/.exec(b))?e.transparent:e[a.trim(b).toLowerCase()]}function d(b,d){var e;do{e=(a.curCSS||a.css)(b,d);if(e!=""&&e!="transparent"||a.nodeName(b,"body"))break;d="backgroundColor"}while(b=b.parentNode);return c(e)}function h(){var a=document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle,b={},c,d;if(a&&a.length&&a[0]&&a[a[0]]){var e=a.length;while(e--)c=a[e],typeof a[c]=="string"&&(d=c.replace(/\-(\w)/g,function(a,b){return b.toUpperCase()}),b[d]=a[c])}else for(c in a)typeof a[c]=="string"&&(b[c]=a[c]);return b}function i(b){var c,d;for(c in b)d=b[c],(d==null||a.isFunction(d)||c in g||/scrollbar/.test(c)||!/color/i.test(c)&&isNaN(parseFloat(d)))&&delete b[c];return b}function j(a,b){var c={_:0},d;for(d in b)a[d]!=b[d]&&(c[d]=b[d]);return c}function k(b,c,d,e){typeof b=="object"&&(e=c,d=null,c=b,b=c.effect),a.isFunction(c)&&(e=c,d=null,c={});if(typeof c=="number"||a.fx.speeds[c])e=d,d=c,c={};return a.isFunction(d)&&(e=d,d=null),c=c||{},d=d||c.duration,d=a.fx.off?0:typeof d=="number"?d:d in a.fx.speeds?a.fx.speeds[d]:a.fx.speeds._default,e=e||c.complete,[b,c,d,e]}function l(b){return!b||typeof b=="number"||a.fx.speeds[b]?!0:typeof b=="string"&&!a.effects[b]?!0:!1}a.effects={},a.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor","borderTopColor","borderColor","color","outlineColor"],function(b,e){a.fx.step[e]=function(a){a.colorInit||(a.start=d(a.elem,e),a.end=c(a.end),a.colorInit=!0),a.elem.style[e]="rgb("+Math.max(Math.min(parseInt(a.pos*(a.end[0]-a.start[0])+a.start[0],10),255),0)+","+Math.max(Math.min(parseInt(a.pos*(a.end[1]-a.start[1])+a.start[1],10),255),0)+","+Math.max(Math.min(parseInt(a.pos*(a.end[2]-a.start[2])+a.start[2],10),255),0)+")"}});var e={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]},f=["add","remove","toggle"],g={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};a.effects.animateClass=function(b,c,d,e){return a.isFunction(d)&&(e=d,d=null),this.queue(function(){var g=a(this),k=g.attr("style")||" ",l=i(h.call(this)),m,n=g.attr("class")||"";a.each(f,function(a,c){b[c]&&g[c+"Class"](b[c])}),m=i(h.call(this)),g.attr("class",n),g.animate(j(l,m),{queue:!1,duration:c,easing:d,complete:function(){a.each(f,function(a,c){b[c]&&g[c+"Class"](b[c])}),typeof g.attr("style")=="object"?(g.attr("style").cssText="",g.attr("style").cssText=k):g.attr("style",k),e&&e.apply(this,arguments),a.dequeue(this)}})})},a.fn.extend({_addClass:a.fn.addClass,addClass:function(b,c,d,e){return c?a.effects.animateClass.apply(this,[{add:b},c,d,e]):this._addClass(b)},_removeClass:a.fn.removeClass,removeClass:function(b,c,d,e){return c?a.effects.animateClass.apply(this,[{remove:b},c,d,e]):this._removeClass(b)},_toggleClass:a.fn.toggleClass,toggleClass:function(c,d,e,f,g){return typeof d=="boolean"||d===b?e?a.effects.animateClass.apply(this,[d?{add:c}:{remove:c},e,f,g]):this._toggleClass(c,d):a.effects.animateClass.apply(this,[{toggle:c},d,e,f])},switchClass:function(b,c,d,e,f){return a.effects.animateClass.apply(this,[{add:c,remove:b},d,e,f])}}),a.extend(a.effects,{version:"1.8.23",save:function(a,b){for(var c=0;c<b.length;c++)b[c]!==null&&a.data("ec.storage."+b[c],a[0].style[b[c]])},restore:function(a,b){for(var c=0;c<b.length;c++)b[c]!==null&&a.css(b[c],a.data("ec.storage."+b[c]))},setMode:function(a,b){return b=="toggle"&&(b=a.is(":hidden")?"show":"hide"),b},getBaseline:function(a,b){var c,d;switch(a[0]){case"top":c=0;break;case"middle":c=.5;break;case"bottom":c=1;break;default:c=a[0]/b.height}switch(a[1]){case"left":d=0;break;case"center":d=.5;break;case"right":d=1;break;default:d=a[1]/b.width}return{x:d,y:c}},createWrapper:function(b){if(b.parent().is(".ui-effects-wrapper"))return b.parent();var c={width:b.outerWidth(!0),height:b.outerHeight(!0),"float":b.css("float")},d=a("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),e=document.activeElement;try{e.id}catch(f){e=document.body}return b.wrap(d),(b[0]===e||a.contains(b[0],e))&&a(e).focus(),d=b.parent(),b.css("position")=="static"?(d.css({position:"relative"}),b.css({position:"relative"})):(a.extend(c,{position:b.css("position"),zIndex:b.css("z-index")}),a.each(["top","left","bottom","right"],function(a,d){c[d]=b.css(d),isNaN(parseInt(c[d],10))&&(c[d]="auto")}),b.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})),d.css(c).show()},removeWrapper:function(b){var c,d=document.activeElement;return b.parent().is(".ui-effects-wrapper")?(c=b.parent().replaceWith(b),(b[0]===d||a.contains(b[0],d))&&a(d).focus(),c):b},setTransition:function(b,c,d,e){return e=e||{},a.each(c,function(a,c){var f=b.cssUnit(c);f[0]>0&&(e[c]=f[0]*d+f[1])}),e}}),a.fn.extend({effect:function(b,c,d,e){var f=k.apply(this,arguments),g={options:f[1],duration:f[2],callback:f[3]},h=g.options.mode,i=a.effects[b];return a.fx.off||!i?h?this[h](g.duration,g.callback):this.each(function(){g.callback&&g.callback.call(this)}):i.call(this,g)},_show:a.fn.show,show:function(a){if(l(a))return this._show.apply(this,arguments);var b=k.apply(this,arguments);return b[1].mode="show",this.effect.apply(this,b)},_hide:a.fn.hide,hide:function(a){if(l(a))return this._hide.apply(this,arguments);var b=k.apply(this,arguments);return b[1].mode="hide",this.effect.apply(this,b)},__toggle:a.fn.toggle,toggle:function(b){if(l(b)||typeof b=="boolean"||a.isFunction(b))return this.__toggle.apply(this,arguments);var c=k.apply(this,arguments);return c[1].mode="toggle",this.effect.apply(this,c)},cssUnit:function(b){var c=this.css(b),d=[];return a.each(["em","px","%","pt"],function(a,b){c.indexOf(b)>0&&(d=[parseFloat(c),b])}),d}});var m={};a.each(["Quad","Cubic","Quart","Quint","Expo"],function(a,b){m[b]=function(b){return Math.pow(b,a+2)}}),a.extend(m,{Sine:function(a){return 1-Math.cos(a*Math.PI/2)},Circ:function(a){return 1-Math.sqrt(1-a*a)},Elastic:function(a){return a===0||a===1?a:-Math.pow(2,8*(a-1))*Math.sin(((a-1)*80-7.5)*Math.PI/15)},Back:function(a){return a*a*(3*a-2)},Bounce:function(a){var b,c=4;while(a<((b=Math.pow(2,--c))-1)/11);return 1/Math.pow(4,3-c)-7.5625*Math.pow((b*3-2)/22-a,2)}}),a.each(m,function(b,c){a.easing["easeIn"+b]=c,a.easing["easeOut"+b]=function(a){return 1-c(1-a)},a.easing["easeInOut"+b]=function(a){return a<.5?c(a*2)/2:c(a*-2+2)/-2+1}})}(jQuery);;/*! jQuery UI - v1.8.23 - 2012-08-15+* https://github.com/jquery/jquery-ui+* Includes: jquery.effects.blind.js+* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */+(function(a,b){a.effects.blind=function(b){return this.queue(function(){var c=a(this),d=["position","top","bottom","left","right"],e=a.effects.setMode(c,b.options.mode||"hide"),f=b.options.direction||"vertical";a.effects.save(c,d),c.show();var g=a.effects.createWrapper(c).css({overflow:"hidden"}),h=f=="vertical"?"height":"width",i=f=="vertical"?g.height():g.width();e=="show"&&g.css(h,0);var j={};j[h]=e=="show"?i:0,g.animate(j,b.duration,b.options.easing,function(){e=="hide"&&c.hide(),a.effects.restore(c,d),a.effects.removeWrapper(c),b.callback&&b.callback.apply(c[0],arguments),c.dequeue()})})}})(jQuery);;/*! jQuery UI - v1.8.23 - 2012-08-15+* https://github.com/jquery/jquery-ui+* Includes: jquery.effects.bounce.js+* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */+(function(a,b){a.effects.bounce=function(b){return this.queue(function(){var c=a(this),d=["position","top","bottom","left","right"],e=a.effects.setMode(c,b.options.mode||"effect"),f=b.options.direction||"up",g=b.options.distance||20,h=b.options.times||5,i=b.duration||250;/show|hide/.test(e)&&d.push("opacity"),a.effects.save(c,d),c.show(),a.effects.createWrapper(c);var j=f=="up"||f=="down"?"top":"left",k=f=="up"||f=="left"?"pos":"neg",g=b.options.distance||(j=="top"?c.outerHeight(!0)/3:c.outerWidth(!0)/3);e=="show"&&c.css("opacity",0).css(j,k=="pos"?-g:g),e=="hide"&&(g=g/(h*2)),e!="hide"&&h--;if(e=="show"){var l={opacity:1};l[j]=(k=="pos"?"+=":"-=")+g,c.animate(l,i/2,b.options.easing),g=g/2,h--}for(var m=0;m<h;m++){var n={},p={};n[j]=(k=="pos"?"-=":"+=")+g,p[j]=(k=="pos"?"+=":"-=")+g,c.animate(n,i/2,b.options.easing).animate(p,i/2,b.options.easing),g=e=="hide"?g*2:g/2}if(e=="hide"){var l={opacity:0};l[j]=(k=="pos"?"-=":"+=")+g,c.animate(l,i/2,b.options.easing,function(){c.hide(),a.effects.restore(c,d),a.effects.removeWrapper(c),b.callback&&b.callback.apply(this,arguments)})}else{var n={},p={};n[j]=(k=="pos"?"-=":"+=")+g,p[j]=(k=="pos"?"+=":"-=")+g,c.animate(n,i/2,b.options.easing).animate(p,i/2,b.options.easing,function(){a.effects.restore(c,d),a.effects.removeWrapper(c),b.callback&&b.callback.apply(this,arguments)})}c.queue("fx",function(){c.dequeue()}),c.dequeue()})}})(jQuery);;/*! jQuery UI - v1.8.23 - 2012-08-15+* https://github.com/jquery/jquery-ui+* Includes: jquery.effects.clip.js+* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */+(function(a,b){a.effects.clip=function(b){return this.queue(function(){var c=a(this),d=["position","top","bottom","left","right","height","width"],e=a.effects.setMode(c,b.options.mode||"hide"),f=b.options.direction||"vertical";a.effects.save(c,d),c.show();var g=a.effects.createWrapper(c).css({overflow:"hidden"}),h=c[0].tagName=="IMG"?g:c,i={size:f=="vertical"?"height":"width",position:f=="vertical"?"top":"left"},j=f=="vertical"?h.height():h.width();e=="show"&&(h.css(i.size,0),h.css(i.position,j/2));var k={};k[i.size]=e=="show"?j:0,k[i.position]=e=="show"?0:j/2,h.animate(k,{queue:!1,duration:b.duration,easing:b.options.easing,complete:function(){e=="hide"&&c.hide(),a.effects.restore(c,d),a.effects.removeWrapper(c),b.callback&&b.callback.apply(c[0],arguments),c.dequeue()}})})}})(jQuery);;/*! jQuery UI - v1.8.23 - 2012-08-15+* https://github.com/jquery/jquery-ui+* Includes: jquery.effects.drop.js+* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */+(function(a,b){a.effects.drop=function(b){return this.queue(function(){var c=a(this),d=["position","top","bottom","left","right","opacity"],e=a.effects.setMode(c,b.options.mode||"hide"),f=b.options.direction||"left";a.effects.save(c,d),c.show(),a.effects.createWrapper(c);var g=f=="up"||f=="down"?"top":"left",h=f=="up"||f=="left"?"pos":"neg",i=b.options.distance||(g=="top"?c.outerHeight(!0)/2:c.outerWidth(!0)/2);e=="show"&&c.css("opacity",0).css(g,h=="pos"?-i:i);var j={opacity:e=="show"?1:0};j[g]=(e=="show"?h=="pos"?"+=":"-=":h=="pos"?"-=":"+=")+i,c.animate(j,{queue:!1,duration:b.duration,easing:b.options.easing,complete:function(){e=="hide"&&c.hide(),a.effects.restore(c,d),a.effects.removeWrapper(c),b.callback&&b.callback.apply(this,arguments),c.dequeue()}})})}})(jQuery);;/*! jQuery UI - v1.8.23 - 2012-08-15+* https://github.com/jquery/jquery-ui+* Includes: jquery.effects.explode.js+* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */+(function(a,b){a.effects.explode=function(b){return this.queue(function(){var c=b.options.pieces?Math.round(Math.sqrt(b.options.pieces)):3,d=b.options.pieces?Math.round(Math.sqrt(b.options.pieces)):3;b.options.mode=b.options.mode=="toggle"?a(this).is(":visible")?"hide":"show":b.options.mode;var e=a(this).show().css("visibility","hidden"),f=e.offset();f.top-=parseInt(e.css("marginTop"),10)||0,f.left-=parseInt(e.css("marginLeft"),10)||0;var g=e.outerWidth(!0),h=e.outerHeight(!0);for(var i=0;i<c;i++)for(var j=0;j<d;j++)e.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-j*(g/d),top:-i*(h/c)}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:g/d,height:h/c,left:f.left+j*(g/d)+(b.options.mode=="show"?(j-Math.floor(d/2))*(g/d):0),top:f.top+i*(h/c)+(b.options.mode=="show"?(i-Math.floor(c/2))*(h/c):0),opacity:b.options.mode=="show"?0:1}).animate({left:f.left+j*(g/d)+(b.options.mode=="show"?0:(j-Math.floor(d/2))*(g/d)),top:f.top+i*(h/c)+(b.options.mode=="show"?0:(i-Math.floor(c/2))*(h/c)),opacity:b.options.mode=="show"?1:0},b.duration||500);setTimeout(function(){b.options.mode=="show"?e.css({visibility:"visible"}):e.css({visibility:"visible"}).hide(),b.callback&&b.callback.apply(e[0]),e.dequeue(),a("div.ui-effects-explode").remove()},b.duration||500)})}})(jQuery);;/*! jQuery UI - v1.8.23 - 2012-08-15+* https://github.com/jquery/jquery-ui+* Includes: jquery.effects.fade.js+* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */+(function(a,b){a.effects.fade=function(b){return this.queue(function(){var c=a(this),d=a.effects.setMode(c,b.options.mode||"hide");c.animate({opacity:d},{queue:!1,duration:b.duration,easing:b.options.easing,complete:function(){b.callback&&b.callback.apply(this,arguments),c.dequeue()}})})}})(jQuery);;/*! jQuery UI - v1.8.23 - 2012-08-15+* https://github.com/jquery/jquery-ui+* Includes: jquery.effects.fold.js+* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */+(function(a,b){a.effects.fold=function(b){return this.queue(function(){var c=a(this),d=["position","top","bottom","left","right"],e=a.effects.setMode(c,b.options.mode||"hide"),f=b.options.size||15,g=!!b.options.horizFirst,h=b.duration?b.duration/2:a.fx.speeds._default/2;a.effects.save(c,d),c.show();var i=a.effects.createWrapper(c).css({overflow:"hidden"}),j=e=="show"!=g,k=j?["width","height"]:["height","width"],l=j?[i.width(),i.height()]:[i.height(),i.width()],m=/([0-9]+)%/.exec(f);m&&(f=parseInt(m[1],10)/100*l[e=="hide"?0:1]),e=="show"&&i.css(g?{height:0,width:f}:{height:f,width:0});var n={},p={};n[k[0]]=e=="show"?l[0]:f,p[k[1]]=e=="show"?l[1]:0,i.animate(n,h,b.options.easing).animate(p,h,b.options.easing,function(){e=="hide"&&c.hide(),a.effects.restore(c,d),a.effects.removeWrapper(c),b.callback&&b.callback.apply(c[0],arguments),c.dequeue()})})}})(jQuery);;/*! jQuery UI - v1.8.23 - 2012-08-15+* https://github.com/jquery/jquery-ui+* Includes: jquery.effects.highlight.js+* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */+(function(a,b){a.effects.highlight=function(b){return this.queue(function(){var c=a(this),d=["backgroundImage","backgroundColor","opacity"],e=a.effects.setMode(c,b.options.mode||"show"),f={backgroundColor:c.css("backgroundColor")};e=="hide"&&(f.opacity=0),a.effects.save(c,d),c.show().css({backgroundImage:"none",backgroundColor:b.options.color||"#ffff99"}).animate(f,{queue:!1,duration:b.duration,easing:b.options.easing,complete:function(){e=="hide"&&c.hide(),a.effects.restore(c,d),e=="show"&&!a.support.opacity&&this.style.removeAttribute("filter"),b.callback&&b.callback.apply(this,arguments),c.dequeue()}})})}})(jQuery);;/*! jQuery UI - v1.8.23 - 2012-08-15+* https://github.com/jquery/jquery-ui+* Includes: jquery.effects.pulsate.js+* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */+(function(a,b){a.effects.pulsate=function(b){return this.queue(function(){var c=a(this),d=a.effects.setMode(c,b.options.mode||"show"),e=(b.options.times||5)*2-1,f=b.duration?b.duration/2:a.fx.speeds._default/2,g=c.is(":visible"),h=0;g||(c.css("opacity",0).show(),h=1),(d=="hide"&&g||d=="show"&&!g)&&e--;for(var i=0;i<e;i++)c.animate({opacity:h},f,b.options.easing),h=(h+1)%2;c.animate({opacity:h},f,b.options.easing,function(){h==0&&c.hide(),b.callback&&b.callback.apply(this,arguments)}),c.queue("fx",function(){c.dequeue()}).dequeue()})}})(jQuery);;/*! jQuery UI - v1.8.23 - 2012-08-15+* https://github.com/jquery/jquery-ui+* Includes: jquery.effects.scale.js+* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */+(function(a,b){a.effects.puff=function(b){return this.queue(function(){var c=a(this),d=a.effects.setMode(c,b.options.mode||"hide"),e=parseInt(b.options.percent,10)||150,f=e/100,g={height:c.height(),width:c.width()};a.extend(b.options,{fade:!0,mode:d,percent:d=="hide"?e:100,from:d=="hide"?g:{height:g.height*f,width:g.width*f}}),c.effect("scale",b.options,b.duration,b.callback),c.dequeue()})},a.effects.scale=function(b){return this.queue(function(){var c=a(this),d=a.extend(!0,{},b.options),e=a.effects.setMode(c,b.options.mode||"effect"),f=parseInt(b.options.percent,10)||(parseInt(b.options.percent,10)==0?0:e=="hide"?0:100),g=b.options.direction||"both",h=b.options.origin;e!="effect"&&(d.origin=h||["middle","center"],d.restore=!0);var i={height:c.height(),width:c.width()};c.from=b.options.from||(e=="show"?{height:0,width:0}:i);var j={y:g!="horizontal"?f/100:1,x:g!="vertical"?f/100:1};c.to={height:i.height*j.y,width:i.width*j.x},b.options.fade&&(e=="show"&&(c.from.opacity=0,c.to.opacity=1),e=="hide"&&(c.from.opacity=1,c.to.opacity=0)),d.from=c.from,d.to=c.to,d.mode=e,c.effect("size",d,b.duration,b.callback),c.dequeue()})},a.effects.size=function(b){return this.queue(function(){var c=a(this),d=["position","top","bottom","left","right","width","height","overflow","opacity"],e=["position","top","bottom","left","right","overflow","opacity"],f=["width","height","overflow"],g=["fontSize"],h=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],i=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],j=a.effects.setMode(c,b.options.mode||"effect"),k=b.options.restore||!1,l=b.options.scale||"both",m=b.options.origin,n={height:c.height(),width:c.width()};c.from=b.options.from||n,c.to=b.options.to||n;if(m){var p=a.effects.getBaseline(m,n);c.from.top=(n.height-c.from.height)*p.y,c.from.left=(n.width-c.from.width)*p.x,c.to.top=(n.height-c.to.height)*p.y,c.to.left=(n.width-c.to.width)*p.x}var q={from:{y:c.from.height/n.height,x:c.from.width/n.width},to:{y:c.to.height/n.height,x:c.to.width/n.width}};if(l=="box"||l=="both")q.from.y!=q.to.y&&(d=d.concat(h),c.from=a.effects.setTransition(c,h,q.from.y,c.from),c.to=a.effects.setTransition(c,h,q.to.y,c.to)),q.from.x!=q.to.x&&(d=d.concat(i),c.from=a.effects.setTransition(c,i,q.from.x,c.from),c.to=a.effects.setTransition(c,i,q.to.x,c.to));(l=="content"||l=="both")&&q.from.y!=q.to.y&&(d=d.concat(g),c.from=a.effects.setTransition(c,g,q.from.y,c.from),c.to=a.effects.setTransition(c,g,q.to.y,c.to)),a.effects.save(c,k?d:e),c.show(),a.effects.createWrapper(c),c.css("overflow","hidden").css(c.from);if(l=="content"||l=="both")h=h.concat(["marginTop","marginBottom"]).concat(g),i=i.concat(["marginLeft","marginRight"]),f=d.concat(h).concat(i),c.find("*[width]").each(function(){var c=a(this);k&&a.effects.save(c,f);var d={height:c.height(),width:c.width()};c.from={height:d.height*q.from.y,width:d.width*q.from.x},c.to={height:d.height*q.to.y,width:d.width*q.to.x},q.from.y!=q.to.y&&(c.from=a.effects.setTransition(c,h,q.from.y,c.from),c.to=a.effects.setTransition(c,h,q.to.y,c.to)),q.from.x!=q.to.x&&(c.from=a.effects.setTransition(c,i,q.from.x,c.from),c.to=a.effects.setTransition(c,i,q.to.x,c.to)),c.css(c.from),c.animate(c.to,b.duration,b.options.easing,function(){k&&a.effects.restore(c,f)})});c.animate(c.to,{queue:!1,duration:b.duration,easing:b.options.easing,complete:function(){c.to.opacity===0&&c.css("opacity",c.from.opacity),j=="hide"&&c.hide(),a.effects.restore(c,k?d:e),a.effects.removeWrapper(c),b.callback&&b.callback.apply(this,arguments),c.dequeue()}})})}})(jQuery);;/*! jQuery UI - v1.8.23 - 2012-08-15+* https://github.com/jquery/jquery-ui+* Includes: jquery.effects.shake.js+* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */+(function(a,b){a.effects.shake=function(b){return this.queue(function(){var c=a(this),d=["position","top","bottom","left","right"],e=a.effects.setMode(c,b.options.mode||"effect"),f=b.options.direction||"left",g=b.options.distance||20,h=b.options.times||3,i=b.duration||b.options.duration||140;a.effects.save(c,d),c.show(),a.effects.createWrapper(c);var j=f=="up"||f=="down"?"top":"left",k=f=="up"||f=="left"?"pos":"neg",l={},m={},n={};l[j]=(k=="pos"?"-=":"+=")+g,m[j]=(k=="pos"?"+=":"-=")+g*2,n[j]=(k=="pos"?"-=":"+=")+g*2,c.animate(l,i,b.options.easing);for(var p=1;p<h;p++)c.animate(m,i,b.options.easing).animate(n,i,b.options.easing);c.animate(m,i,b.options.easing).animate(l,i/2,b.options.easing,function(){a.effects.restore(c,d),a.effects.removeWrapper(c),b.callback&&b.callback.apply(this,arguments)}),c.queue("fx",function(){c.dequeue()}),c.dequeue()})}})(jQuery);;/*! jQuery UI - v1.8.23 - 2012-08-15+* https://github.com/jquery/jquery-ui+* Includes: jquery.effects.slide.js+* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */+(function(a,b){a.effects.slide=function(b){return this.queue(function(){var c=a(this),d=["position","top","bottom","left","right"],e=a.effects.setMode(c,b.options.mode||"show"),f=b.options.direction||"left";a.effects.save(c,d),c.show(),a.effects.createWrapper(c).css({overflow:"hidden"});var g=f=="up"||f=="down"?"top":"left",h=f=="up"||f=="left"?"pos":"neg",i=b.options.distance||(g=="top"?c.outerHeight(!0):c.outerWidth(!0));e=="show"&&c.css(g,h=="pos"?isNaN(i)?"-"+i:-i:i);var j={};j[g]=(e=="show"?h=="pos"?"+=":"-=":h=="pos"?"-=":"+=")+i,c.animate(j,{queue:!1,duration:b.duration,easing:b.options.easing,complete:function(){e=="hide"&&c.hide(),a.effects.restore(c,d),a.effects.removeWrapper(c),b.callback&&b.callback.apply(this,arguments),c.dequeue()}})})}})(jQuery);;/*! jQuery UI - v1.8.23 - 2012-08-15+* https://github.com/jquery/jquery-ui+* Includes: jquery.effects.transfer.js+* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */+(function(a,b){a.effects.transfer=function(b){return this.queue(function(){var c=a(this),d=a(b.options.to),e=d.offset(),f={top:e.top,left:e.left,height:d.innerHeight(),width:d.innerWidth()},g=c.offset(),h=a('<div class="ui-effects-transfer"></div>').appendTo(document.body).addClass(b.options.className).css({top:g.top,left:g.left,height:c.innerHeight(),width:c.innerWidth(),position:"absolute"}).animate(f,b.duration,b.options.easing,function(){h.remove(),b.callback&&b.callback.apply(c[0],arguments),c.dequeue()})})}})(jQuery);;
+ static/jquery.js view
@@ -0,0 +1,2 @@+/*! jQuery v@1.8.0 jquery.com | jquery.org/license */
+(function(a,b){function G(a){var b=F[a]={};return p.each(a.split(s),function(a,c){b[c]=!0}),b}function J(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(I,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:+d+""===d?+d:H.test(d)?p.parseJSON(d):d}catch(f){}p.data(a,c,d)}else d=b}return d}function K(a){var b;for(b in a){if(b==="data"&&p.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function ba(){return!1}function bb(){return!0}function bh(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function bi(a,b){do a=a[b];while(a&&a.nodeType!==1);return a}function bj(a,b,c){b=b||0;if(p.isFunction(b))return p.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return p.grep(a,function(a,d){return a===b===c});if(typeof b=="string"){var d=p.grep(a,function(a){return a.nodeType===1});if(be.test(b))return p.filter(b,d,!c);b=p.filter(b,d)}return p.grep(a,function(a,d){return p.inArray(a,b)>=0===c})}function bk(a){var b=bl.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}function bC(a,b){return a.getElementsByTagName(b)[0]||a.appendChild(a.ownerDocument.createElement(b))}function bD(a,b){if(b.nodeType!==1||!p.hasData(a))return;var c,d,e,f=p._data(a),g=p._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;d<e;d++)p.event.add(b,c,h[c][d])}g.data&&(g.data=p.extend({},g.data))}function bE(a,b){var c;if(b.nodeType!==1)return;b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase(),c==="object"?(b.parentNode&&(b.outerHTML=a.outerHTML),p.support.html5Clone&&a.innerHTML&&!p.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):c==="input"&&bv.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):c==="option"?b.selected=a.defaultSelected:c==="input"||c==="textarea"?b.defaultValue=a.defaultValue:c==="script"&&b.text!==a.text&&(b.text=a.text),b.removeAttribute(p.expando)}function bF(a){return typeof a.getElementsByTagName!="undefined"?a.getElementsByTagName("*"):typeof a.querySelectorAll!="undefined"?a.querySelectorAll("*"):[]}function bG(a){bv.test(a.type)&&(a.defaultChecked=a.checked)}function bX(a,b){if(b in a)return b;var c=b.charAt(0).toUpperCase()+b.slice(1),d=b,e=bV.length;while(e--){b=bV[e]+c;if(b in a)return b}return d}function bY(a,b){return a=b||a,p.css(a,"display")==="none"||!p.contains(a.ownerDocument,a)}function bZ(a,b){var c,d,e=[],f=0,g=a.length;for(;f<g;f++){c=a[f];if(!c.style)continue;e[f]=p._data(c,"olddisplay"),b?(!e[f]&&c.style.display==="none"&&(c.style.display=""),c.style.display===""&&bY(c)&&(e[f]=p._data(c,"olddisplay",cb(c.nodeName)))):(d=bH(c,"display"),!e[f]&&d!=="none"&&p._data(c,"olddisplay",d))}for(f=0;f<g;f++){c=a[f];if(!c.style)continue;if(!b||c.style.display==="none"||c.style.display==="")c.style.display=b?e[f]||"":"none"}return a}function b$(a,b,c){var d=bO.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function b_(a,b,c,d){var e=c===(d?"border":"content")?4:b==="width"?1:0,f=0;for(;e<4;e+=2)c==="margin"&&(f+=p.css(a,c+bU[e],!0)),d?(c==="content"&&(f-=parseFloat(bH(a,"padding"+bU[e]))||0),c!=="margin"&&(f-=parseFloat(bH(a,"border"+bU[e]+"Width"))||0)):(f+=parseFloat(bH(a,"padding"+bU[e]))||0,c!=="padding"&&(f+=parseFloat(bH(a,"border"+bU[e]+"Width"))||0));return f}function ca(a,b,c){var d=b==="width"?a.offsetWidth:a.offsetHeight,e=!0,f=p.support.boxSizing&&p.css(a,"boxSizing")==="border-box";if(d<=0){d=bH(a,b);if(d<0||d==null)d=a.style[b];if(bP.test(d))return d;e=f&&(p.support.boxSizingReliable||d===a.style[b]),d=parseFloat(d)||0}return d+b_(a,b,c||(f?"border":"content"),e)+"px"}function cb(a){if(bR[a])return bR[a];var b=p("<"+a+">").appendTo(e.body),c=b.css("display");b.remove();if(c==="none"||c===""){bI=e.body.appendChild(bI||p.extend(e.createElement("iframe"),{frameBorder:0,width:0,height:0}));if(!bJ||!bI.createElement)bJ=(bI.contentWindow||bI.contentDocument).document,bJ.write("<!doctype html><html><body>"),bJ.close();b=bJ.body.appendChild(bJ.createElement(a)),c=bH(b,"display"),e.body.removeChild(bI)}return bR[a]=c,c}function ch(a,b,c,d){var e;if(p.isArray(b))p.each(b,function(b,e){c||cd.test(a)?d(a,e):ch(a+"["+(typeof e=="object"?b:"")+"]",e,c,d)});else if(!c&&p.type(b)==="object")for(e in b)ch(a+"["+e+"]",b[e],c,d);else d(a,b)}function cy(a){return function(b,c){typeof b!="string"&&(c=b,b="*");var d,e,f,g=b.toLowerCase().split(s),h=0,i=g.length;if(p.isFunction(c))for(;h<i;h++)d=g[h],f=/^\+/.test(d),f&&(d=d.substr(1)||"*"),e=a[d]=a[d]||[],e[f?"unshift":"push"](c)}}function cz(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h,i=a[f],j=0,k=i?i.length:0,l=a===cu;for(;j<k&&(l||!h);j++)h=i[j](c,d,e),typeof h=="string"&&(!l||g[h]?h=b:(c.dataTypes.unshift(h),h=cz(a,c,d,e,h,g)));return(l||!h)&&!g["*"]&&(h=cz(a,c,d,e,"*",g)),h}function cA(a,c){var d,e,f=p.ajaxSettings.flatOptions||{};for(d in c)c[d]!==b&&((f[d]?a:e||(e={}))[d]=c[d]);e&&p.extend(!0,a,e)}function cB(a,c,d){var e,f,g,h,i=a.contents,j=a.dataTypes,k=a.responseFields;for(f in k)f in d&&(c[k[f]]=d[f]);while(j[0]==="*")j.shift(),e===b&&(e=a.mimeType||c.getResponseHeader("content-type"));if(e)for(f in i)if(i[f]&&i[f].test(e)){j.unshift(f);break}if(j[0]in d)g=j[0];else{for(f in d){if(!j[0]||a.converters[f+" "+j[0]]){g=f;break}h||(h=f)}g=g||h}if(g)return g!==j[0]&&j.unshift(g),d[g]}function cC(a,b){var c,d,e,f,g=a.dataTypes.slice(),h=g[0],i={},j=0;a.dataFilter&&(b=a.dataFilter(b,a.dataType));if(g[1])for(c in a.converters)i[c.toLowerCase()]=a.converters[c];for(;e=g[++j];)if(e!=="*"){if(h!=="*"&&h!==e){c=i[h+" "+e]||i["* "+e];if(!c)for(d in i){f=d.split(" ");if(f[1]===e){c=i[h+" "+f[0]]||i["* "+f[0]];if(c){c===!0?c=i[d]:i[d]!==!0&&(e=f[0],g.splice(j--,0,e));break}}}if(c!==!0)if(c&&a["throws"])b=c(b);else try{b=c(b)}catch(k){return{state:"parsererror",error:c?k:"No conversion from "+h+" to "+e}}}h=e}return{state:"success",data:b}}function cK(){try{return new a.XMLHttpRequest}catch(b){}}function cL(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function cT(){return setTimeout(function(){cM=b},0),cM=p.now()}function cU(a,b){p.each(b,function(b,c){var d=(cS[b]||[]).concat(cS["*"]),e=0,f=d.length;for(;e<f;e++)if(d[e].call(a,b,c))return})}function cV(a,b,c){var d,e=0,f=0,g=cR.length,h=p.Deferred().always(function(){delete i.elem}),i=function(){var b=cM||cT(),c=Math.max(0,j.startTime+j.duration-b),d=1-(c/j.duration||0),e=0,f=j.tweens.length;for(;e<f;e++)j.tweens[e].run(d);return h.notifyWith(a,[j,d,c]),d<1&&f?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:p.extend({},b),opts:p.extend(!0,{specialEasing:{}},c),originalProperties:b,originalOptions:c,startTime:cM||cT(),duration:c.duration,tweens:[],createTween:function(b,c,d){var e=p.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(e),e},stop:function(b){var c=0,d=b?j.tweens.length:0;for(;c<d;c++)j.tweens[c].run(1);return b?h.resolveWith(a,[j,b]):h.rejectWith(a,[j,b]),this}}),k=j.props;cW(k,j.opts.specialEasing);for(;e<g;e++){d=cR[e].call(j,a,k,j.opts);if(d)return d}return cU(j,k),p.isFunction(j.opts.start)&&j.opts.start.call(a,j),p.fx.timer(p.extend(i,{anim:j,queue:j.opts.queue,elem:a})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}function cW(a,b){var c,d,e,f,g;for(c in a){d=p.camelCase(c),e=b[d],f=a[c],p.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=p.cssHooks[d];if(g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}}function cX(a,b,c){var d,e,f,g,h,i,j,k,l=this,m=a.style,n={},o=[],q=a.nodeType&&bY(a);c.queue||(j=p._queueHooks(a,"fx"),j.unqueued==null&&(j.unqueued=0,k=j.empty.fire,j.empty.fire=function(){j.unqueued||k()}),j.unqueued++,l.always(function(){l.always(function(){j.unqueued--,p.queue(a,"fx").length||j.empty.fire()})})),a.nodeType===1&&("height"in b||"width"in b)&&(c.overflow=[m.overflow,m.overflowX,m.overflowY],p.css(a,"display")==="inline"&&p.css(a,"float")==="none"&&(!p.support.inlineBlockNeedsLayout||cb(a.nodeName)==="inline"?m.display="inline-block":m.zoom=1)),c.overflow&&(m.overflow="hidden",p.support.shrinkWrapBlocks||l.done(function(){m.overflow=c.overflow[0],m.overflowX=c.overflow[1],m.overflowY=c.overflow[2]}));for(d in b){f=b[d];if(cO.exec(f)){delete b[d];if(f===(q?"hide":"show"))continue;o.push(d)}}g=o.length;if(g){h=p._data(a,"fxshow")||p._data(a,"fxshow",{}),q?p(a).show():l.done(function(){p(a).hide()}),l.done(function(){var b;p.removeData(a,"fxshow",!0);for(b in n)p.style(a,b,n[b])});for(d=0;d<g;d++)e=o[d],i=l.createTween(e,q?h[e]:0),n[e]=h[e]||p.style(a,e),e in h||(h[e]=i.start,q&&(i.end=i.start,i.start=e==="width"||e==="height"?1:0))}}function cY(a,b,c,d,e){return new cY.prototype.init(a,b,c,d,e)}function cZ(a,b){var c,d={height:a},e=0;for(;e<4;e+=2-b)c=bU[e],d["margin"+c]=d["padding"+c]=a;return b&&(d.opacity=d.width=a),d}function c_(a){return p.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}var c,d,e=a.document,f=a.location,g=a.navigator,h=a.jQuery,i=a.$,j=Array.prototype.push,k=Array.prototype.slice,l=Array.prototype.indexOf,m=Object.prototype.toString,n=Object.prototype.hasOwnProperty,o=String.prototype.trim,p=function(a,b){return new p.fn.init(a,b,c)},q=/[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source,r=/\S/,s=/\s+/,t=r.test(" ")?/^[\s\xA0]+|[\s\xA0]+$/g:/^\s+|\s+$/g,u=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,v=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,w=/^[\],:{}\s]*$/,x=/(?:^|:|,)(?:\s*\[)+/g,y=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,z=/"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g,A=/^-ms-/,B=/-([\da-z])/gi,C=function(a,b){return(b+"").toUpperCase()},D=function(){e.addEventListener?(e.removeEventListener("DOMContentLoaded",D,!1),p.ready()):e.readyState==="complete"&&(e.detachEvent("onreadystatechange",D),p.ready())},E={};p.fn=p.prototype={constructor:p,init:function(a,c,d){var f,g,h,i;if(!a)return this;if(a.nodeType)return this.context=this[0]=a,this.length=1,this;if(typeof a=="string"){a.charAt(0)==="<"&&a.charAt(a.length-1)===">"&&a.length>=3?f=[null,a,null]:f=u.exec(a);if(f&&(f[1]||!c)){if(f[1])return c=c instanceof p?c[0]:c,i=c&&c.nodeType?c.ownerDocument||c:e,a=p.parseHTML(f[1],i,!0),v.test(f[1])&&p.isPlainObject(c)&&this.attr.call(a,c,!0),p.merge(this,a);g=e.getElementById(f[2]);if(g&&g.parentNode){if(g.id!==f[2])return d.find(a);this.length=1,this[0]=g}return this.context=e,this.selector=a,this}return!c||c.jquery?(c||d).find(a):this.constructor(c).find(a)}return p.isFunction(a)?d.ready(a):(a.selector!==b&&(this.selector=a.selector,this.context=a.context),p.makeArray(a,this))},selector:"",jquery:"1.8.0",length:0,size:function(){return this.length},toArray:function(){return k.call(this)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=p.merge(this.constructor(),a);return d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")"),d},each:function(a,b){return p.each(this,a,b)},ready:function(a){return p.ready.promise().done(a),this},eq:function(a){return a=+a,a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(k.apply(this,arguments),"slice",k.call(arguments).join(","))},map:function(a){return this.pushStack(p.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:j,sort:[].sort,splice:[].splice},p.fn.init.prototype=p.fn,p.extend=p.fn.extend=function(){var a,c,d,e,f,g,h=arguments[0]||{},i=1,j=arguments.length,k=!1;typeof h=="boolean"&&(k=h,h=arguments[1]||{},i=2),typeof h!="object"&&!p.isFunction(h)&&(h={}),j===i&&(h=this,--i);for(;i<j;i++)if((a=arguments[i])!=null)for(c in a){d=h[c],e=a[c];if(h===e)continue;k&&e&&(p.isPlainObject(e)||(f=p.isArray(e)))?(f?(f=!1,g=d&&p.isArray(d)?d:[]):g=d&&p.isPlainObject(d)?d:{},h[c]=p.extend(k,g,e)):e!==b&&(h[c]=e)}return h},p.extend({noConflict:function(b){return a.$===p&&(a.$=i),b&&a.jQuery===p&&(a.jQuery=h),p},isReady:!1,readyWait:1,holdReady:function(a){a?p.readyWait++:p.ready(!0)},ready:function(a){if(a===!0?--p.readyWait:p.isReady)return;if(!e.body)return setTimeout(p.ready,1);p.isReady=!0;if(a!==!0&&--p.readyWait>0)return;d.resolveWith(e,[p]),p.fn.trigger&&p(e).trigger("ready").off("ready")},isFunction:function(a){return p.type(a)==="function"},isArray:Array.isArray||function(a){return p.type(a)==="array"},isWindow:function(a){return a!=null&&a==a.window},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):E[m.call(a)]||"object"},isPlainObject:function(a){if(!a||p.type(a)!=="object"||a.nodeType||p.isWindow(a))return!1;try{if(a.constructor&&!n.call(a,"constructor")&&!n.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||n.call(a,d)},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},error:function(a){throw new Error(a)},parseHTML:function(a,b,c){var d;return!a||typeof a!="string"?null:(typeof b=="boolean"&&(c=b,b=0),b=b||e,(d=v.exec(a))?[b.createElement(d[1])]:(d=p.buildFragment([a],b,c?null:[]),p.merge([],(d.cacheable?p.clone(d.fragment):d.fragment).childNodes)))},parseJSON:function(b){if(!b||typeof b!="string")return null;b=p.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(w.test(b.replace(y,"@").replace(z,"]").replace(x,"")))return(new Function("return "+b))();p.error("Invalid JSON: "+b)},parseXML:function(c){var d,e;if(!c||typeof c!="string")return null;try{a.DOMParser?(e=new DOMParser,d=e.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(f){d=b}return(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&p.error("Invalid XML: "+c),d},noop:function(){},globalEval:function(b){b&&r.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(A,"ms-").replace(B,C)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var e,f=0,g=a.length,h=g===b||p.isFunction(a);if(d){if(h){for(e in a)if(c.apply(a[e],d)===!1)break}else for(;f<g;)if(c.apply(a[f++],d)===!1)break}else if(h){for(e in a)if(c.call(a[e],e,a[e])===!1)break}else for(;f<g;)if(c.call(a[f],f,a[f++])===!1)break;return a},trim:o?function(a){return a==null?"":o.call(a)}:function(a){return a==null?"":a.toString().replace(t,"")},makeArray:function(a,b){var c,d=b||[];return a!=null&&(c=p.type(a),a.length==null||c==="string"||c==="function"||c==="regexp"||p.isWindow(a)?j.call(d,a):p.merge(d,a)),d},inArray:function(a,b,c){var d;if(b){if(l)return l.call(b,a,c);d=b.length,c=c?c<0?Math.max(0,d+c):c:0;for(;c<d;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,c){var d=c.length,e=a.length,f=0;if(typeof d=="number")for(;f<d;f++)a[e++]=c[f];else while(c[f]!==b)a[e++]=c[f++];return a.length=e,a},grep:function(a,b,c){var d,e=[],f=0,g=a.length;c=!!c;for(;f<g;f++)d=!!b(a[f],f),c!==d&&e.push(a[f]);return e},map:function(a,c,d){var e,f,g=[],h=0,i=a.length,j=a instanceof p||i!==b&&typeof i=="number"&&(i>0&&a[0]&&a[i-1]||i===0||p.isArray(a));if(j)for(;h<i;h++)e=c(a[h],h,d),e!=null&&(g[g.length]=e);else for(f in a)e=c(a[f],f,d),e!=null&&(g[g.length]=e);return g.concat.apply([],g)},guid:1,proxy:function(a,c){var d,e,f;return typeof c=="string"&&(d=a[c],c=a,a=d),p.isFunction(a)?(e=k.call(arguments,2),f=function(){return a.apply(c,e.concat(k.call(arguments)))},f.guid=a.guid=a.guid||f.guid||p.guid++,f):b},access:function(a,c,d,e,f,g,h){var i,j=d==null,k=0,l=a.length;if(d&&typeof d=="object"){for(k in d)p.access(a,c,k,d[k],1,g,e);f=1}else if(e!==b){i=h===b&&p.isFunction(e),j&&(i?(i=c,c=function(a,b,c){return i.call(p(a),c)}):(c.call(a,e),c=null));if(c)for(;k<l;k++)c(a[k],d,i?e.call(a[k],k,c(a[k],d)):e,h);f=1}return f?a:j?c.call(a):l?c(a[0],d):g},now:function(){return(new Date).getTime()}}),p.ready.promise=function(b){if(!d){d=p.Deferred();if(e.readyState==="complete"||e.readyState!=="loading"&&e.addEventListener)setTimeout(p.ready,1);else if(e.addEventListener)e.addEventListener("DOMContentLoaded",D,!1),a.addEventListener("load",p.ready,!1);else{e.attachEvent("onreadystatechange",D),a.attachEvent("onload",p.ready);var c=!1;try{c=a.frameElement==null&&e.documentElement}catch(f){}c&&c.doScroll&&function g(){if(!p.isReady){try{c.doScroll("left")}catch(a){return setTimeout(g,50)}p.ready()}}()}}return d.promise(b)},p.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){E["[object "+b+"]"]=b.toLowerCase()}),c=p(e);var F={};p.Callbacks=function(a){a=typeof a=="string"?F[a]||G(a):p.extend({},a);var c,d,e,f,g,h,i=[],j=!a.once&&[],k=function(b){c=a.memory&&b,d=!0,h=f||0,f=0,g=i.length,e=!0;for(;i&&h<g;h++)if(i[h].apply(b[0],b[1])===!1&&a.stopOnFalse){c=!1;break}e=!1,i&&(j?j.length&&k(j.shift()):c?i=[]:l.disable())},l={add:function(){if(i){var b=i.length;(function d(b){p.each(b,function(b,c){p.isFunction(c)&&(!a.unique||!l.has(c))?i.push(c):c&&c.length&&d(c)})})(arguments),e?g=i.length:c&&(f=b,k(c))}return this},remove:function(){return i&&p.each(arguments,function(a,b){var c;while((c=p.inArray(b,i,c))>-1)i.splice(c,1),e&&(c<=g&&g--,c<=h&&h--)}),this},has:function(a){return p.inArray(a,i)>-1},empty:function(){return i=[],this},disable:function(){return i=j=c=b,this},disabled:function(){return!i},lock:function(){return j=b,c||l.disable(),this},locked:function(){return!j},fireWith:function(a,b){return b=b||[],b=[a,b.slice?b.slice():b],i&&(!d||j)&&(e?j.push(b):k(b)),this},fire:function(){return l.fireWith(this,arguments),this},fired:function(){return!!d}};return l},p.extend({Deferred:function(a){var b=[["resolve","done",p.Callbacks("once memory"),"resolved"],["reject","fail",p.Callbacks("once memory"),"rejected"],["notify","progress",p.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return p.Deferred(function(c){p.each(b,function(b,d){var f=d[0],g=a[b];e[d[1]](p.isFunction(g)?function(){var a=g.apply(this,arguments);a&&p.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f+"With"](this===e?c:this,[a])}:c[f])}),a=null}).promise()},promise:function(a){return typeof a=="object"?p.extend(a,d):d}},e={};return d.pipe=d.then,p.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[a^1][2].disable,b[2][2].lock),e[f[0]]=g.fire,e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=k.call(arguments),d=c.length,e=d!==1||a&&p.isFunction(a.promise)?d:0,f=e===1?a:p.Deferred(),g=function(a,b,c){return function(d){b[a]=this,c[a]=arguments.length>1?k.call(arguments):d,c===h?f.notifyWith(b,c):--e||f.resolveWith(b,c)}},h,i,j;if(d>1){h=new Array(d),i=new Array(d),j=new Array(d);for(;b<d;b++)c[b]&&p.isFunction(c[b].promise)?c[b].promise().done(g(b,j,c)).fail(f.reject).progress(g(b,i,h)):--e}return e||f.resolveWith(j,c),f.promise()}}),p.support=function(){var b,c,d,f,g,h,i,j,k,l,m,n=e.createElement("div");n.setAttribute("className","t"),n.innerHTML="  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",c=n.getElementsByTagName("*"),d=n.getElementsByTagName("a")[0],d.style.cssText="top:1px;float:left;opacity:.5";if(!c||!c.length||!d)return{};f=e.createElement("select"),g=f.appendChild(e.createElement("option")),h=n.getElementsByTagName("input")[0],b={leadingWhitespace:n.firstChild.nodeType===3,tbody:!n.getElementsByTagName("tbody").length,htmlSerialize:!!n.getElementsByTagName("link").length,style:/top/.test(d.getAttribute("style")),hrefNormalized:d.getAttribute("href")==="/a",opacity:/^0.5/.test(d.style.opacity),cssFloat:!!d.style.cssFloat,checkOn:h.value==="on",optSelected:g.selected,getSetAttribute:n.className!=="t",enctype:!!e.createElement("form").enctype,html5Clone:e.createElement("nav").cloneNode(!0).outerHTML!=="<:nav></:nav>",boxModel:e.compatMode==="CSS1Compat",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},h.checked=!0,b.noCloneChecked=h.cloneNode(!0).checked,f.disabled=!0,b.optDisabled=!g.disabled;try{delete n.test}catch(o){b.deleteExpando=!1}!n.addEventListener&&n.attachEvent&&n.fireEvent&&(n.attachEvent("onclick",m=function(){b.noCloneEvent=!1}),n.cloneNode(!0).fireEvent("onclick"),n.detachEvent("onclick",m)),h=e.createElement("input"),h.value="t",h.setAttribute("type","radio"),b.radioValue=h.value==="t",h.setAttribute("checked","checked"),h.setAttribute("name","t"),n.appendChild(h),i=e.createDocumentFragment(),i.appendChild(n.lastChild),b.checkClone=i.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=h.checked,i.removeChild(h),i.appendChild(n);if(n.attachEvent)for(k in{submit:!0,change:!0,focusin:!0})j="on"+k,l=j in n,l||(n.setAttribute(j,"return;"),l=typeof n[j]=="function"),b[k+"Bubbles"]=l;return p(function(){var c,d,f,g,h="padding:0;margin:0;border:0;display:block;overflow:hidden;",i=e.getElementsByTagName("body")[0];if(!i)return;c=e.createElement("div"),c.style.cssText="visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px",i.insertBefore(c,i.firstChild),d=e.createElement("div"),c.appendChild(d),d.innerHTML="<table><tr><td></td><td>t</td></tr></table>",f=d.getElementsByTagName("td"),f[0].style.cssText="padding:0;margin:0;border:0;display:none",l=f[0].offsetHeight===0,f[0].style.display="",f[1].style.display="none",b.reliableHiddenOffsets=l&&f[0].offsetHeight===0,d.innerHTML="",d.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",b.boxSizing=d.offsetWidth===4,b.doesNotIncludeMarginInBodyOffset=i.offsetTop!==1,a.getComputedStyle&&(b.pixelPosition=(a.getComputedStyle(d,null)||{}).top!=="1%",b.boxSizingReliable=(a.getComputedStyle(d,null)||{width:"4px"}).width==="4px",g=e.createElement("div"),g.style.cssText=d.style.cssText=h,g.style.marginRight=g.style.width="0",d.style.width="1px",d.appendChild(g),b.reliableMarginRight=!parseFloat((a.getComputedStyle(g,null)||{}).marginRight)),typeof d.style.zoom!="undefined"&&(d.innerHTML="",d.style.cssText=h+"width:1px;padding:1px;display:inline;zoom:1",b.inlineBlockNeedsLayout=d.offsetWidth===3,d.style.display="block",d.style.overflow="visible",d.innerHTML="<div></div>",d.firstChild.style.width="5px",b.shrinkWrapBlocks=d.offsetWidth!==3,c.style.zoom=1),i.removeChild(c),c=d=f=g=null}),i.removeChild(n),c=d=f=g=h=i=n=null,b}();var H=/^(?:\{.*\}|\[.*\])$/,I=/([A-Z])/g;p.extend({cache:{},deletedIds:[],uuid:0,expando:"jQuery"+(p.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){return a=a.nodeType?p.cache[a[p.expando]]:a[p.expando],!!a&&!K(a)},data:function(a,c,d,e){if(!p.acceptData(a))return;var f,g,h=p.expando,i=typeof c=="string",j=a.nodeType,k=j?p.cache:a,l=j?a[h]:a[h]&&h;if((!l||!k[l]||!e&&!k[l].data)&&i&&d===b)return;l||(j?a[h]=l=p.deletedIds.pop()||++p.uuid:l=h),k[l]||(k[l]={},j||(k[l].toJSON=p.noop));if(typeof c=="object"||typeof c=="function")e?k[l]=p.extend(k[l],c):k[l].data=p.extend(k[l].data,c);return f=k[l],e||(f.data||(f.data={}),f=f.data),d!==b&&(f[p.camelCase(c)]=d),i?(g=f[c],g==null&&(g=f[p.camelCase(c)])):g=f,g},removeData:function(a,b,c){if(!p.acceptData(a))return;var d,e,f,g=a.nodeType,h=g?p.cache:a,i=g?a[p.expando]:p.expando;if(!h[i])return;if(b){d=c?h[i]:h[i].data;if(d){p.isArray(b)||(b in d?b=[b]:(b=p.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,f=b.length;e<f;e++)delete d[b[e]];if(!(c?K:p.isEmptyObject)(d))return}}if(!c){delete h[i].data;if(!K(h[i]))return}g?p.cleanData([a],!0):p.support.deleteExpando||h!=h.window?delete h[i]:h[i]=null},_data:function(a,b,c){return p.data(a,b,c,!0)},acceptData:function(a){var b=a.nodeName&&p.noData[a.nodeName.toLowerCase()];return!b||b!==!0&&a.getAttribute("classid")===b}}),p.fn.extend({data:function(a,c){var d,e,f,g,h,i=this[0],j=0,k=null;if(a===b){if(this.length){k=p.data(i);if(i.nodeType===1&&!p._data(i,"parsedAttrs")){f=i.attributes;for(h=f.length;j<h;j++)g=f[j].name,g.indexOf("data-")===0&&(g=p.camelCase(g.substring(5)),J(i,g,k[g]));p._data(i,"parsedAttrs",!0)}}return k}return typeof a=="object"?this.each(function(){p.data(this,a)}):(d=a.split(".",2),d[1]=d[1]?"."+d[1]:"",e=d[1]+"!",p.access(this,function(c){if(c===b)return k=this.triggerHandler("getData"+e,[d[0]]),k===b&&i&&(k=p.data(i,a),k=J(i,a,k)),k===b&&d[1]?this.data(d[0]):k;d[1]=c,this.each(function(){var b=p(this);b.triggerHandler("setData"+e,d),p.data(this,a,c),b.triggerHandler("changeData"+e,d)})},null,c,arguments.length>1,null,!1))},removeData:function(a){return this.each(function(){p.removeData(this,a)})}}),p.extend({queue:function(a,b,c){var d;if(a)return b=(b||"fx")+"queue",d=p._data(a,b),c&&(!d||p.isArray(c)?d=p._data(a,b,p.makeArray(c)):d.push(c)),d||[]},dequeue:function(a,b){b=b||"fx";var c=p.queue(a,b),d=c.shift(),e=p._queueHooks(a,b),f=function(){p.dequeue(a,b)};d==="inprogress"&&(d=c.shift()),d&&(b==="fx"&&c.unshift("inprogress"),delete e.stop,d.call(a,f,e)),!c.length&&e&&e.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return p._data(a,c)||p._data(a,c,{empty:p.Callbacks("once memory").add(function(){p.removeData(a,b+"queue",!0),p.removeData(a,c,!0)})})}}),p.fn.extend({queue:function(a,c){var d=2;return typeof a!="string"&&(c=a,a="fx",d--),arguments.length<d?p.queue(this[0],a):c===b?this:this.each(function(){var b=p.queue(this,a,c);p._queueHooks(this,a),a==="fx"&&b[0]!=="inprogress"&&p.dequeue(this,a)})},dequeue:function(a){return this.each(function(){p.dequeue(this,a)})},delay:function(a,b){return a=p.fx?p.fx.speeds[a]||a:a,b=b||"fx",this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,c){var d,e=1,f=p.Deferred(),g=this,h=this.length,i=function(){--e||f.resolveWith(g,[g])};typeof a!="string"&&(c=a,a=b),a=a||"fx";while(h--)(d=p._data(g[h],a+"queueHooks"))&&d.empty&&(e++,d.empty.add(i));return i(),f.promise(c)}});var L,M,N,O=/[\t\r\n]/g,P=/\r/g,Q=/^(?:button|input)$/i,R=/^(?:button|input|object|select|textarea)$/i,S=/^a(?:rea|)$/i,T=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,U=p.support.getSetAttribute;p.fn.extend({attr:function(a,b){return p.access(this,p.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){p.removeAttr(this,a)})},prop:function(a,b){return p.access(this,p.prop,a,b,arguments.length>1)},removeProp:function(a){return a=p.propFix[a]||a,this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,f,g,h;if(p.isFunction(a))return this.each(function(b){p(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(s);for(c=0,d=this.length;c<d;c++){e=this[c];if(e.nodeType===1)if(!e.className&&b.length===1)e.className=a;else{f=" "+e.className+" ";for(g=0,h=b.length;g<h;g++)~f.indexOf(" "+b[g]+" ")||(f+=b[g]+" ");e.className=p.trim(f)}}}return this},removeClass:function(a){var c,d,e,f,g,h,i;if(p.isFunction(a))return this.each(function(b){p(this).removeClass(a.call(this,b,this.className))});if(a&&typeof a=="string"||a===b){c=(a||"").split(s);for(h=0,i=this.length;h<i;h++){e=this[h];if(e.nodeType===1&&e.className){d=(" "+e.className+" ").replace(O," ");for(f=0,g=c.length;f<g;f++)while(d.indexOf(" "+c[f]+" ")>-1)d=d.replace(" "+c[f]+" "," ");e.className=a?p.trim(d):""}}}return this},toggleClass:function(a,b){var c=typeof a,d=typeof b=="boolean";return p.isFunction(a)?this.each(function(c){p(this).toggleClass(a.call(this,c,this.className,b),b)}):this.each(function(){if(c==="string"){var e,f=0,g=p(this),h=b,i=a.split(s);while(e=i[f++])h=d?h:!g.hasClass(e),g[h?"addClass":"removeClass"](e)}else if(c==="undefined"||c==="boolean")this.className&&p._data(this,"__className__",this.className),this.className=this.className||a===!1?"":p._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ",c=0,d=this.length;for(;c<d;c++)if(this[c].nodeType===1&&(" "+this[c].className+" ").replace(O," ").indexOf(b)>-1)return!0;return!1},val:function(a){var c,d,e,f=this[0];if(!arguments.length){if(f)return c=p.valHooks[f.type]||p.valHooks[f.nodeName.toLowerCase()],c&&"get"in c&&(d=c.get(f,"value"))!==b?d:(d=f.value,typeof d=="string"?d.replace(P,""):d==null?"":d);return}return e=p.isFunction(a),this.each(function(d){var f,g=p(this);if(this.nodeType!==1)return;e?f=a.call(this,d,g.val()):f=a,f==null?f="":typeof f=="number"?f+="":p.isArray(f)&&(f=p.map(f,function(a){return a==null?"":a+""})),c=p.valHooks[this.type]||p.valHooks[this.nodeName.toLowerCase()];if(!c||!("set"in c)||c.set(this,f,"value")===b)this.value=f})}}),p.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,f=a.selectedIndex,g=[],h=a.options,i=a.type==="select-one";if(f<0)return null;c=i?f:0,d=i?f+1:h.length;for(;c<d;c++){e=h[c];if(e.selected&&(p.support.optDisabled?!e.disabled:e.getAttribute("disabled")===null)&&(!e.parentNode.disabled||!p.nodeName(e.parentNode,"optgroup"))){b=p(e).val();if(i)return b;g.push(b)}}return i&&!g.length&&h.length?p(h[f]).val():g},set:function(a,b){var c=p.makeArray(b);return p(a).find("option").each(function(){this.selected=p.inArray(p(this).val(),c)>=0}),c.length||(a.selectedIndex=-1),c}}},attrFn:{},attr:function(a,c,d,e){var f,g,h,i=a.nodeType;if(!a||i===3||i===8||i===2)return;if(e&&p.isFunction(p.fn[c]))return p(a)[c](d);if(typeof a.getAttribute=="undefined")return p.prop(a,c,d);h=i!==1||!p.isXMLDoc(a),h&&(c=c.toLowerCase(),g=p.attrHooks[c]||(T.test(c)?M:L));if(d!==b){if(d===null){p.removeAttr(a,c);return}return g&&"set"in g&&h&&(f=g.set(a,d,c))!==b?f:(a.setAttribute(c,""+d),d)}return g&&"get"in g&&h&&(f=g.get(a,c))!==null?f:(f=a.getAttribute(c),f===null?b:f)},removeAttr:function(a,b){var c,d,e,f,g=0;if(b&&a.nodeType===1){d=b.split(s);for(;g<d.length;g++)e=d[g],e&&(c=p.propFix[e]||e,f=T.test(e),f||p.attr(a,e,""),a.removeAttribute(U?e:c),f&&c in a&&(a[c]=!1))}},attrHooks:{type:{set:function(a,b){if(Q.test(a.nodeName)&&a.parentNode)p.error("type property can't be changed");else if(!p.support.radioValue&&b==="radio"&&p.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}},value:{get:function(a,b){return L&&p.nodeName(a,"button")?L.get(a,b):b in a?a.value:null},set:function(a,b,c){if(L&&p.nodeName(a,"button"))return L.set(a,b,c);a.value=b}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,c,d){var e,f,g,h=a.nodeType;if(!a||h===3||h===8||h===2)return;return g=h!==1||!p.isXMLDoc(a),g&&(c=p.propFix[c]||c,f=p.propHooks[c]),d!==b?f&&"set"in f&&(e=f.set(a,d,c))!==b?e:a[c]=d:f&&"get"in f&&(e=f.get(a,c))!==null?e:a[c]},propHooks:{tabIndex:{get:function(a){var c=a.getAttributeNode("tabindex");return c&&c.specified?parseInt(c.value,10):R.test(a.nodeName)||S.test(a.nodeName)&&a.href?0:b}}}}),M={get:function(a,c){var d,e=p.prop(a,c);return e===!0||typeof e!="boolean"&&(d=a.getAttributeNode(c))&&d.nodeValue!==!1?c.toLowerCase():b},set:function(a,b,c){var d;return b===!1?p.removeAttr(a,c):(d=p.propFix[c]||c,d in a&&(a[d]=!0),a.setAttribute(c,c.toLowerCase())),c}},U||(N={name:!0,id:!0,coords:!0},L=p.valHooks.button={get:function(a,c){var d;return d=a.getAttributeNode(c),d&&(N[c]?d.value!=="":d.specified)?d.value:b},set:function(a,b,c){var d=a.getAttributeNode(c);return d||(d=e.createAttribute(c),a.setAttributeNode(d)),d.value=b+""}},p.each(["width","height"],function(a,b){p.attrHooks[b]=p.extend(p.attrHooks[b],{set:function(a,c){if(c==="")return a.setAttribute(b,"auto"),c}})}),p.attrHooks.contenteditable={get:L.get,set:function(a,b,c){b===""&&(b="false"),L.set(a,b,c)}}),p.support.hrefNormalized||p.each(["href","src","width","height"],function(a,c){p.attrHooks[c]=p.extend(p.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),p.support.style||(p.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=""+b}}),p.support.optSelected||(p.propHooks.selected=p.extend(p.propHooks.selected,{get:function(a){var b=a.parentNode;return b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex),null}})),p.support.enctype||(p.propFix.enctype="encoding"),p.support.checkOn||p.each(["radio","checkbox"],function(){p.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),p.each(["radio","checkbox"],function(){p.valHooks[this]=p.extend(p.valHooks[this],{set:function(a,b){if(p.isArray(b))return a.checked=p.inArray(p(a).val(),b)>=0}})});var V=/^(?:textarea|input|select)$/i,W=/^([^\.]*|)(?:\.(.+)|)$/,X=/(?:^|\s)hover(\.\S+|)\b/,Y=/^key/,Z=/^(?:mouse|contextmenu)|click/,$=/^(?:focusinfocus|focusoutblur)$/,_=function(a){return p.event.special.hover?a:a.replace(X,"mouseenter$1 mouseleave$1")};p.event={add:function(a,c,d,e,f){var g,h,i,j,k,l,m,n,o,q,r;if(a.nodeType===3||a.nodeType===8||!c||!d||!(g=p._data(a)))return;d.handler&&(o=d,d=o.handler,f=o.selector),d.guid||(d.guid=p.guid++),i=g.events,i||(g.events=i={}),h=g.handle,h||(g.handle=h=function(a){return typeof p!="undefined"&&(!a||p.event.triggered!==a.type)?p.event.dispatch.apply(h.elem,arguments):b},h.elem=a),c=p.trim(_(c)).split(" ");for(j=0;j<c.length;j++){k=W.exec(c[j])||[],l=k[1],m=(k[2]||"").split(".").sort(),r=p.event.special[l]||{},l=(f?r.delegateType:r.bindType)||l,r=p.event.special[l]||{},n=p.extend({type:l,origType:k[1],data:e,handler:d,guid:d.guid,selector:f,namespace:m.join(".")},o),q=i[l];if(!q){q=i[l]=[],q.delegateCount=0;if(!r.setup||r.setup.call(a,e,m,h)===!1)a.addEventListener?a.addEventListener(l,h,!1):a.attachEvent&&a.attachEvent("on"+l,h)}r.add&&(r.add.call(a,n),n.handler.guid||(n.handler.guid=d.guid)),f?q.splice(q.delegateCount++,0,n):q.push(n),p.event.global[l]=!0}a=null},global:{},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,q,r=p.hasData(a)&&p._data(a);if(!r||!(m=r.events))return;b=p.trim(_(b||"")).split(" ");for(f=0;f<b.length;f++){g=W.exec(b[f])||[],h=i=g[1],j=g[2];if(!h){for(h in m)p.event.remove(a,h+b[f],c,d,!0);continue}n=p.event.special[h]||{},h=(d?n.delegateType:n.bindType)||h,o=m[h]||[],k=o.length,j=j?new RegExp("(^|\\.)"+j.split(".").sort().join("\\.(?:.*\\.|)")+"(\\.|$)"):null;for(l=0;l<o.length;l++)q=o[l],(e||i===q.origType)&&(!c||c.guid===q.guid)&&(!j||j.test(q.namespace))&&(!d||d===q.selector||d==="**"&&q.selector)&&(o.splice(l--,1),q.selector&&o.delegateCount--,n.remove&&n.remove.call(a,q));o.length===0&&k!==o.length&&((!n.teardown||n.teardown.call(a,j,r.handle)===!1)&&p.removeEvent(a,h,r.handle),delete m[h])}p.isEmptyObject(m)&&(delete r.handle,p.removeData(a,"events",!0))},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(c,d,f,g){if(!f||f.nodeType!==3&&f.nodeType!==8){var h,i,j,k,l,m,n,o,q,r,s=c.type||c,t=[];if($.test(s+p.event.triggered))return;s.indexOf("!")>=0&&(s=s.slice(0,-1),i=!0),s.indexOf(".")>=0&&(t=s.split("."),s=t.shift(),t.sort());if((!f||p.event.customEvent[s])&&!p.event.global[s])return;c=typeof c=="object"?c[p.expando]?c:new p.Event(s,c):new p.Event(s),c.type=s,c.isTrigger=!0,c.exclusive=i,c.namespace=t.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+t.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,m=s.indexOf(":")<0?"on"+s:"";if(!f){h=p.cache;for(j in h)h[j].events&&h[j].events[s]&&p.event.trigger(c,d,h[j].handle.elem,!0);return}c.result=b,c.target||(c.target=f),d=d!=null?p.makeArray(d):[],d.unshift(c),n=p.event.special[s]||{};if(n.trigger&&n.trigger.apply(f,d)===!1)return;q=[[f,n.bindType||s]];if(!g&&!n.noBubble&&!p.isWindow(f)){r=n.delegateType||s,k=$.test(r+s)?f:f.parentNode;for(l=f;k;k=k.parentNode)q.push([k,r]),l=k;l===(f.ownerDocument||e)&&q.push([l.defaultView||l.parentWindow||a,r])}for(j=0;j<q.length&&!c.isPropagationStopped();j++)k=q[j][0],c.type=q[j][1],o=(p._data(k,"events")||{})[c.type]&&p._data(k,"handle"),o&&o.apply(k,d),o=m&&k[m],o&&p.acceptData(k)&&o.apply(k,d)===!1&&c.preventDefault();return c.type=s,!g&&!c.isDefaultPrevented()&&(!n._default||n._default.apply(f.ownerDocument,d)===!1)&&(s!=="click"||!p.nodeName(f,"a"))&&p.acceptData(f)&&m&&f[s]&&(s!=="focus"&&s!=="blur"||c.target.offsetWidth!==0)&&!p.isWindow(f)&&(l=f[m],l&&(f[m]=null),p.event.triggered=s,f[s](),p.event.triggered=b,l&&(f[m]=l)),c.result}return},dispatch:function(c){c=p.event.fix(c||a.event);var d,e,f,g,h,i,j,k,l,m,n,o=(p._data(this,"events")||{})[c.type]||[],q=o.delegateCount,r=[].slice.call(arguments),s=!c.exclusive&&!c.namespace,t=p.event.special[c.type]||{},u=[];r[0]=c,c.delegateTarget=this;if(t.preDispatch&&t.preDispatch.call(this,c)===!1)return;if(q&&(!c.button||c.type!=="click")){g=p(this),g.context=this;for(f=c.target;f!=this;f=f.parentNode||this)if(f.disabled!==!0||c.type!=="click"){i={},k=[],g[0]=f;for(d=0;d<q;d++)l=o[d],m=l.selector,i[m]===b&&(i[m]=g.is(m)),i[m]&&k.push(l);k.length&&u.push({elem:f,matches:k})}}o.length>q&&u.push({elem:this,matches:o.slice(q)});for(d=0;d<u.length&&!c.isPropagationStopped();d++){j=u[d],c.currentTarget=j.elem;for(e=0;e<j.matches.length&&!c.isImmediatePropagationStopped();e++){l=j.matches[e];if(s||!c.namespace&&!l.namespace||c.namespace_re&&c.namespace_re.test(l.namespace))c.data=l.data,c.handleObj=l,h=((p.event.special[l.origType]||{}).handle||l.handler).apply(j.elem,r),h!==b&&(c.result=h,h===!1&&(c.preventDefault(),c.stopPropagation()))}}return t.postDispatch&&t.postDispatch.call(this,c),c.result},props:"attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){return a.which==null&&(a.which=b.charCode!=null?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,c){var d,f,g,h=c.button,i=c.fromElement;return a.pageX==null&&c.clientX!=null&&(d=a.target.ownerDocument||e,f=d.documentElement,g=d.body,a.pageX=c.clientX+(f&&f.scrollLeft||g&&g.scrollLeft||0)-(f&&f.clientLeft||g&&g.clientLeft||0),a.pageY=c.clientY+(f&&f.scrollTop||g&&g.scrollTop||0)-(f&&f.clientTop||g&&g.clientTop||0)),!a.relatedTarget&&i&&(a.relatedTarget=i===a.target?c.toElement:i),!a.which&&h!==b&&(a.which=h&1?1:h&2?3:h&4?2:0),a}},fix:function(a){if(a[p.expando])return a;var b,c,d=a,f=p.event.fixHooks[a.type]||{},g=f.props?this.props.concat(f.props):this.props;a=p.Event(d);for(b=g.length;b;)c=g[--b],a[c]=d[c];return a.target||(a.target=d.srcElement||e),a.target.nodeType===3&&(a.target=a.target.parentNode),a.metaKey=!!a.metaKey,f.filter?f.filter(a,d):a},special:{ready:{setup:p.bindReady},load:{noBubble:!0},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(a,b,c){p.isWindow(this)&&(this.onbeforeunload=c)},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}},simulate:function(a,b,c,d){var e=p.extend(new p.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?p.event.trigger(e,null,b):p.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},p.event.handle=p.event.dispatch,p.removeEvent=e.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){var d="on"+b;a.detachEvent&&(typeof a[d]=="undefined"&&(a[d]=null),a.detachEvent(d,c))},p.Event=function(a,b){if(this instanceof p.Event)a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?bb:ba):this.type=a,b&&p.extend(this,b),this.timeStamp=a&&a.timeStamp||p.now(),this[p.expando]=!0;else return new p.Event(a,b)},p.Event.prototype={preventDefault:function(){this.isDefaultPrevented=bb;var a=this.originalEvent;if(!a)return;a.preventDefault?a.preventDefault():a.returnValue=!1},stopPropagation:function(){this.isPropagationStopped=bb;var a=this.originalEvent;if(!a)return;a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=bb,this.stopPropagation()},isDefaultPrevented:ba,isPropagationStopped:ba,isImmediatePropagationStopped:ba},p.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){p.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj,g=f.selector;if(!e||e!==d&&!p.contains(d,e))a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b;return c}}}),p.support.submitBubbles||(p.event.special.submit={setup:function(){if(p.nodeName(this,"form"))return!1;p.event.add(this,"click._submit keypress._submit",function(a){var c=a.target,d=p.nodeName(c,"input")||p.nodeName(c,"button")?c.form:b;d&&!p._data(d,"_submit_attached")&&(p.event.add(d,"submit._submit",function(a){a._submit_bubble=!0}),p._data(d,"_submit_attached",!0))})},postDispatch:function(a){a._submit_bubble&&(delete a._submit_bubble,this.parentNode&&!a.isTrigger&&p.event.simulate("submit",this.parentNode,a,!0))},teardown:function(){if(p.nodeName(this,"form"))return!1;p.event.remove(this,"._submit")}}),p.support.changeBubbles||(p.event.special.change={setup:function(){if(V.test(this.nodeName)){if(this.type==="checkbox"||this.type==="radio")p.event.add(this,"propertychange._change",function(a){a.originalEvent.propertyName==="checked"&&(this._just_changed=!0)}),p.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1),p.event.simulate("change",this,a,!0)});return!1}p.event.add(this,"beforeactivate._change",function(a){var b=a.target;V.test(b.nodeName)&&!p._data(b,"_change_attached")&&(p.event.add(b,"change._change",function(a){this.parentNode&&!a.isSimulated&&!a.isTrigger&&p.event.simulate("change",this.parentNode,a,!0)}),p._data(b,"_change_attached",!0))})},handle:function(a){var b=a.target;if(this!==b||a.isSimulated||a.isTrigger||b.type!=="radio"&&b.type!=="checkbox")return a.handleObj.handler.apply(this,arguments)},teardown:function(){return p.event.remove(this,"._change"),V.test(this.nodeName)}}),p.support.focusinBubbles||p.each({focus:"focusin",blur:"focusout"},function(a,b){var c=0,d=function(a){p.event.simulate(b,a.target,p.event.fix(a),!0)};p.event.special[b]={setup:function(){c++===0&&e.addEventListener(a,d,!0)},teardown:function(){--c===0&&e.removeEventListener(a,d,!0)}}}),p.fn.extend({on:function(a,c,d,e,f){var g,h;if(typeof a=="object"){typeof c!="string"&&(d=d||c,c=b);for(h in a)this.on(h,c,d,a[h],f);return this}d==null&&e==null?(e=c,d=c=b):e==null&&(typeof c=="string"?(e=d,d=b):(e=d,d=c,c=b));if(e===!1)e=ba;else if(!e)return this;return f===1&&(g=e,e=function(a){return p().off(a),g.apply(this,arguments)},e.guid=g.guid||(g.guid=p.guid++)),this.each(function(){p.event.add(this,a,e,d,c)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,c,d){var e,f;if(a&&a.preventDefault&&a.handleObj)return e=a.handleObj,p(a.delegateTarget).off(e.namespace?e.origType+"."+e.namespace:e.origType,e.selector,e.handler),this;if(typeof a=="object"){for(f in a)this.off(f,c,a[f]);return this}if(c===!1||typeof c=="function")d=c,c=b;return d===!1&&(d=ba),this.each(function(){p.event.remove(this,a,d,c)})},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},live:function(a,b,c){return p(this.context).on(a,this.selector,b,c),this},die:function(a,b){return p(this.context).off(a,this.selector||"**",b),this},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return arguments.length==1?this.off(a,"**"):this.off(b,a||"**",c)},trigger:function(a,b){return this.each(function(){p.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0])return p.event.trigger(a,b,this[0],!0)},toggle:function(a){var b=arguments,c=a.guid||p.guid++,d=0,e=function(c){var e=(p._data(this,"lastToggle"+a.guid)||0)%d;return p._data(this,"lastToggle"+a.guid,e+1),c.preventDefault(),b[e].apply(this,arguments)||!1};e.guid=c;while(d<b.length)b[d++].guid=c;return this.click(e)},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),p.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 contextmenu".split(" "),function(a,b){p.fn[b]=function(a,c){return c==null&&(c=a,a=null),arguments.length>0?this.on(b,null,a,c):this.trigger(b)},Y.test(b)&&(p.event.fixHooks[b]=p.event.keyHooks),Z.test(b)&&(p.event.fixHooks[b]=p.event.mouseHooks)}),function(a,b){function bd(a,b,c,d){var e=0,f=b.length;for(;e<f;e++)Z(a,b[e],c,d)}function be(a,b,c,d,e,f){var g,h=$.setFilters[b.toLowerCase()];return h||Z.error(b),(a||!(g=e))&&bd(a||"*",d,g=[],e),g.length>0?h(g,c,f):[]}function bf(a,c,d,e,f){var g,h,i,j,k,l,m,n,p=0,q=f.length,s=L.POS,t=new RegExp("^"+s.source+"(?!"+r+")","i"),u=function(){var a=1,c=arguments.length-2;for(;a<c;a++)arguments[a]===b&&(g[a]=b)};for(;p<q;p++){s.exec(""),a=f[p],j=[],i=0,k=e;while(g=s.exec(a)){n=s.lastIndex=g.index+g[0].length;if(n>i){m=a.slice(i,g.index),i=n,l=[c],B.test(m)&&(k&&(l=k),k=e);if(h=H.test(m))m=m.slice(0,-5).replace(B,"$&*");g.length>1&&g[0].replace(t,u),k=be(m,g[1],g[2],l,k,h)}}k?(j=j.concat(k),(m=a.slice(i))&&m!==")"?B.test(m)?bd(m,j,d,e):Z(m,c,d,e?e.concat(k):k):o.apply(d,j)):Z(a,c,d,e)}return q===1?d:Z.uniqueSort(d)}function bg(a,b,c){var d,e,f,g=[],i=0,j=D.exec(a),k=!j.pop()&&!j.pop(),l=k&&a.match(C)||[""],m=$.preFilter,n=$.filter,o=!c&&b!==h;for(;(e=l[i])!=null&&k;i++){g.push(d=[]),o&&(e=" "+e);while(e){k=!1;if(j=B.exec(e))e=e.slice(j[0].length),k=d.push({part:j.pop().replace(A," "),captures:j});for(f in n)(j=L[f].exec(e))&&(!m[f]||(j=m[f](j,b,c)))&&(e=e.slice(j.shift().length),k=d.push({part:f,captures:j}));if(!k)break}}return k||Z.error(a),g}function bh(a,b,e){var f=b.dir,g=m++;return a||(a=function(a){return a===e}),b.first?function(b,c){while(b=b[f])if(b.nodeType===1)return a(b,c)&&b}:function(b,e){var h,i=g+"."+d,j=i+"."+c;while(b=b[f])if(b.nodeType===1){if((h=b[q])===j)return b.sizset;if(typeof h=="string"&&h.indexOf(i)===0){if(b.sizset)return b}else{b[q]=j;if(a(b,e))return b.sizset=!0,b;b.sizset=!1}}}}function bi(a,b){return a?function(c,d){var e=b(c,d);return e&&a(e===!0?c:e,d)}:b}function bj(a,b,c){var d,e,f=0;for(;d=a[f];f++)$.relative[d.part]?e=bh(e,$.relative[d.part],b):(d.captures.push(b,c),e=bi(e,$.filter[d.part].apply(null,d.captures)));return e}function bk(a){return function(b,c){var d,e=0;for(;d=a[e];e++)if(d(b,c))return!0;return!1}}var c,d,e,f,g,h=a.document,i=h.documentElement,j="undefined",k=!1,l=!0,m=0,n=[].slice,o=[].push,q=("sizcache"+Math.random()).replace(".",""),r="[\\x20\\t\\r\\n\\f]",s="(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+",t=s.replace("w","w#"),u="([*^$|!~]?=)",v="\\["+r+"*("+s+")"+r+"*(?:"+u+r+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+t+")|)|)"+r+"*\\]",w=":("+s+")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|((?:[^,]|\\\\,|(?:,(?=[^\\[]*\\]))|(?:,(?=[^\\(]*\\))))*))\\)|)",x=":(nth|eq|gt|lt|first|last|even|odd)(?:\\((\\d*)\\)|)(?=[^-]|$)",y=r+"*([\\x20\\t\\r\\n\\f>+~])"+r+"*",z="(?=[^\\x20\\t\\r\\n\\f])(?:\\\\.|"+v+"|"+w.replace(2,7)+"|[^\\\\(),])+",A=new RegExp("^"+r+"+|((?:^|[^\\\\])(?:\\\\.)*)"+r+"+$","g"),B=new RegExp("^"+y),C=new RegExp(z+"?(?="+r+"*,|$)","g"),D=new RegExp("^(?:(?!,)(?:(?:^|,)"+r+"*"+z+")*?|"+r+"*(.*?))(\\)|$)"),E=new RegExp(z.slice(19,-6)+"\\x20\\t\\r\\n\\f>+~])+|"+y,"g"),F=/^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/,G=/[\x20\t\r\n\f]*[+~]/,H=/:not\($/,I=/h\d/i,J=/input|select|textarea|button/i,K=/\\(?!\\)/g,L={ID:new RegExp("^#("+s+")"),CLASS:new RegExp("^\\.("+s+")"),NAME:new RegExp("^\\[name=['\"]?("+s+")['\"]?\\]"),TAG:new RegExp("^("+s.replace("[-","[-\\*")+")"),ATTR:new RegExp("^"+v),PSEUDO:new RegExp("^"+w),CHILD:new RegExp("^:(only|nth|last|first)-child(?:\\("+r+"*(even|odd|(([+-]|)(\\d*)n|)"+r+"*(?:([+-]|)"+r+"*(\\d+)|))"+r+"*\\)|)","i"),POS:new RegExp(x,"ig"),needsContext:new RegExp("^"+r+"*[>+~]|"+x,"i")},M={},N=[],O={},P=[],Q=function(a){return a.sizzleFilter=!0,a},R=function(a){return function(b){return b.nodeName.toLowerCase()==="input"&&b.type===a}},S=function(a){return function(b){var c=b.nodeName.toLowerCase();return(c==="input"||c==="button")&&b.type===a}},T=function(a){var b=!1,c=h.createElement("div");try{b=a(c)}catch(d){}return c=null,b},U=T(function(a){a.innerHTML="<select></select>";var b=typeof a.lastChild.getAttribute("multiple");return b!=="boolean"&&b!=="string"}),V=T(function(a){a.id=q+0,a.innerHTML="<a name='"+q+"'></a><div name='"+q+"'></div>",i.insertBefore(a,i.firstChild);var b=h.getElementsByName&&h.getElementsByName(q).length===2+h.getElementsByName(q+0).length;return g=!h.getElementById(q),i.removeChild(a),b}),W=T(function(a){return a.appendChild(h.createComment("")),a.getElementsByTagName("*").length===0}),X=T(function(a){return a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!==j&&a.firstChild.getAttribute("href")==="#"}),Y=T(function(a){return a.innerHTML="<div class='hidden e'></div><div class='hidden'></div>",!a.getElementsByClassName||a.getElementsByClassName("e").length===0?!1:(a.lastChild.className="e",a.getElementsByClassName("e").length!==1)}),Z=function(a,b,c,d){c=c||[],b=b||h;var e,f,g,i,j=b.nodeType;if(j!==1&&j!==9)return[];if(!a||typeof a!="string")return c;g=ba(b);if(!g&&!d)if(e=F.exec(a))if(i=e[1]){if(j===9){f=b.getElementById(i);if(!f||!f.parentNode)return c;if(f.id===i)return c.push(f),c}else if(b.ownerDocument&&(f=b.ownerDocument.getElementById(i))&&bb(b,f)&&f.id===i)return c.push(f),c}else{if(e[2])return o.apply(c,n.call(b.getElementsByTagName(a),0)),c;if((i=e[3])&&Y&&b.getElementsByClassName)return o.apply(c,n.call(b.getElementsByClassName(i),0)),c}return bm(a,b,c,d,g)},$=Z.selectors={cacheLength:50,match:L,order:["ID","TAG"],attrHandle:{},createPseudo:Q,find:{ID:g?function(a,b,c){if(typeof b.getElementById!==j&&!c){var d=b.getElementById(a);return d&&d.parentNode?[d]:[]}}:function(a,c,d){if(typeof c.getElementById!==j&&!d){var e=c.getElementById(a);return e?e.id===a||typeof e.getAttributeNode!==j&&e.getAttributeNode("id").value===a?[e]:b:[]}},TAG:W?function(a,b){if(typeof b.getElementsByTagName!==j)return b.getElementsByTagName(a)}:function(a,b){var c=b.getElementsByTagName(a);if(a==="*"){var d,e=[],f=0;for(;d=c[f];f++)d.nodeType===1&&e.push(d);return e}return c}},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(K,""),a[3]=(a[4]||a[5]||"").replace(K,""),a[2]==="~="&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),a[1]==="nth"?(a[2]||Z.error(a[0]),a[3]=+(a[3]?a[4]+(a[5]||1):2*(a[2]==="even"||a[2]==="odd")),a[4]=+(a[6]+a[7]||a[2]==="odd")):a[2]&&Z.error(a[0]),a},PSEUDO:function(a){var b,c=a[4];return L.CHILD.test(a[0])?null:(c&&(b=D.exec(c))&&b.pop()&&(a[0]=a[0].slice(0,b[0].length-c.length-1),c=b[0].slice(0,-1)),a.splice(2,3,c||a[3]),a)}},filter:{ID:g?function(a){return a=a.replace(K,""),function(b){return b.getAttribute("id")===a}}:function(a){return a=a.replace(K,""),function(b){var c=typeof b.getAttributeNode!==j&&b.getAttributeNode("id");return c&&c.value===a}},TAG:function(a){return a==="*"?function(){return!0}:(a=a.replace(K,"").toLowerCase(),function(b){return b.nodeName&&b.nodeName.toLowerCase()===a})},CLASS:function(a){var b=M[a];return b||(b=M[a]=new RegExp("(^|"+r+")"+a+"("+r+"|$)"),N.push(a),N.length>$.cacheLength&&delete M[N.shift()]),function(a){return b.test(a.className||typeof a.getAttribute!==j&&a.getAttribute("class")||"")}},ATTR:function(a,b,c){return b?function(d){var e=Z.attr(d,a),f=e+"";if(e==null)return b==="!=";switch(b){case"=":return f===c;case"!=":return f!==c;case"^=":return c&&f.indexOf(c)===0;case"*=":return c&&f.indexOf(c)>-1;case"$=":return c&&f.substr(f.length-c.length)===c;case"~=":return(" "+f+" ").indexOf(c)>-1;case"|=":return f===c||f.substr(0,c.length+1)===c+"-"}}:function(b){return Z.attr(b,a)!=null}},CHILD:function(a,b,c,d){if(a==="nth"){var e=m++;return function(a){var b,f,g=0,h=a;if(c===1&&d===0)return!0;b=a.parentNode;if(b&&(b[q]!==e||!a.sizset)){for(h=b.firstChild;h;h=h.nextSibling)if(h.nodeType===1){h.sizset=++g;if(h===a)break}b[q]=e}return f=a.sizset-d,c===0?f===0:f%c===0&&f/c>=0}}return function(b){var c=b;switch(a){case"only":case"first":while(c=c.previousSibling)if(c.nodeType===1)return!1;if(a==="first")return!0;c=b;case"last":while(c=c.nextSibling)if(c.nodeType===1)return!1;return!0}}},PSEUDO:function(a,b,c,d){var e=$.pseudos[a]||$.pseudos[a.toLowerCase()];return e||Z.error("unsupported pseudo: "+a),e.sizzleFilter?e(b,c,d):e}},pseudos:{not:Q(function(a,b,c){var d=bl(a.replace(A,"$1"),b,c);return function(a){return!d(a)}}),enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&!!a.checked||b==="option"&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},parent:function(a){return!$.pseudos.empty(a)},empty:function(a){var b;a=a.firstChild;while(a){if(a.nodeName>"@"||(b=a.nodeType)===3||b===4)return!1;a=a.nextSibling}return!0},contains:Q(function(a){return function(b){return(b.textContent||b.innerText||bc(b)).indexOf(a)>-1}}),has:Q(function(a){return function(b){return Z(a,b).length>0}}),header:function(a){return I.test(a.nodeName)},text:function(a){var b,c;return a.nodeName.toLowerCase()==="input"&&(b=a.type)==="text"&&((c=a.getAttribute("type"))==null||c.toLowerCase()===b)},radio:R("radio"),checkbox:R("checkbox"),file:R("file"),password:R("password"),image:R("image"),submit:S("submit"),reset:S("reset"),button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&a.type==="button"||b==="button"},input:function(a){return J.test(a.nodeName)},focus:function(a){var b=a.ownerDocument;return a===b.activeElement&&(!b.hasFocus||b.hasFocus())&&(!!a.type||!!a.href)},active:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b,c){return c?a.slice(1):[a[0]]},last:function(a,b,c){var d=a.pop();return c?a:[d]},even:function(a,b,c){var d=[],e=c?1:0,f=a.length;for(;e<f;e=e+2)d.push(a[e]);return d},odd:function(a,b,c){var d=[],e=c?0:1,f=a.length;for(;e<f;e=e+2)d.push(a[e]);return d},lt:function(a,b,c){return c?a.slice(+b):a.slice(0,+b)},gt:function(a,b,c){return c?a.slice(0,+b+1):a.slice(+b+1)},eq:function(a,b,c){var d=a.splice(+b,1);return c?a:d}}};$.setFilters.nth=$.setFilters.eq,$.filters=$.pseudos,X||($.attrHandle={href:function(a){return a.getAttribute("href",2)},type:function(a){return a.getAttribute("type")}}),V&&($.order.push("NAME"),$.find.NAME=function(a,b){if(typeof b.getElementsByName!==j)return b.getElementsByName(a)}),Y&&($.order.splice(1,0,"CLASS"),$.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!==j&&!c)return b.getElementsByClassName(a)});try{n.call(i.childNodes,0)[0].nodeType}catch(_){n=function(a){var b,c=[];for(;b=this[a];a++)c.push(b);return c}}var ba=Z.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?b.nodeName!=="HTML":!1},bb=Z.contains=i.compareDocumentPosition?function(a,b){return!!(a.compareDocumentPosition(b)&16)}:i.contains?function(a,b){var c=a.nodeType===9?a.documentElement:a,d=b.parentNode;return a===d||!!(d&&d.nodeType===1&&c.contains&&c.contains(d))}:function(a,b){while(b=b.parentNode)if(b===a)return!0;return!1},bc=Z.getText=function(a){var b,c="",d=0,e=a.nodeType;if(e){if(e===1||e===9||e===11){if(typeof a.textContent=="string")return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=bc(a)}else if(e===3||e===4)return a.nodeValue}else for(;b=a[d];d++)c+=bc(b);return c};Z.attr=function(a,b){var c,d=ba(a);return d||(b=b.toLowerCase()),$.attrHandle[b]?$.attrHandle[b](a):U||d?a.getAttribute(b):(c=a.getAttributeNode(b),c?typeof a[b]=="boolean"?a[b]?b:null:c.specified?c.value:null:null)},Z.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},[0,0].sort(function(){return l=0}),i.compareDocumentPosition?e=function(a,b){return a===b?(k=!0,0):(!a.compareDocumentPosition||!b.compareDocumentPosition?a.compareDocumentPosition:a.compareDocumentPosition(b)&4)?-1:1}:(e=function(a,b){if(a===b)return k=!0,0;if(a.sourceIndex&&b.sourceIndex)return a.sourceIndex-b.sourceIndex;var c,d,e=[],g=[],h=a.parentNode,i=b.parentNode,j=h;if(h===i)return f(a,b);if(!h)return-1;if(!i)return 1;while(j)e.unshift(j),j=j.parentNode;j=i;while(j)g.unshift(j),j=j.parentNode;c=e.length,d=g.length;for(var l=0;l<c&&l<d;l++)if(e[l]!==g[l])return f(e[l],g[l]);return l===c?f(a,g[l],-1):f(e[l],b,1)},f=function(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}),Z.uniqueSort=function(a){var b,c=1;if(e){k=l,a.sort(e);if(k)for(;b=a[c];c++)b===a[c-1]&&a.splice(c--,1)}return a};var bl=Z.compile=function(a,b,c){var d,e,f,g=O[a];if(g&&g.context===b)return g;e=bg(a,b,c);for(f=0;d=e[f];f++)e[f]=bj(d,b,c);return g=O[a]=bk(e),g.context=b,g.runs=g.dirruns=0,P.push(a),P.length>$.cacheLength&&delete O[P.shift()],g};Z.matches=function(a,b){return Z(a,null,null,b)},Z.matchesSelector=function(a,b){return Z(b,null,null,[a]).length>0};var bm=function(a,b,e,f,g){a=a.replace(A,"$1");var h,i,j,k,l,m,p,q,r,s=a.match(C),t=a.match(E),u=b.nodeType;if(L.POS.test(a))return bf(a,b,e,f,s);if(f)h=n.call(f,0);else if(s&&s.length===1){if(t.length>1&&u===9&&!g&&(s=L.ID.exec(t[0]))){b=$.find.ID(s[1],b,g)[0];if(!b)return e;a=a.slice(t.shift().length)}q=(s=G.exec(t[0]))&&!s.index&&b.parentNode||b,r=t.pop(),m=r.split(":not")[0];for(j=0,k=$.order.length;j<k;j++){p=$.order[j];if(s=L[p].exec(m)){h=$.find[p]((s[1]||"").replace(K,""),q,g);if(h==null)continue;m===r&&(a=a.slice(0,a.length-r.length)+m.replace(L[p],""),a||o.apply(e,n.call(h,0)));break}}}if(a){i=bl(a,b,g),d=i.dirruns++,h==null&&(h=$.find.TAG("*",G.test(a)&&b.parentNode||b));for(j=0;l=h[j];j++)c=i.runs++,i(l,b)&&e.push(l)}return e};h.querySelectorAll&&function(){var a,b=bm,c=/'|\\/g,d=/\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,e=[],f=[":active"],g=i.matchesSelector||i.mozMatchesSelector||i.webkitMatchesSelector||i.oMatchesSelector||i.msMatchesSelector;T(function(a){a.innerHTML="<select><option selected></option></select>",a.querySelectorAll("[selected]").length||e.push("\\["+r+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),a.querySelectorAll(":checked").length||e.push(":checked")}),T(function(a){a.innerHTML="<p test=''></p>",a.querySelectorAll("[test^='']").length&&e.push("[*^$]="+r+"*(?:\"\"|'')"),a.innerHTML="<input type='hidden'>",a.querySelectorAll(":enabled").length||e.push(":enabled",":disabled")}),e=e.length&&new RegExp(e.join("|")),bm=function(a,d,f,g,h){if(!g&&!h&&(!e||!e.test(a)))if(d.nodeType===9)try{return o.apply(f,n.call(d.querySelectorAll(a),0)),f}catch(i){}else if(d.nodeType===1&&d.nodeName.toLowerCase()!=="object"){var j=d.getAttribute("id"),k=j||q,l=G.test(a)&&d.parentNode||d;j?k=k.replace(c,"\\$&"):d.setAttribute("id",k);try{return o.apply(f,n.call(l.querySelectorAll(a.replace(C,"[id='"+k+"'] $&")),0)),f}catch(i){}finally{j||d.removeAttribute("id")}}return b(a,d,f,g,h)},g&&(T(function(b){a=g.call(b,"div");try{g.call(b,"[test!='']:sizzle"),f.push($.match.PSEUDO)}catch(c){}}),f=new RegExp(f.join("|")),Z.matchesSelector=function(b,c){c=c.replace(d,"='$1']");if(!ba(b)&&!f.test(c)&&(!e||!e.test(c)))try{var h=g.call(b,c);if(h||a||b.document&&b.document.nodeType!==11)return h}catch(i){}return Z(c,null,null,[b]).length>0})}(),Z.attr=p.attr,p.find=Z,p.expr=Z.selectors,p.expr[":"]=p.expr.pseudos,p.unique=Z.uniqueSort,p.text=Z.getText,p.isXMLDoc=Z.isXML,p.contains=Z.contains}(a);var bc=/Until$/,bd=/^(?:parents|prev(?:Until|All))/,be=/^.[^:#\[\.,]*$/,bf=p.expr.match.needsContext,bg={children:!0,contents:!0,next:!0,prev:!0};p.fn.extend({find:function(a){var b,c,d,e,f,g,h=this;if(typeof a!="string")return p(a).filter(function(){for(b=0,c=h.length;b<c;b++)if(p.contains(h[b],this))return!0});g=this.pushStack("","find",a);for(b=0,c=this.length;b<c;b++){d=g.length,p.find(a,this[b],g);if(b>0)for(e=d;e<g.length;e++)for(f=0;f<d;f++)if(g[f]===g[e]){g.splice(e--,1);break}}return g},has:function(a){var b,c=p(a,this),d=c.length;return this.filter(function(){for(b=0;b<d;b++)if(p.contains(this,c[b]))return!0})},not:function(a){return this.pushStack(bj(this,a,!1),"not",a)},filter:function(a){return this.pushStack(bj(this,a,!0),"filter",a)},is:function(a){return!!a&&(typeof a=="string"?bf.test(a)?p(a,this.context).index(this[0])>=0:p.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c,d=0,e=this.length,f=[],g=bf.test(a)||typeof a!="string"?p(a,b||this.context):0;for(;d<e;d++){c=this[d];while(c&&c.ownerDocument&&c!==b&&c.nodeType!==11){if(g?g.index(c)>-1:p.find.matchesSelector(c,a)){f.push(c);break}c=c.parentNode}}return f=f.length>1?p.unique(f):f,this.pushStack(f,"closest",a)},index:function(a){return a?typeof a=="string"?p.inArray(this[0],p(a)):p.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.prevAll().length:-1},add:function(a,b){var c=typeof a=="string"?p(a,b):p.makeArray(a&&a.nodeType?[a]:a),d=p.merge(this.get(),c);return this.pushStack(bh(c[0])||bh(d[0])?d:p.unique(d))},addBack:function(a){return this.add(a==null?this.prevObject:this.prevObject.filter(a))}}),p.fn.andSelf=p.fn.addBack,p.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return p.dir(a,"parentNode")},parentsUntil:function(a,b,c){return p.dir(a,"parentNode",c)},next:function(a){return bi(a,"nextSibling")},prev:function(a){return bi(a,"previousSibling")},nextAll:function(a){return p.dir(a,"nextSibling")},prevAll:function(a){return p.dir(a,"previousSibling")},nextUntil:function(a,b,c){return p.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return p.dir(a,"previousSibling",c)},siblings:function(a){return p.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return p.sibling(a.firstChild)},contents:function(a){return p.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:p.merge([],a.childNodes)}},function(a,b){p.fn[a]=function(c,d){var e=p.map(this,b,c);return bc.test(a)||(d=c),d&&typeof d=="string"&&(e=p.filter(d,e)),e=this.length>1&&!bg[a]?p.unique(e):e,this.length>1&&bd.test(a)&&(e=e.reverse()),this.pushStack(e,a,k.call(arguments).join(","))}}),p.extend({filter:function(a,b,c){return c&&(a=":not("+a+")"),b.length===1?p.find.matchesSelector(b[0],a)?[b[0]]:[]:p.find.matches(a,b)},dir:function(a,c,d){var e=[],f=a[c];while(f&&f.nodeType!==9&&(d===b||f.nodeType!==1||!p(f).is(d)))f.nodeType===1&&e.push(f),f=f[c];return e},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var bl="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",bm=/ jQuery\d+="(?:null|\d+)"/g,bn=/^\s+/,bo=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bp=/<([\w:]+)/,bq=/<tbody/i,br=/<|&#?\w+;/,bs=/<(?:script|style|link)/i,bt=/<(?:script|object|embed|option|style)/i,bu=new RegExp("<(?:"+bl+")[\\s/>]","i"),bv=/^(?:checkbox|radio)$/,bw=/checked\s*(?:[^=]|=\s*.checked.)/i,bx=/\/(java|ecma)script/i,by=/^\s*<!(?:\[CDATA\[|\-\-)|[\]\-]{2}>\s*$/g,bz={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,"",""]},bA=bk(e),bB=bA.appendChild(e.createElement("div"));bz.optgroup=bz.option,bz.tbody=bz.tfoot=bz.colgroup=bz.caption=bz.thead,bz.th=bz.td,p.support.htmlSerialize||(bz._default=[1,"X<div>","</div>"]),p.fn.extend({text:function(a){return p.access(this,function(a){return a===b?p.text(this):this.empty().append((this[0]&&this[0].ownerDocument||e).createTextNode(a))},null,a,arguments.length)},wrapAll:function(a){if(p.isFunction(a))return this.each(function(b){p(this).wrapAll(a.call(this,b))});if(this[0]){var b=p(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){return p.isFunction(a)?this.each(function(b){p(this).wrapInner(a.call(this,b))}):this.each(function(){var b=p(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=p.isFunction(a);return this.each(function(c){p(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){p.nodeName(this,"body")||p(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){(this.nodeType===1||this.nodeType===11)&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){(this.nodeType===1||this.nodeType===11)&&this.insertBefore(a,this.firstChild)})},before:function(){if(!bh(this[0]))return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=p.clean(arguments);return this.pushStack(p.merge(a,this),"before",this.selector)}},after:function(){if(!bh(this[0]))return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=p.clean(arguments);return this.pushStack(p.merge(this,a),"after",this.selector)}},remove:function(a,b){var c,d=0;for(;(c=this[d])!=null;d++)if(!a||p.filter(a,[c]).length)!b&&c.nodeType===1&&(p.cleanData(c.getElementsByTagName("*")),p.cleanData([c])),c.parentNode&&c.parentNode.removeChild(c);return this},empty:function(){var a,b=0;for(;(a=this[b])!=null;b++){a.nodeType===1&&p.cleanData(a.getElementsByTagName("*"));while(a.firstChild)a.removeChild(a.firstChild)}return this},clone:function(a,b){return a=a==null?!1:a,b=b==null?a:b,this.map(function(){return p.clone(this,a,b)})},html:function(a){return p.access(this,function(a){var c=this[0]||{},d=0,e=this.length;if(a===b)return c.nodeType===1?c.innerHTML.replace(bm,""):b;if(typeof a=="string"&&!bs.test(a)&&(p.support.htmlSerialize||!bu.test(a))&&(p.support.leadingWhitespace||!bn.test(a))&&!bz[(bp.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(bo,"<$1></$2>");try{for(;d<e;d++)c=this[d]||{},c.nodeType===1&&(p.cleanData(c.getElementsByTagName("*")),c.innerHTML=a);c=0}catch(f){}}c&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(a){return bh(this[0])?this.length?this.pushStack(p(p.isFunction(a)?a():a),"replaceWith",a):this:p.isFunction(a)?this.each(function(b){var c=p(this),d=c.html();c.replaceWith(a.call(this,b,d))}):(typeof a!="string"&&(a=p(a).detach()),this.each(function(){var b=this.nextSibling,c=this.parentNode;p(this).remove(),b?p(b).before(a):p(c).append(a)}))},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,d){a=[].concat.apply([],a);var e,f,g,h,i=0,j=a[0],k=[],l=this.length;if(!p.support.checkClone&&l>1&&typeof j=="string"&&bw.test(j))return this.each(function(){p(this).domManip(a,c,d)});if(p.isFunction(j))return this.each(function(e){var f=p(this);a[0]=j.call(this,e,c?f.html():b),f.domManip(a,c,d)});if(this[0]){e=p.buildFragment(a,this,k),g=e.fragment,f=g.firstChild,g.childNodes.length===1&&(g=f);if(f){c=c&&p.nodeName(f,"tr");for(h=e.cacheable||l-1;i<l;i++)d.call(c&&p.nodeName(this[i],"table")?bC(this[i],"tbody"):this[i],i===h?g:p.clone(g,!0,!0))}g=f=null,k.length&&p.each(k,function(a,b){b.src?p.ajax?p.ajax({url:b.src,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0}):p.error("no ajax"):p.globalEval((b.text||b.textContent||b.innerHTML||"").replace(by,"")),b.parentNode&&b.parentNode.removeChild(b)})}return this}}),p.buildFragment=function(a,c,d){var f,g,h,i=a[0];return c=c||e,c=(c[0]||c).ownerDocument||c[0]||c,typeof c.createDocumentFragment=="undefined"&&(c=e),a.length===1&&typeof i=="string"&&i.length<512&&c===e&&i.charAt(0)==="<"&&!bt.test(i)&&(p.support.checkClone||!bw.test(i))&&(p.support.html5Clone||!bu.test(i))&&(g=!0,f=p.fragments[i],h=f!==b),f||(f=c.createDocumentFragment(),p.clean(a,c,f,d),g&&(p.fragments[i]=h&&f)),{fragment:f,cacheable:g}},p.fragments={},p.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){p.fn[a]=function(c){var d,e=0,f=[],g=p(c),h=g.length,i=this.length===1&&this[0].parentNode;if((i==null||i&&i.nodeType===11&&i.childNodes.length===1)&&h===1)return g[b](this[0]),this;for(;e<h;e++)d=(e>0?this.clone(!0):this).get(),p(g[e])[b](d),f=f.concat(d);return this.pushStack(f,a,g.selector)}}),p.extend({clone:function(a,b,c){var d,e,f,g;p.support.html5Clone||p.isXMLDoc(a)||!bu.test("<"+a.nodeName+">")?g=a.cloneNode(!0):(bB.innerHTML=a.outerHTML,bB.removeChild(g=bB.firstChild));if((!p.support.noCloneEvent||!p.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!p.isXMLDoc(a)){bE(a,g),d=bF(a),e=bF(g);for(f=0;d[f];++f)e[f]&&bE(d[f],e[f])}if(b){bD(a,g);if(c){d=bF(a),e=bF(g);for(f=0;d[f];++f)bD(d[f],e[f])}}return d=e=null,g},clean:function(a,b,c,d){var f,g,h,i,j,k,l,m,n,o,q,r,s=0,t=[];if(!b||typeof b.createDocumentFragment=="undefined")b=e;for(g=b===e&&bA;(h=a[s])!=null;s++){typeof h=="number"&&(h+="");if(!h)continue;if(typeof h=="string")if(!br.test(h))h=b.createTextNode(h);else{g=g||bk(b),l=l||g.appendChild(b.createElement("div")),h=h.replace(bo,"<$1></$2>"),i=(bp.exec(h)||["",""])[1].toLowerCase(),j=bz[i]||bz._default,k=j[0],l.innerHTML=j[1]+h+j[2];while(k--)l=l.lastChild;if(!p.support.tbody){m=bq.test(h),n=i==="table"&&!m?l.firstChild&&l.firstChild.childNodes:j[1]==="<table>"&&!m?l.childNodes:[];for(f=n.length-1;f>=0;--f)p.nodeName(n[f],"tbody")&&!n[f].childNodes.length&&n[f].parentNode.removeChild(n[f])}!p.support.leadingWhitespace&&bn.test(h)&&l.insertBefore(b.createTextNode(bn.exec(h)[0]),l.firstChild),h=l.childNodes,l=g.lastChild}h.nodeType?t.push(h):t=p.merge(t,h)}l&&(g.removeChild(l),h=l=g=null);if(!p.support.appendChecked)for(s=0;(h=t[s])!=null;s++)p.nodeName(h,"input")?bG(h):typeof h.getElementsByTagName!="undefined"&&p.grep(h.getElementsByTagName("input"),bG);if(c){q=function(a){if(!a.type||bx.test(a.type))return d?d.push(a.parentNode?a.parentNode.removeChild(a):a):c.appendChild(a)};for(s=0;(h=t[s])!=null;s++)if(!p.nodeName(h,"script")||!q(h))c.appendChild(h),typeof h.getElementsByTagName!="undefined"&&(r=p.grep(p.merge([],h.getElementsByTagName("script")),q),t.splice.apply(t,[s+1,0].concat(r)),s+=r.length)}return t},cleanData:function(a,b){var c,d,e,f,g=0,h=p.expando,i=p.cache,j=p.support.deleteExpando,k=p.event.special;for(;(e=a[g])!=null;g++)if(b||p.acceptData(e)){d=e[h],c=d&&i[d];if(c){if(c.events)for(f in c.events)k[f]?p.event.remove(e,f):p.removeEvent(e,f,c.handle);i[d]&&(delete i[d],j?delete e[h]:e.removeAttribute?e.removeAttribute(h):e[h]=null,p.deletedIds.push(d))}}}}),function(){var a,b;p.uaMatch=function(a){a=a.toLowerCase();var b=/(chrome)[ \/]([\w.]+)/.exec(a)||/(webkit)[ \/]([\w.]+)/.exec(a)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(a)||/(msie) ([\w.]+)/.exec(a)||a.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},a=p.uaMatch(g.userAgent),b={},a.browser&&(b[a.browser]=!0,b.version=a.version),b.webkit&&(b.safari=!0),p.browser=b,p.sub=function(){function a(b,c){return new a.fn.init(b,c)}p.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.sub=this.sub,a.fn.init=function c(c,d){return d&&d instanceof p&&!(d instanceof a)&&(d=a(d)),p.fn.init.call(this,c,d,b)},a.fn.init.prototype=a.fn;var b=a(e);return a}}();var bH,bI,bJ,bK=/alpha\([^)]*\)/i,bL=/opacity=([^)]*)/,bM=/^(top|right|bottom|left)$/,bN=/^margin/,bO=new RegExp("^("+q+")(.*)$","i"),bP=new RegExp("^("+q+")(?!px)[a-z%]+$","i"),bQ=new RegExp("^([-+])=("+q+")","i"),bR={},bS={position:"absolute",visibility:"hidden",display:"block"},bT={letterSpacing:0,fontWeight:400,lineHeight:1},bU=["Top","Right","Bottom","Left"],bV=["Webkit","O","Moz","ms"],bW=p.fn.toggle;p.fn.extend({css:function(a,c){return p.access(this,function(a,c,d){return d!==b?p.style(a,c,d):p.css(a,c)},a,c,arguments.length>1)},show:function(){return bZ(this,!0)},hide:function(){return bZ(this)},toggle:function(a,b){var c=typeof a=="boolean";return p.isFunction(a)&&p.isFunction(b)?bW.apply(this,arguments):this.each(function(){(c?a:bY(this))?p(this).show():p(this).hide()})}}),p.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=bH(a,"opacity");return c===""?"1":c}}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":p.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!a||a.nodeType===3||a.nodeType===8||!a.style)return;var f,g,h,i=p.camelCase(c),j=a.style;c=p.cssProps[i]||(p.cssProps[i]=bX(j,i)),h=p.cssHooks[c]||p.cssHooks[i];if(d===b)return h&&"get"in h&&(f=h.get(a,!1,e))!==b?f:j[c];g=typeof d,g==="string"&&(f=bQ.exec(d))&&(d=(f[1]+1)*f[2]+parseFloat(p.css(a,c)),g="number");if(d==null||g==="number"&&isNaN(d))return;g==="number"&&!p.cssNumber[i]&&(d+="px");if(!h||!("set"in h)||(d=h.set(a,d,e))!==b)try{j[c]=d}catch(k){}},css:function(a,c,d,e){var f,g,h,i=p.camelCase(c);return c=p.cssProps[i]||(p.cssProps[i]=bX(a.style,i)),h=p.cssHooks[c]||p.cssHooks[i],h&&"get"in h&&(f=h.get(a,!0,e)),f===b&&(f=bH(a,c)),f==="normal"&&c in bT&&(f=bT[c]),d||e!==b?(g=parseFloat(f),d||p.isNumeric(g)?g||0:f):f},swap:function(a,b,c){var d,e,f={};for(e in b)f[e]=a.style[e],a.style[e]=b[e];d=c.call(a);for(e in b)a.style[e]=f[e];return d}}),a.getComputedStyle?bH=function(a,b){var c,d,e,f,g=getComputedStyle(a,null),h=a.style;return g&&(c=g[b],c===""&&!p.contains(a.ownerDocument.documentElement,a)&&(c=p.style(a,b)),bP.test(c)&&bN.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=c,c=g.width,h.width=d,h.minWidth=e,h.maxWidth=f)),c}:e.documentElement.currentStyle&&(bH=function(a,b){var c,d,e=a.currentStyle&&a.currentStyle[b],f=a.style;return e==null&&f&&f[b]&&(e=f[b]),bP.test(e)&&!bM.test(b)&&(c=f.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),f.left=b==="fontSize"?"1em":e,e=f.pixelLeft+"px",f.left=c,d&&(a.runtimeStyle.left=d)),e===""?"auto":e}),p.each(["height","width"],function(a,b){p.cssHooks[b]={get:function(a,c,d){if(c)return a.offsetWidth!==0||bH(a,"display")!=="none"?ca(a,b,d):p.swap(a,bS,function(){return ca(a,b,d)})},set:function(a,c,d){return b$(a,c,d?b_(a,b,d,p.support.boxSizing&&p.css(a,"boxSizing")==="border-box"):0)}}}),p.support.opacity||(p.cssHooks.opacity={get:function(a,b){return bL.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=p.isNumeric(b)?"alpha(opacity="+b*100+")":"",f=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&p.trim(f.replace(bK,""))===""&&c.removeAttribute){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bK.test(f)?f.replace(bK,e):f+" "+e}}),p(function(){p.support.reliableMarginRight||(p.cssHooks.marginRight={get:function(a,b){return p.swap(a,{display:"inline-block"},function(){if(b)return bH(a,"marginRight")})}}),!p.support.pixelPosition&&p.fn.position&&p.each(["top","left"],function(a,b){p.cssHooks[b]={get:function(a,c){if(c){var d=bH(a,b);return bP.test(d)?p(a).position()[b]+"px":d}}}})}),p.expr&&p.expr.filters&&(p.expr.filters.hidden=function(a){return a.offsetWidth===0&&a.offsetHeight===0||!p.support.reliableHiddenOffsets&&(a.style&&a.style.display||bH(a,"display"))==="none"},p.expr.filters.visible=function(a){return!p.expr.filters.hidden(a)}),p.each({margin:"",padding:"",border:"Width"},function(a,b){p.cssHooks[a+b]={expand:function(c){var d,e=typeof c=="string"?c.split(" "):[c],f={};for(d=0;d<4;d++)f[a+bU[d]+b]=e[d]||e[d-2]||e[0];return f}},bN.test(a)||(p.cssHooks[a+b].set=b$)});var cc=/%20/g,cd=/\[\]$/,ce=/\r?\n/g,cf=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,cg=/^(?:select|textarea)/i;p.fn.extend({serialize:function(){return p.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?p.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||cg.test(this.nodeName)||cf.test(this.type))}).map(function(a,b){var c=p(this).val();return c==null?null:p.isArray(c)?p.map(c,function(a,c){return{name:b.name,value:a.replace(ce,"\r\n")}}):{name:b.name,value:c.replace(ce,"\r\n")}}).get()}}),p.param=function(a,c){var d,e=[],f=function(a,b){b=p.isFunction(b)?b():b==null?"":b,e[e.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=p.ajaxSettings&&p.ajaxSettings.traditional);if(p.isArray(a)||a.jquery&&!p.isPlainObject(a))p.each(a,function(){f(this.name,this.value)});else for(d in a)ch(d,a[d],c,f);return e.join("&").replace(cc,"+")};var ci,cj,ck=/#.*$/,cl=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,cm=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,cn=/^(?:GET|HEAD)$/,co=/^\/\//,cp=/\?/,cq=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,cr=/([?&])_=[^&]*/,cs=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,ct=p.fn.load,cu={},cv={},cw=["*/"]+["*"];try{ci=f.href}catch(cx){ci=e.createElement("a"),ci.href="",ci=ci.href}cj=cs.exec(ci.toLowerCase())||[],p.fn.load=function(a,c,d){if(typeof a!="string"&&ct)return ct.apply(this,arguments);if(!this.length)return this;var e,f,g,h=this,i=a.indexOf(" ");return i>=0&&(e=a.slice(i,a.length),a=a.slice(0,i)),p.isFunction(c)?(d=c,c=b):typeof c=="object"&&(f="POST"),p.ajax({url:a,type:f,dataType:"html",data:c,complete:function(a,b){d&&h.each(d,g||[a.responseText,b,a])}}).done(function(a){g=arguments,h.html(e?p("<div>").append(a.replace(cq,"")).find(e):a)}),this},p.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){p.fn[b]=function(a){return this.on(b,a)}}),p.each(["get","post"],function(a,c){p[c]=function(a,d,e,f){return p.isFunction(d)&&(f=f||e,e=d,d=b),p.ajax({type:c,url:a,data:d,success:e,dataType:f})}}),p.extend({getScript:function(a,c){return p.get(a,b,c,"script")},getJSON:function(a,b,c){return p.get(a,b,c,"json")},ajaxSetup:function(a,b){return b?cA(a,p.ajaxSettings):(b=a,a=p.ajaxSettings),cA(a,b),a},ajaxSettings:{url:ci,isLocal:cm.test(cj[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":cw},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":p.parseJSON,"text xml":p.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:cy(cu),ajaxTransport:cy(cv),ajax:function(a,c){function y(a,c,f,i){var k,s,t,u,w,y=c;if(v===2)return;v=2,h&&clearTimeout(h),g=b,e=i||"",x.readyState=a>0?4:0,f&&(u=cB(l,x,f));if(a>=200&&a<300||a===304)l.ifModified&&(w=x.getResponseHeader("Last-Modified"),w&&(p.lastModified[d]=w),w=x.getResponseHeader("Etag"),w&&(p.etag[d]=w)),a===304?(y="notmodified",k=!0):(k=cC(l,u),y=k.state,s=k.data,t=k.error,k=!t);else{t=y;if(!y||a)y="error",a<0&&(a=0)}x.status=a,x.statusText=""+(c||y),k?o.resolveWith(m,[s,y,x]):o.rejectWith(m,[x,y,t]),x.statusCode(r),r=b,j&&n.trigger("ajax"+(k?"Success":"Error"),[x,l,k?s:t]),q.fireWith(m,[x,y]),j&&(n.trigger("ajaxComplete",[x,l]),--p.active||p.event.trigger("ajaxStop"))}typeof a=="object"&&(c=a,a=b),c=c||{};var d,e,f,g,h,i,j,k,l=p.ajaxSetup({},c),m=l.context||l,n=m!==l&&(m.nodeType||m instanceof p)?p(m):p.event,o=p.Deferred(),q=p.Callbacks("once memory"),r=l.statusCode||{},t={},u={},v=0,w="canceled",x={readyState:0,setRequestHeader:function(a,b){if(!v){var c=a.toLowerCase();a=u[c]=u[c]||a,t[a]=b}return this},getAllResponseHeaders:function(){return v===2?e:null},getResponseHeader:function(a){var c;if(v===2){if(!f){f={};while(c=cl.exec(e))f[c[1].toLowerCase()]=c[2]}c=f[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){return v||(l.mimeType=a),this},abort:function(a){return a=a||w,g&&g.abort(a),y(0,a),this}};o.promise(x),x.success=x.done,x.error=x.fail,x.complete=q.add,x.statusCode=function(a){if(a){var b;if(v<2)for(b in a)r[b]=[r[b],a[b]];else b=a[x.status],x.always(b)}return this},l.url=((a||l.url)+"").replace(ck,"").replace(co,cj[1]+"//"),l.dataTypes=p.trim(l.dataType||"*").toLowerCase().split(s),l.crossDomain==null&&(i=cs.exec(l.url.toLowerCase()),l.crossDomain=!(!i||i[1]==cj[1]&&i[2]==cj[2]&&(i[3]||(i[1]==="http:"?80:443))==(cj[3]||(cj[1]==="http:"?80:443)))),l.data&&l.processData&&typeof l.data!="string"&&(l.data=p.param(l.data,l.traditional)),cz(cu,l,c,x);if(v===2)return x;j=l.global,l.type=l.type.toUpperCase(),l.hasContent=!cn.test(l.type),j&&p.active++===0&&p.event.trigger("ajaxStart");if(!l.hasContent){l.data&&(l.url+=(cp.test(l.url)?"&":"?")+l.data,delete l.data),d=l.url;if(l.cache===!1){var z=p.now(),A=l.url.replace(cr,"$1_="+z);l.url=A+(A===l.url?(cp.test(l.url)?"&":"?")+"_="+z:"")}}(l.data&&l.hasContent&&l.contentType!==!1||c.contentType)&&x.setRequestHeader("Content-Type",l.contentType),l.ifModified&&(d=d||l.url,p.lastModified[d]&&x.setRequestHeader("If-Modified-Since",p.lastModified[d]),p.etag[d]&&x.setRequestHeader("If-None-Match",p.etag[d])),x.setRequestHeader("Accept",l.dataTypes[0]&&l.accepts[l.dataTypes[0]]?l.accepts[l.dataTypes[0]]+(l.dataTypes[0]!=="*"?", "+cw+"; q=0.01":""):l.accepts["*"]);for(k in l.headers)x.setRequestHeader(k,l.headers[k]);if(!l.beforeSend||l.beforeSend.call(m,x,l)!==!1&&v!==2){w="abort";for(k in{success:1,error:1,complete:1})x[k](l[k]);g=cz(cv,l,c,x);if(!g)y(-1,"No Transport");else{x.readyState=1,j&&n.trigger("ajaxSend",[x,l]),l.async&&l.timeout>0&&(h=setTimeout(function(){x.abort("timeout")},l.timeout));try{v=1,g.send(t,y)}catch(B){if(v<2)y(-1,B);else throw B}}return x}return x.abort()},active:0,lastModified:{},etag:{}});var cD=[],cE=/\?/,cF=/(=)\?(?=&|$)|\?\?/,cG=p.now();p.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=cD.pop()||p.expando+"_"+cG++;return this[a]=!0,a}}),p.ajaxPrefilter("json jsonp",function(c,d,e){var f,g,h,i=c.data,j=c.url,k=c.jsonp!==!1,l=k&&cF.test(j),m=k&&!l&&typeof i=="string"&&!(c.contentType||"").indexOf("application/x-www-form-urlencoded")&&cF.test(i);if(c.dataTypes[0]==="jsonp"||l||m)return f=c.jsonpCallback=p.isFunction(c.jsonpCallback)?c.jsonpCallback():c.jsonpCallback,g=a[f],l?c.url=j.replace(cF,"$1"+f):m?c.data=i.replace(cF,"$1"+f):k&&(c.url+=(cE.test(j)?"&":"?")+c.jsonp+"="+f),c.converters["script json"]=function(){return h||p.error(f+" was not called"),h[0]},c.dataTypes[0]="json",a[f]=function(){h=arguments},e.always(function(){a[f]=g,c[f]&&(c.jsonpCallback=d.jsonpCallback,cD.push(f)),h&&p.isFunction(g)&&g(h[0]),h=g=b}),"script"}),p.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){return p.globalEval(a),a}}}),p.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),p.ajaxTransport("script",function(a){if(a.crossDomain){var c,d=e.head||e.getElementsByTagName("head")[0]||e.documentElement;return{send:function(f,g){c=e.createElement("script"),c.async="async",a.scriptCharset&&(c.charset=a.scriptCharset),c.src=a.url,c.onload=c.onreadystatechange=function(a,e){if(e||!c.readyState||/loaded|complete/.test(c.readyState))c.onload=c.onreadystatechange=null,d&&c.parentNode&&d.removeChild(c),c=b,e||g(200,"success")},d.insertBefore(c,d.firstChild)},abort:function(){c&&c.onload(0,1)}}}});var cH,cI=a.ActiveXObject?function(){for(var a in cH)cH[a](0,1)}:!1,cJ=0;p.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&cK()||cL()}:cK,function(a){p.extend(p.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(p.ajaxSettings.xhr()),p.support.ajax&&p.ajaxTransport(function(c){if(!c.crossDomain||p.support.cors){var d;return{send:function(e,f){var g,h,i=c.xhr();c.username?i.open(c.type,c.url,c.async,c.username,c.password):i.open(c.type,c.url,c.async);if(c.xhrFields)for(h in c.xhrFields)i[h]=c.xhrFields[h];c.mimeType&&i.overrideMimeType&&i.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(h in e)i.setRequestHeader(h,e[h])}catch(j){}i.send(c.hasContent&&c.data||null),d=function(a,e){var h,j,k,l,m;try{if(d&&(e||i.readyState===4)){d=b,g&&(i.onreadystatechange=p.noop,cI&&delete cH[g]);if(e)i.readyState!==4&&i.abort();else{h=i.status,k=i.getAllResponseHeaders(),l={},m=i.responseXML,m&&m.documentElement&&(l.xml=m);try{l.text=i.responseText}catch(a){}try{j=i.statusText}catch(n){j=""}!h&&c.isLocal&&!c.crossDomain?h=l.text?200:404:h===1223&&(h=204)}}}catch(o){e||f(-1,o)}l&&f(h,j,l,k)},c.async?i.readyState===4?setTimeout(d,0):(g=++cJ,cI&&(cH||(cH={},p(a).unload(cI)),cH[g]=d),i.onreadystatechange=d):d()},abort:function(){d&&d(0,1)}}}});var cM,cN,cO=/^(?:toggle|show|hide)$/,cP=new RegExp("^(?:([-+])=|)("+q+")([a-z%]*)$","i"),cQ=/queueHooks$/,cR=[cX],cS={"*":[function(a,b){var c,d,e,f=this.createTween(a,b),g=cP.exec(b),h=f.cur(),i=+h||0,j=1;if(g){c=+g[2],d=g[3]||(p.cssNumber[a]?"":"px");if(d!=="px"&&i){i=p.css(f.elem,a,!0)||c||1;do e=j=j||".5",i=i/j,p.style(f.elem,a,i+d),j=f.cur()/h;while(j!==1&&j!==e)}f.unit=d,f.start=i,f.end=g[1]?i+(g[1]+1)*c:c}return f}]};p.Animation=p.extend(cV,{tweener:function(a,b){p.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");var c,d=0,e=a.length;for(;d<e;d++)c=a[d],cS[c]=cS[c]||[],cS[c].unshift(b)},prefilter:function(a,b){b?cR.unshift(a):cR.push(a)}}),p.Tween=cY,cY.prototype={constructor:cY,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||"swing",this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(p.cssNumber[c]?"":"px")},cur:function(){var a=cY.propHooks[this.prop];return a&&a.get?a.get(this):cY.propHooks._default.get(this)},run:function(a){var b,c=cY.propHooks[this.prop];return this.pos=b=p.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration),this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):cY.propHooks._default.set(this),this}},cY.prototype.init.prototype=cY.prototype,cY.propHooks={_default:{get:function(a){var b;return a.elem[a.prop]==null||!!a.elem.style&&a.elem.style[a.prop]!=null?(b=p.css(a.elem,a.prop,!1,""),!b||b==="auto"?0:b):a.elem[a.prop]},set:function(a){p.fx.step[a.prop]?p.fx.step[a.prop](a):a.elem.style&&(a.elem.style[p.cssProps[a.prop]]!=null||p.cssHooks[a.prop])?p.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}},cY.propHooks.scrollTop=cY.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},p.each(["toggle","show","hide"],function(a,b){var c=p.fn[b];p.fn[b]=function(d,e,f){return d==null||typeof d=="boolean"||!a&&p.isFunction(d)&&p.isFunction(e)?c.apply(this,arguments):this.animate(cZ(b,!0),d,e,f)}}),p.fn.extend({fadeTo:function(a,b,c,d){return this.filter(bY).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=p.isEmptyObject(a),f=p.speed(b,c,d),g=function(){var b=cV(this,p.extend({},a),f);e&&b.stop(!0)};return e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,c,d){var e=function(a){var b=a.stop;delete a.stop,b(d)};return typeof a!="string"&&(d=c,c=a,a=b),c&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,c=a!=null&&a+"queueHooks",f=p.timers,g=p._data(this);if(c)g[c]&&g[c].stop&&e(g[c]);else for(c in g)g[c]&&g[c].stop&&cQ.test(c)&&e(g[c]);for(c=f.length;c--;)f[c].elem===this&&(a==null||f[c].queue===a)&&(f[c].anim.stop(d),b=!1,f.splice(c,1));(b||!d)&&p.dequeue(this,a)})}}),p.each({slideDown:cZ("show"),slideUp:cZ("hide"),slideToggle:cZ("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){p.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),p.speed=function(a,b,c){var d=a&&typeof a=="object"?p.extend({},a):{complete:c||!c&&b||p.isFunction(a)&&a,duration:a,easing:c&&b||b&&!p.isFunction(b)&&b};d.duration=p.fx.off?0:typeof d.duration=="number"?d.duration:d.duration in p.fx.speeds?p.fx.speeds[d.duration]:p.fx.speeds._default;if(d.queue==null||d.queue===!0)d.queue="fx";return d.old=d.complete,d.complete=function(){p.isFunction(d.old)&&d.old.call(this),d.queue&&p.dequeue(this,d.queue)},d},p.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2}},p.timers=[],p.fx=cY.prototype.init,p.fx.tick=function(){var a,b=p.timers,c=0;for(;c<b.length;c++)a=b[c],!a()&&b[c]===a&&b.splice(c--,1);b.length||p.fx.stop()},p.fx.timer=function(a){a()&&p.timers.push(a)&&!cN&&(cN=setInterval(p.fx.tick,p.fx.interval))},p.fx.interval=13,p.fx.stop=function(){clearInterval(cN),cN=null},p.fx.speeds={slow:600,fast:200,_default:400},p.fx.step={},p.expr&&p.expr.filters&&(p.expr.filters.animated=function(a){return p.grep(p.timers,function(b){return a===b.elem}).length});var c$=/^(?:body|html)$/i;p.fn.offset=function(a){if(arguments.length)return a===b?this:this.each(function(b){p.offset.setOffset(this,a,b)});var c,d,e,f,g,h,i,j,k,l,m=this[0],n=m&&m.ownerDocument;if(!n)return;return(e=n.body)===m?p.offset.bodyOffset(m):(d=n.documentElement,p.contains(d,m)?(c=m.getBoundingClientRect(),f=c_(n),g=d.clientTop||e.clientTop||0,h=d.clientLeft||e.clientLeft||0,i=f.pageYOffset||d.scrollTop,j=f.pageXOffset||d.scrollLeft,k=c.top+i-g,l=c.left+j-h,{top:k,left:l}):{top:0,left:0})},p.offset={bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;return p.support.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(p.css(a,"marginTop"))||0,c+=parseFloat(p.css(a,"marginLeft"))||0),{top:b,left:c}},setOffset:function(a,b,c){var d=p.css(a,"position");d==="static"&&(a.style.position="relative");var e=p(a),f=e.offset(),g=p.css(a,"top"),h=p.css(a,"left"),i=(d==="absolute"||d==="fixed")&&p.inArray("auto",[g,h])>-1,j={},k={},l,m;i?(k=e.position(),l=k.top,m=k.left):(l=parseFloat(g)||0,m=parseFloat(h)||0),p.isFunction(b)&&(b=b.call(a,c,f)),b.top!=null&&(j.top=b.top-f.top+l),b.left!=null&&(j.left=b.left-f.left+m),"using"in b?b.using.call(a,j):e.css(j)}},p.fn.extend({position:function(){if(!this[0])return;var a=this[0],b=this.offsetParent(),c=this.offset(),d=c$.test(b[0].nodeName)?{top:0,left:0}:b.offset();return c.top-=parseFloat(p.css(a,"marginTop"))||0,c.left-=parseFloat(p.css(a,"marginLeft"))||0,d.top+=parseFloat(p.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(p.css(b[0],"borderLeftWidth"))||0,{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||e.body;while(a&&!c$.test(a.nodeName)&&p.css(a,"position")==="static")a=a.offsetParent;return a||e.body})}}),p.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,c){var d=/Y/.test(c);p.fn[a]=function(e){return p.access(this,function(a,e,f){var g=c_(a);if(f===b)return g?c in g?g[c]:g.document.documentElement[e]:a[e];g?g.scrollTo(d?p(g).scrollLeft():f,d?f:p(g).scrollTop()):a[e]=f},a,e,arguments.length,null)}}),p.each({Height:"height",Width:"width"},function(a,c){p.each({padding:"inner"+a,content:c,"":"outer"+a},function(d,e){p.fn[e]=function(e,f){var g=arguments.length&&(d||typeof e!="boolean"),h=d||(e===!0||f===!0?"margin":"border");return p.access(this,function(c,d,e){var f;return p.isWindow(c)?c.document.documentElement["client"+a]:c.nodeType===9?(f=c.documentElement,Math.max(c.body["scroll"+a],f["scroll"+a],c.body["offset"+a],f["offset"+a],f["client"+a])):e===b?p.css(c,d,e,h):p.style(c,d,e,h)},c,g?e:b,g)}})}),a.jQuery=a.$=p,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return p})})(window);
+ static/jquery.layout-latest.js view
@@ -0,0 +1,5487 @@+/**
+ * @preserve jquery.layout 1.3.0 - Release Candidate 30.61
+ * $Date: 2012-08-04 08:00:00 (Sat, 04 Aug 2012) $
+ * $Rev: 303006 $
+ *
+ * Copyright (c) 2012 
+ *   Fabrizio Balliano (http://www.fabrizioballiano.net)
+ *   Kevin Dalman (http://allpro.net)
+ *
+ * Dual licensed under the GPL (http://www.gnu.org/licenses/gpl.html)
+ * and MIT (http://www.opensource.org/licenses/mit-license.php) licenses.
+ *
+ * Changelog: http://layout.jquery-dev.net/changelog.cfm#1.3.0.rc30.61
+ * NOTE: This is a short-term release to patch a couple of bugs.
+ * These bugs are listed as officially fixed in RC30.7, which will be released shortly.
+ *
+ * Docs: http://layout.jquery-dev.net/documentation.html
+ * Tips: http://layout.jquery-dev.net/tips.html
+ * Help: http://groups.google.com/group/jquery-ui-layout
+ */
+
+/* JavaDoc Info: http://code.google.com/closure/compiler/docs/js-for-compiler.html
+ * {!Object}	non-nullable type (never NULL)
+ * {?string}	nullable type (sometimes NULL) - default for {Object}
+ * {number=}	optional parameter
+ * {*}			ALL types
+ */
+
+// NOTE: For best readability, view with a fixed-width font and tabs equal to 4-chars
+
+;(function ($) {
+
+// alias Math methods - used a lot!
+var	min		= Math.min
+,	max		= Math.max
+,	round	= Math.floor
+
+,	isStr	=  function (v) { return $.type(v) === "string"; }
+
+,	runPluginCallbacks = function (Instance, a_fn) {
+		if ($.isArray(a_fn))
+			for (var i=0, c=a_fn.length; i<c; i++) {
+				var fn = a_fn[i];
+				try {
+					if (isStr(fn)) // 'name' of a function
+						fn = eval(fn);
+					if ($.isFunction(fn))
+						fn( Instance );
+				} catch (ex) {}
+			}
+	}
+
+;
+
+
+/*
+ *	GENERIC $.layout METHODS - used by all layouts
+ */
+$.layout = {
+
+	version:	"1.3.rc30.6"
+,	revision:	0.033006 // 1.3.0 final = 1.0300 - major(n+).minor(nn)+patch(nn+)
+
+	// can update code here if $.browser is phased out
+,	browser: {
+		mozilla:	!!$.browser.mozilla
+	,	webkit:		!!$.browser.webkit || !!$.browser.safari // webkit = jQ 1.4
+	,	msie:		!!$.browser.msie
+	,	isIE6:		$.browser.msie && $.browser.version == 6
+	,	boxModel:	$.support.boxModel !== false || !$.browser.msie // ONLY IE reverts to old box-model - update for older jQ onReady
+	,	version:	$.browser.version // not used in Layout core, but may be used by plugins
+	}
+
+	// *PREDEFINED* EFFECTS & DEFAULTS 
+	// MUST list effect here - OR MUST set an fxSettings option (can be an empty hash: {})
+,	effects: {
+
+	//	Pane Open/Close Animations
+		slide: {
+			all:	{ duration:  "fast"	} // eg: duration: 1000, easing: "easeOutBounce"
+		,	north:	{ direction: "up"	}
+		,	south:	{ direction: "down"	}
+		,	east:	{ direction: "right"}
+		,	west:	{ direction: "left"	}
+		}
+	,	drop: {
+			all:	{ duration:  "slow"	}
+		,	north:	{ direction: "up"	}
+		,	south:	{ direction: "down"	}
+		,	east:	{ direction: "right"}
+		,	west:	{ direction: "left"	}
+		}
+	,	scale: {
+			all:	{ duration:	"fast"	}
+		}
+	//	these are not recommended, but can be used
+	,	blind:		{}
+	,	clip:		{}
+	,	explode:	{}
+	,	fade:		{}
+	,	fold:		{}
+	,	puff:		{}
+
+	//	Pane Resize Animations
+	,	size: {
+			all:	{ easing:	"swing"	}
+		}
+	}
+
+	// INTERNAL CONFIG DATA - DO NOT CHANGE THIS!
+,	config: {
+		optionRootKeys:	"effects,panes,north,south,west,east,center".split(",")
+	,	allPanes:		"north,south,west,east,center".split(",")
+	,	borderPanes:	"north,south,west,east".split(",")
+	,	oppositeEdge: {
+			north:	"south"
+		,	south:	"north"
+		,	east: 	"west"
+		,	west: 	"east"
+		}
+	//	offscreen data
+	,	offscreenCSS:	{ left: "-99999px", right: "auto" } // used by hide/close if useOffscreenClose=true
+	,	offscreenReset:	"offscreenReset" // key used for data
+	//	CSS used in multiple places
+	,	hidden:		{ visibility: "hidden" }
+	,	visible:	{ visibility: "visible" }
+	//	layout element settings
+	,	resizers: {
+			cssReq: {
+				position: 	"absolute"
+			,	padding: 	0
+			,	margin: 	0
+			,	fontSize:	"1px"
+			,	textAlign:	"left"	// to counter-act "center" alignment!
+			,	overflow: 	"hidden" // prevent toggler-button from overflowing
+			//	SEE $.layout.defaults.zIndexes.resizer_normal
+			}
+		,	cssDemo: { // DEMO CSS - applied if: options.PANE.applyDemoStyles=true
+				background: "#DDD"
+			,	border:		"none"
+			}
+		}
+	,	togglers: {
+			cssReq: {
+				position: 	"absolute"
+			,	display: 	"block"
+			,	padding: 	0
+			,	margin: 	0
+			,	overflow:	"hidden"
+			,	textAlign:	"center"
+			,	fontSize:	"1px"
+			,	cursor: 	"pointer"
+			,	zIndex: 	1
+			}
+		,	cssDemo: { // DEMO CSS - applied if: options.PANE.applyDemoStyles=true
+				background: "#AAA"
+			}
+		}
+	,	content: {
+			cssReq: {
+				position:	"relative" /* contain floated or positioned elements */
+			}
+		,	cssDemo: { // DEMO CSS - applied if: options.PANE.applyDemoStyles=true
+				overflow:	"auto"
+			,	padding:	"10px"
+			}
+		,	cssDemoPane: { // DEMO CSS - REMOVE scrolling from 'pane' when it has a content-div
+				overflow:	"hidden"
+			,	padding:	0
+			}
+		}
+	,	panes: { // defaults for ALL panes - overridden by 'per-pane settings' below
+			cssReq: {
+				position: 	"absolute"
+			,	margin:		0
+			//	$.layout.defaults.zIndexes.pane_normal
+			}
+		,	cssDemo: { // DEMO CSS - applied if: options.PANE.applyDemoStyles=true
+				padding:	"10px"
+			,	background:	"#FFF"
+			,	border:		"1px solid #BBB"
+			,	overflow:	"auto"
+			}
+		}
+	,	north: {
+			side:			"Top"
+		,	sizeType:		"Height"
+		,	dir:			"horz"
+		,	cssReq: {
+				top: 		0
+			,	bottom: 	"auto"
+			,	left: 		0
+			,	right: 		0
+			,	width: 		"auto"
+			//	height: 	DYNAMIC
+			}
+		}
+	,	south: {
+			side:			"Bottom"
+		,	sizeType:		"Height"
+		,	dir:			"horz"
+		,	cssReq: {
+				top: 		"auto"
+			,	bottom: 	0
+			,	left: 		0
+			,	right: 		0
+			,	width: 		"auto"
+			//	height: 	DYNAMIC
+			}
+		}
+	,	east: {
+			side:			"Right"
+		,	sizeType:		"Width"
+		,	dir:			"vert"
+		,	cssReq: {
+				left: 		"auto"
+			,	right: 		0
+			,	top: 		"auto" // DYNAMIC
+			,	bottom: 	"auto" // DYNAMIC
+			,	height: 	"auto"
+			//	width: 		DYNAMIC
+			}
+		}
+	,	west: {
+			side:			"Left"
+		,	sizeType:		"Width"
+		,	dir:			"vert"
+		,	cssReq: {
+				left: 		0
+			,	right: 		"auto"
+			,	top: 		"auto" // DYNAMIC
+			,	bottom: 	"auto" // DYNAMIC
+			,	height: 	"auto"
+			//	width: 		DYNAMIC
+			}
+		}
+	,	center: {
+			dir:			"center"
+		,	cssReq: {
+				left: 		"auto" // DYNAMIC
+			,	right: 		"auto" // DYNAMIC
+			,	top: 		"auto" // DYNAMIC
+			,	bottom: 	"auto" // DYNAMIC
+			,	height: 	"auto"
+			,	width: 		"auto"
+			}
+		}
+	}
+
+	// CALLBACK FUNCTION NAMESPACE - used to store reusable callback functions
+,	callbacks: {}
+
+,	getParentPaneElem: function (el) {
+		// must pass either a container or pane element
+		var $el = $(el)
+		,	layout = $el.data("layout") || $el.data("parentLayout");
+		if (layout) {
+			var $cont = layout.container;
+			// see if this container is directly-nested inside an outer-pane
+			if ($cont.data("layoutPane")) return $cont;
+			var $pane = $cont.closest("."+ $.layout.defaults.panes.paneClass);
+			// if a pane was found, return it
+			if ($pane.data("layoutPane")) return $pane;
+		}
+		return null;
+	}
+
+,	getParentPaneInstance: function (el) {
+		// must pass either a container or pane element
+		var $pane = $.layout.getParentPaneElem(el);
+		return $pane ? $pane.data("layoutPane") : null;
+	}
+
+,	getParentLayoutInstance: function (el) {
+		// must pass either a container or pane element
+		var $pane = $.layout.getParentPaneElem(el);
+		return $pane ? $pane.data("parentLayout") : null;
+	}
+
+,	getEventObject: function (evt) {
+		return typeof evt === "object" && evt.stopPropagation ? evt : null;
+	}
+,	parsePaneName: function (evt_or_pane) {
+		// getEventObject() automatically calls .stopPropagation(), WHICH MUST BE DONE!
+		var evt = $.layout.getEventObject( evt_or_pane );
+		if (evt) {
+			// ALWAYS stop propagation of events triggered in Layout!
+			evt.stopPropagation();
+			return $(this).data("layoutEdge");
+		}
+		else
+			return evt_or_pane;
+	}
+
+
+	// LAYOUT-PLUGIN REGISTRATION
+	// more plugins can added beyond this default list
+,	plugins: {
+		draggable:		!!$.fn.draggable // resizing
+	,	effects: {
+			core:		!!$.effects		// animimations (specific effects tested by initOptions)
+		,	slide:		$.effects && $.effects.slide // default effect
+		}
+	}
+
+//	arrays of plugin or other methods to be triggered for events in *each layout* - will be passed 'Instance'
+,	onCreate:	[]	// runs when layout is just starting to be created - right after options are set
+,	onLoad:		[]	// runs after layout container and global events init, but before initPanes is called
+,	onReady:	[]	// runs after initialization *completes* - ie, after initPanes completes successfully
+,	onDestroy:	[]	// runs after layout is destroyed
+,	onUnload:	[]	// runs after layout is destroyed OR when page unloads
+,	afterOpen:	[]	// runs after setAsOpen() completes
+,	afterClose:	[]	// runs after setAsClosed() completes
+
+	/*
+	*	GENERIC UTILITY METHODS
+	*/
+
+	// calculate and return the scrollbar width, as an integer
+,	scrollbarWidth:		function () { return window.scrollbarWidth  || $.layout.getScrollbarSize('width'); }
+,	scrollbarHeight:	function () { return window.scrollbarHeight || $.layout.getScrollbarSize('height'); }
+,	getScrollbarSize:	function (dim) {
+		var $c	= $('<div style="position: absolute; top: -10000px; left: -10000px; width: 100px; height: 100px; overflow: scroll;"></div>').appendTo("body");
+		var d	= { width: $c.width() - $c[0].clientWidth, height: $c.height() - $c[0].clientHeight };
+		$c.remove();
+		window.scrollbarWidth	= d.width;
+		window.scrollbarHeight	= d.height;
+		return dim.match(/^(width|height)$/) ? d[dim] : d;
+	}
+
+
+	/**
+	* Returns hash container 'display' and 'visibility'
+	*
+	* @see	$.swap() - swaps CSS, runs callback, resets CSS
+	*/
+,	showInvisibly: function ($E, force) {
+		if (!$E) return {};
+		if (!$E.jquery) $E = $($E);
+		var CSS = {
+			display:	$E.css('display')
+		,	visibility:	$E.css('visibility')
+		};
+		if (force || CSS.display === "none") { // only if not *already hidden*
+			$E.css({ display: "block", visibility: "hidden" }); // show element 'invisibly' so can be measured
+			return CSS;
+		}
+		else return {};
+	}
+
+	/**
+	* Returns data for setting size of an element (container or a pane).
+	*
+	* @see  _create(), onWindowResize() for container, plus others for pane
+	* @return JSON  Returns a hash of all dimensions: top, bottom, left, right, outerWidth, innerHeight, etc
+	*/
+,	getElementDimensions: function ($E) {
+		var
+			d	= {}			// dimensions hash
+		,	x	= d.css = {}	// CSS hash
+		,	i	= {}			// TEMP insets
+		,	b, p				// TEMP border, padding
+		,	N	= $.layout.cssNum
+		,	off = $E.offset()
+		;
+		d.offsetLeft = off.left;
+		d.offsetTop  = off.top;
+
+		$.each("Left,Right,Top,Bottom".split(","), function (idx, e) { // e = edge
+			b = x["border" + e] = $.layout.borderWidth($E, e);
+			p = x["padding"+ e] = $.layout.cssNum($E, "padding"+e);
+			i[e] = b + p; // total offset of content from outer side
+			d["inset"+ e] = p;	// eg: insetLeft = paddingLeft
+		});
+
+		d.offsetWidth	= $E.innerWidth();	// offsetWidth is used in calc when doing manual resize
+		d.offsetHeight	= $E.innerHeight();	// ditto
+		d.outerWidth	= $E.outerWidth();
+		d.outerHeight	= $E.outerHeight();
+		d.innerWidth	= max(0, d.outerWidth  - i.Left - i.Right);
+		d.innerHeight	= max(0, d.outerHeight - i.Top  - i.Bottom);
+
+		x.width		= $E.width();
+		x.height	= $E.height();
+		x.top		= N($E,"top",true);
+		x.bottom	= N($E,"bottom",true);
+		x.left		= N($E,"left",true);
+		x.right		= N($E,"right",true);
+
+		//d.visible	= $E.is(":visible");// && x.width > 0 && x.height > 0;
+
+		return d;
+	}
+
+,	getElementCSS: function ($E, list) {
+		var
+			CSS	= {}
+		,	style	= $E[0].style
+		,	props	= list.split(",")
+		,	sides	= "Top,Bottom,Left,Right".split(",")
+		,	attrs	= "Color,Style,Width".split(",")
+		,	p, s, a, i, j, k
+		;
+		for (i=0; i < props.length; i++) {
+			p = props[i];
+			if (p.match(/(border|padding|margin)$/))
+				for (j=0; j < 4; j++) {
+					s = sides[j];
+					if (p === "border")
+						for (k=0; k < 3; k++) {
+							a = attrs[k];
+							CSS[p+s+a] = style[p+s+a];
+						}
+					else
+						CSS[p+s] = style[p+s];
+				}
+			else
+				CSS[p] = style[p];
+		};
+		return CSS
+	}
+
+	/**
+	* Return the innerWidth for the current browser/doctype
+	*
+	* @see  initPanes(), sizeMidPanes(), initHandles(), sizeHandles()
+	* @param  {Array.<Object>}	$E  Must pass a jQuery object - first element is processed
+	* @param  {number=}			outerWidth (optional) Can pass a width, allowing calculations BEFORE element is resized
+	* @return {number}			Returns the innerWidth of the elem by subtracting padding and borders
+	*/
+,	cssWidth: function ($E, outerWidth) {
+		// a 'calculated' outerHeight can be passed so borders and/or padding are removed if needed
+		if (outerWidth <= 0) return 0;
+
+		if (!$.layout.browser.boxModel) return outerWidth;
+
+		// strip border and padding from outerWidth to get CSS Width
+		var b = $.layout.borderWidth
+		,	n = $.layout.cssNum
+		,	W = outerWidth
+				- b($E, "Left")
+				- b($E, "Right")
+				- n($E, "paddingLeft")		
+				- n($E, "paddingRight");
+
+		return max(0,W);
+	}
+
+	/**
+	* Return the innerHeight for the current browser/doctype
+	*
+	* @see  initPanes(), sizeMidPanes(), initHandles(), sizeHandles()
+	* @param  {Array.<Object>}	$E  Must pass a jQuery object - first element is processed
+	* @param  {number=}			outerHeight  (optional) Can pass a width, allowing calculations BEFORE element is resized
+	* @return {number}			Returns the innerHeight of the elem by subtracting padding and borders
+	*/
+,	cssHeight: function ($E, outerHeight) {
+		// a 'calculated' outerHeight can be passed so borders and/or padding are removed if needed
+		if (outerHeight <= 0) return 0;
+
+		if (!$.layout.browser.boxModel) return outerHeight;
+
+		// strip border and padding from outerHeight to get CSS Height
+		var b = $.layout.borderWidth
+		,	n = $.layout.cssNum
+		,	H = outerHeight
+			- b($E, "Top")
+			- b($E, "Bottom")
+			- n($E, "paddingTop")
+			- n($E, "paddingBottom");
+
+		return max(0,H);
+	}
+
+	/**
+	* Returns the 'current CSS numeric value' for a CSS property - 0 if property does not exist
+	*
+	* @see  Called by many methods
+	* @param {Array.<Object>}	$E					Must pass a jQuery object - first element is processed
+	* @param {string}			prop				The name of the CSS property, eg: top, width, etc.
+	* @param {boolean=}			[allowAuto=false]	true = return 'auto' if that is value; false = return 0
+	* @return {(string|number)}						Usually used to get an integer value for position (top, left) or size (height, width)
+	*/
+,	cssNum: function ($E, prop, allowAuto) {
+		if (!$E.jquery) $E = $($E);
+		var CSS = $.layout.showInvisibly($E)
+		,	p	= $.css($E[0], prop, true)
+		,	v	= allowAuto && p=="auto" ? p : (parseInt(p, 10) || 0);
+		$E.css( CSS ); // RESET
+		return v;
+	}
+
+,	borderWidth: function (el, side) {
+		if (el.jquery) el = el[0];
+		var b = "border"+ side.substr(0,1).toUpperCase() + side.substr(1); // left => Left
+		return $.css(el, b+"Style", true) === "none" ? 0 : (parseInt($.css(el, b+"Width", true), 10) || 0);
+	}
+
+	/**
+	* Mouse-tracking utility - FUTURE REFERENCE
+	*
+	* init: if (!window.mouse) {
+	*			window.mouse = { x: 0, y: 0 };
+	*			$(document).mousemove( $.layout.trackMouse );
+	*		}
+	*
+	* @param {Object}		evt
+	*
+,	trackMouse: function (evt) {
+		window.mouse = { x: evt.clientX, y: evt.clientY };
+	}
+	*/
+
+	/**
+	* SUBROUTINE for preventPrematureSlideClose option
+	*
+	* @param {Object}		evt
+	* @param {Object=}		el
+	*/
+,	isMouseOverElem: function (evt, el) {
+		var
+			$E	= $(el || this)
+		,	d	= $E.offset()
+		,	T	= d.top
+		,	L	= d.left
+		,	R	= L + $E.outerWidth()
+		,	B	= T + $E.outerHeight()
+		,	x	= evt.pageX	// evt.clientX ?
+		,	y	= evt.pageY	// evt.clientY ?
+		;
+		// if X & Y are < 0, probably means is over an open SELECT
+		return ($.layout.browser.msie && x < 0 && y < 0) || ((x >= L && x <= R) && (y >= T && y <= B));
+	}
+
+	/**
+	* Message/Logging Utility
+	*
+	* @example $.layout.msg("My message");				// log text
+	* @example $.layout.msg("My message", true);		// alert text
+	* @example $.layout.msg({ foo: "bar" }, "Title");	// log hash-data, with custom title
+	* @example $.layout.msg({ foo: "bar" }, true, "Title", { sort: false }); -OR-
+	* @example $.layout.msg({ foo: "bar" }, "Title", { sort: false, display: true }); // alert hash-data
+	*
+	* @param {(Object|string)}			info			String message OR Hash/Array
+	* @param {(Boolean|string|Object)=}	[popup=false]	True means alert-box - can be skipped
+	* @param {(Object|string)=}			[debugTitle=""]	Title for Hash data - can be skipped
+	* @param {Object=}					[debugOpts]		Extra options for debug output
+	*/
+,	msg: function (info, popup, debugTitle, debugOpts) {
+		if ($.isPlainObject(info) && window.debugData) {
+			if (typeof popup === "string") {
+				debugOpts	= debugTitle;
+				debugTitle	= popup;
+			}
+			else if (typeof debugTitle === "object") {
+				debugOpts	= debugTitle;
+				debugTitle	= null;
+			}
+			var t = debugTitle || "log( <object> )"
+			,	o = $.extend({ sort: false, returnHTML: false, display: false }, debugOpts);
+			if (popup === true || o.display)
+				debugData( info, t, o );
+			else if (window.console)
+				console.log(debugData( info, t, o ));
+		}
+		else if (popup)
+			alert(info);
+		else if (window.console)
+			console.log(info);
+		else {
+			var id	= "#layoutLogger"
+			,	$l = $(id);
+			if (!$l.length)
+				$l = createLog();
+			$l.children("ul").append('<li style="padding: 4px 10px; margin: 0; border-top: 1px solid #CCC;">'+ info.replace(/\</g,"&lt;").replace(/\>/g,"&gt;") +'</li>');
+		}
+
+		function createLog () {
+			var pos = $.support.fixedPosition ? 'fixed' : 'absolute'
+			,	$e = $('<div id="layoutLogger" style="position: '+ pos +'; top: 5px; z-index: 999999; max-width: 25%; overflow: hidden; border: 1px solid #000; border-radius: 5px; background: #FBFBFB; box-shadow: 0 2px 10px rgba(0,0,0,0.3);">'
+				+	'<div style="font-size: 13px; font-weight: bold; padding: 5px 10px; background: #F6F6F6; border-radius: 5px 5px 0 0; cursor: move;">'
+				+	'<span style="float: right; padding-left: 7px; cursor: pointer;" title="Remove Console" onclick="$(this).closest(\'#layoutLogger\').remove()">X</span>Layout console.log</div>'
+				+	'<ul style="font-size: 13px; font-weight: none; list-style: none; margin: 0; padding: 0 0 2px;"></ul>'
+				+ '</div>'
+				).appendTo("body");
+			$e.css('left', $(window).width() - $e.outerWidth() - 5)
+			if ($.ui.draggable) $e.draggable({ handle: ':first-child' });
+			return $e;
+		};
+	}
+
+};
+
+// DEFAULT OPTIONS
+$.layout.defaults = {
+/*
+ *	LAYOUT & LAYOUT-CONTAINER OPTIONS
+ *	- none of these options are applicable to individual panes
+ */
+	name:						""			// Not required, but useful for buttons and used for the state-cookie
+,	containerSelector:			""			// ONLY used when specifying a childOptions - to find container-element that is NOT directly-nested
+,	containerClass:				"ui-layout-container" // layout-container element
+,	scrollToBookmarkOnLoad:		true		// after creating a layout, scroll to bookmark in URL (.../page.htm#myBookmark)
+,	resizeWithWindow:			true		// bind thisLayout.resizeAll() to the window.resize event
+,	resizeWithWindowDelay:		200			// delay calling resizeAll because makes window resizing very jerky
+,	resizeWithWindowMaxDelay:	0			// 0 = none - force resize every XX ms while window is being resized
+,	onresizeall_start:			null		// CALLBACK when resizeAll() STARTS	- NOT pane-specific
+,	onresizeall_end:			null		// CALLBACK when resizeAll() ENDS	- NOT pane-specific
+,	onload_start:				null		// CALLBACK when Layout inits - after options initialized, but before elements
+,	onload_end:					null		// CALLBACK when Layout inits - after EVERYTHING has been initialized
+,	onunload_start:				null		// CALLBACK when Layout is destroyed OR onWindowUnload
+,	onunload_end:				null		// CALLBACK when Layout is destroyed OR onWindowUnload
+,	initPanes:					true		// false = DO NOT initialize the panes onLoad - will init later
+,	showErrorMessages:			true		// enables fatal error messages to warn developers of common errors
+,	showDebugMessages:			false		// display console-and-alert debug msgs - IF this Layout version _has_ debugging code!
+//	Changing this zIndex value will cause other zIndex values to automatically change
+,	zIndex:						null		// the PANE zIndex - resizers and masks will be +1
+//	DO NOT CHANGE the zIndex values below unless you clearly understand their relationships
+,	zIndexes: {								// set _default_ z-index values here...
+		pane_normal:			0			// normal z-index for panes
+	,	content_mask:			1			// applied to overlays used to mask content INSIDE panes during resizing
+	,	resizer_normal:			2			// normal z-index for resizer-bars
+	,	pane_sliding:			100			// applied to *BOTH* the pane and its resizer when a pane is 'slid open'
+	,	pane_animate:			1000		// applied to the pane when being animated - not applied to the resizer
+	,	resizer_drag:			10000		// applied to the CLONED resizer-bar when being 'dragged'
+	}
+,	errors: {
+		pane:					"pane"		// description of "layout pane element" - used only in error messages
+	,	selector:				"selector"	// description of "jQuery-selector" - used only in error messages
+	,	addButtonError:			"Error Adding Button \n\nInvalid "
+	,	containerMissing:		"UI Layout Initialization Error\n\nThe specified layout-container does not exist."
+	,	centerPaneMissing:		"UI Layout Initialization Error\n\nThe center-pane element does not exist.\n\nThe center-pane is a required element."
+	,	noContainerHeight:		"UI Layout Initialization Warning\n\nThe layout-container \"CONTAINER\" has no height.\n\nTherefore the layout is 0-height and hence 'invisible'!"
+	,	callbackError:			"UI Layout Callback Error\n\nThe EVENT callback is not a valid function."
+	}
+/*
+ *	PANE DEFAULT SETTINGS
+ *	- settings under the 'panes' key become the default settings for *all panes*
+ *	- ALL pane-options can also be set specifically for each panes, which will override these 'default values'
+ */
+,	panes: { // default options for 'all panes' - will be overridden by 'per-pane settings'
+		applyDemoStyles: 		false		// NOTE: renamed from applyDefaultStyles for clarity
+	,	closable:				true		// pane can open & close
+	,	resizable:				true		// when open, pane can be resized 
+	,	slidable:				true		// when closed, pane can 'slide open' over other panes - closes on mouse-out
+	,	initClosed:				false		// true = init pane as 'closed'
+	,	initHidden: 			false 		// true = init pane as 'hidden' - no resizer-bar/spacing
+	//	SELECTORS
+	//,	paneSelector:			""			// MUST be pane-specific - jQuery selector for pane
+	,	contentSelector:		".ui-layout-content" // INNER div/element to auto-size so only it scrolls, not the entire pane!
+	,	contentIgnoreSelector:	".ui-layout-ignore"	// element(s) to 'ignore' when measuring 'content'
+	,	findNestedContent:		false		// true = $P.find(contentSelector), false = $P.children(contentSelector)
+	//	GENERIC ROOT-CLASSES - for auto-generated classNames
+	,	paneClass:				"ui-layout-pane"	// Layout Pane
+	,	resizerClass:			"ui-layout-resizer"	// Resizer Bar
+	,	togglerClass:			"ui-layout-toggler"	// Toggler Button
+	,	buttonClass:			"ui-layout-button"	// CUSTOM Buttons	- eg: '[ui-layout-button]-toggle/-open/-close/-pin'
+	//	ELEMENT SIZE & SPACING
+	//,	size:					100			// MUST be pane-specific -initial size of pane
+	,	minSize:				0			// when manually resizing a pane
+	,	maxSize:				0			// ditto, 0 = no limit
+	,	spacing_open:			6			// space between pane and adjacent panes - when pane is 'open'
+	,	spacing_closed:			6			// ditto - when pane is 'closed'
+	,	togglerLength_open:		50			// Length = WIDTH of toggler button on north/south sides - HEIGHT on east/west sides
+	,	togglerLength_closed: 	50			// 100% OR -1 means 'full height/width of resizer bar' - 0 means 'hidden'
+	,	togglerAlign_open:		"center"	// top/left, bottom/right, center, OR...
+	,	togglerAlign_closed:	"center"	// 1 => nn = offset from top/left, -1 => -nn == offset from bottom/right
+	,	togglerContent_open:	""			// text or HTML to put INSIDE the toggler
+	,	togglerContent_closed:	""			// ditto
+	//	RESIZING OPTIONS
+	,	resizerDblClickToggle:	true		// 
+	,	autoResize:				true		// IF size is 'auto' or a percentage, then recalc 'pixel size' whenever the layout resizes
+	,	autoReopen:				true		// IF a pane was auto-closed due to noRoom, reopen it when there is room? False = leave it closed
+	,	resizerDragOpacity:		1			// option for ui.draggable
+	//,	resizerCursor:			""			// MUST be pane-specific - cursor when over resizer-bar
+	,	maskContents:			false		// true = add DIV-mask over-or-inside this pane so can 'drag' over IFRAMES
+	,	maskObjects:			false		// true = add IFRAME-mask over-or-inside this pane to cover objects/applets - content-mask will overlay this mask
+	,	maskZindex:				null		// will override zIndexes.content_mask if specified - not applicable to iframe-panes
+	,	resizingGrid:			false		// grid size that the resizers will snap-to during resizing, eg: [20,20]
+	,	livePaneResizing:		false		// true = LIVE Resizing as resizer is dragged
+	,	liveContentResizing:	false		// true = re-measure header/footer heights as resizer is dragged
+	,	liveResizingTolerance:	1			// how many px change before pane resizes, to control performance
+	//	SLIDING OPTIONS
+	,	sliderCursor:			"pointer"	// cursor when resizer-bar will trigger 'sliding'
+	,	slideTrigger_open:		"click"		// click, dblclick, mouseenter
+	,	slideTrigger_close:		"mouseleave"// click, mouseleave
+	,	slideDelay_open:		300			// applies only for mouseenter event - 0 = instant open
+	,	slideDelay_close:		300			// applies only for mouseleave event (300ms is the minimum!)
+	,	hideTogglerOnSlide:		false		// when pane is slid-open, should the toggler show?
+	,	preventQuickSlideClose:	$.layout.browser.webkit // Chrome triggers slideClosed as it is opening
+	,	preventPrematureSlideClose: false	// handle incorrect mouseleave trigger, like when over a SELECT-list in IE
+	//	PANE-SPECIFIC TIPS & MESSAGES
+	,	tips: {
+			Open:				"Open"		// eg: "Open Pane"
+		,	Close:				"Close"
+		,	Resize:				"Resize"
+		,	Slide:				"Slide Open"
+		,	Pin:				"Pin"
+		,	Unpin:				"Un-Pin"
+		,	noRoomToOpen:		"Not enough room to show this panel."	// alert if user tries to open a pane that cannot
+		,	minSizeWarning:		"Panel has reached its minimum size"	// displays in browser statusbar
+		,	maxSizeWarning:		"Panel has reached its maximum size"	// ditto
+		}
+	//	HOT-KEYS & MISC
+	,	showOverflowOnHover:	false		// will bind allowOverflow() utility to pane.onMouseOver
+	,	enableCursorHotkey:		true		// enabled 'cursor' hotkeys
+	//,	customHotkey:			""			// MUST be pane-specific - EITHER a charCode OR a character
+	,	customHotkeyModifier:	"SHIFT"		// either 'SHIFT', 'CTRL' or 'CTRL+SHIFT' - NOT 'ALT'
+	//	PANE ANIMATION
+	//	NOTE: fxSss_open, fxSss_close & fxSss_size options (eg: fxName_open) are auto-generated if not passed
+	,	fxName:					"slide" 	// ('none' or blank), slide, drop, scale -- only relevant to 'open' & 'close', NOT 'size'
+	,	fxSpeed:				null		// slow, normal, fast, 200, nnn - if passed, will OVERRIDE fxSettings.duration
+	,	fxSettings:				{}			// can be passed, eg: { easing: "easeOutBounce", duration: 1500 }
+	,	fxOpacityFix:			true		// tries to fix opacity in IE to restore anti-aliasing after animation
+	,	animatePaneSizing:		false		// true = animate resizing after dragging resizer-bar OR sizePane() is called
+	/*  NOTE: Action-specific FX options are auto-generated from the options above if not specifically set:
+		fxName_open:			"slide"		// 'Open' pane animation
+		fnName_close:			"slide"		// 'Close' pane animation
+		fxName_size:			"slide"		// 'Size' pane animation - when animatePaneSizing = true
+		fxSpeed_open:			null
+		fxSpeed_close:			null
+		fxSpeed_size:			null
+		fxSettings_open:		{}
+		fxSettings_close:		{}
+		fxSettings_size:		{}
+	*/
+	//	CHILD/NESTED LAYOUTS
+	,	childOptions:			null		// Layout-options for nested/child layout - even {} is valid as options
+	,	initChildLayout:		true		// true = child layout will be created as soon as _this_ layout completes initialization
+	,	destroyChildLayout:		true		// true = destroy child-layout if this pane is destroyed
+	,	resizeChildLayout:		true		// true = trigger child-layout.resizeAll() when this pane is resized
+	//	EVENT TRIGGERING
+	,	triggerEventsOnLoad:	false		// true = trigger onopen OR onclose callbacks when layout initializes
+	,	triggerEventsDuringLiveResize: true	// true = trigger onresize callback REPEATEDLY if livePaneResizing==true
+	//	PANE CALLBACKS
+	,	onshow_start:			null		// CALLBACK when pane STARTS to Show	- BEFORE onopen/onhide_start
+	,	onshow_end:				null		// CALLBACK when pane ENDS being Shown	- AFTER  onopen/onhide_end
+	,	onhide_start:			null		// CALLBACK when pane STARTS to Close	- BEFORE onclose_start
+	,	onhide_end:				null		// CALLBACK when pane ENDS being Closed	- AFTER  onclose_end
+	,	onopen_start:			null		// CALLBACK when pane STARTS to Open
+	,	onopen_end:				null		// CALLBACK when pane ENDS being Opened
+	,	onclose_start:			null		// CALLBACK when pane STARTS to Close
+	,	onclose_end:			null		// CALLBACK when pane ENDS being Closed
+	,	onresize_start:			null		// CALLBACK when pane STARTS being Resized ***FOR ANY REASON***
+	,	onresize_end:			null		// CALLBACK when pane ENDS being Resized ***FOR ANY REASON***
+	,	onsizecontent_start:	null		// CALLBACK when sizing of content-element STARTS
+	,	onsizecontent_end:		null		// CALLBACK when sizing of content-element ENDS
+	,	onswap_start:			null		// CALLBACK when pane STARTS to Swap
+	,	onswap_end:				null		// CALLBACK when pane ENDS being Swapped
+	,	ondrag_start:			null		// CALLBACK when pane STARTS being ***MANUALLY*** Resized
+	,	ondrag_end:				null		// CALLBACK when pane ENDS being ***MANUALLY*** Resized
+	}
+/*
+ *	PANE-SPECIFIC SETTINGS
+ *	- options listed below MUST be specified per-pane - they CANNOT be set under 'panes'
+ *	- all options under the 'panes' key can also be set specifically for any pane
+ *	- most options under the 'panes' key apply only to 'border-panes' - NOT the the center-pane
+ */
+,	north: {
+		paneSelector:			".ui-layout-north"
+	,	size:					"auto"		// eg: "auto", "30%", .30, 200
+	,	resizerCursor:			"n-resize"	// custom = url(myCursor.cur)
+	,	customHotkey:			""			// EITHER a charCode (43) OR a character ("o")
+	}
+,	south: {
+		paneSelector:			".ui-layout-south"
+	,	size:					"auto"
+	,	resizerCursor:			"s-resize"
+	,	customHotkey:			""
+	}
+,	east: {
+		paneSelector:			".ui-layout-east"
+	,	size:					200
+	,	resizerCursor:			"e-resize"
+	,	customHotkey:			""
+	}
+,	west: {
+		paneSelector:			".ui-layout-west"
+	,	size:					200
+	,	resizerCursor:			"w-resize"
+	,	customHotkey:			""
+	}
+,	center: {
+		paneSelector:			".ui-layout-center"
+	,	minWidth:				0
+	,	minHeight:				0
+	}
+};
+
+$.layout.optionsMap = {
+	// layout/global options - NOT pane-options
+	layout: ("stateManagement,effects,zIndexes,errors,"
+	+	"name,zIndex,scrollToBookmarkOnLoad,showErrorMessages,"
+	+	"resizeWithWindow,resizeWithWindowDelay,resizeWithWindowMaxDelay,"
+	+	"onresizeall,onresizeall_start,onresizeall_end,onload,onunload").split(",")
+//	borderPanes: [ ALL options that are NOT specified as 'layout' ]
+	// default.panes options that apply to the center-pane (most options apply _only_ to border-panes)
+,	center: ("paneClass,contentSelector,contentIgnoreSelector,findNestedContent,applyDemoStyles,triggerEventsOnLoad,"
+	+	"showOverflowOnHover,maskContents,maskObjects,liveContentResizing,"
+	+	"childOptions,initChildLayout,resizeChildLayout,destroyChildLayout,"
+	+	"onresize,onresize_start,onresize_end,onsizecontent,onsizecontent_start,onsizecontent_end").split(",")
+	// options that MUST be specifically set 'per-pane' - CANNOT set in the panes (defaults) key
+,	noDefault: ("paneSelector,resizerCursor,customHotkey").split(",")
+};
+
+/**
+ * Processes options passed in converts flat-format data into subkey (JSON) format
+ * In flat-format, subkeys are _currently_ separated with 2 underscores, like north__optName
+ * Plugins may also call this method so they can transform their own data
+ *
+ * @param  {!Object}	hash	Data/options passed by user - may be a single level or nested levels
+ * @return {Object}				Returns hash of minWidth & minHeight
+ */
+$.layout.transformData = function (hash) {
+	var	json = { panes: {}, center: {} } // init return object
+	,	data, branch, optKey, keys, key, val, i, c;
+
+	if (typeof hash !== "object") return json; // no options passed
+
+	// convert all 'flat-keys' to 'sub-key' format
+	for (optKey in hash) {
+		branch	= json;
+		data	= $.layout.optionsMap.layout;
+		val		= hash[ optKey ];
+		keys	= optKey.split("__"); // eg: west__size or north__fxSettings__duration
+		c		= keys.length - 1;
+		// convert underscore-delimited to subkeys
+		for (i=0; i <= c; i++) {
+			key = keys[i];
+			if (i === c)
+				branch[key] = val;
+			else if (!branch[key])
+				branch[key] = {}; // create the subkey
+			// recurse to sub-key for next loop - if not done
+			branch = branch[key];
+		}
+	}
+
+	return json;
+};
+
+// INTERNAL CONFIG DATA - DO NOT CHANGE THIS!
+$.layout.backwardCompatibility = {
+	// data used by renameOldOptions()
+	map: {
+	//	OLD Option Name:			NEW Option Name
+		applyDefaultStyles:			"applyDemoStyles"
+	,	resizeNestedLayout:			"resizeChildLayout"
+	,	resizeWhileDragging:		"livePaneResizing"
+	,	resizeContentWhileDragging:	"liveContentResizing"
+	,	triggerEventsWhileDragging:	"triggerEventsDuringLiveResize"
+	,	maskIframesOnResize:		"maskContents"
+	,	useStateCookie:				"stateManagement.enabled"
+	,	"cookie.autoLoad":			"stateManagement.autoLoad"
+	,	"cookie.autoSave":			"stateManagement.autoSave"
+	,	"cookie.keys":				"stateManagement.stateKeys"
+	,	"cookie.name":				"stateManagement.cookie.name"
+	,	"cookie.domain":			"stateManagement.cookie.domain"
+	,	"cookie.path":				"stateManagement.cookie.path"
+	,	"cookie.expires":			"stateManagement.cookie.expires"
+	,	"cookie.secure":			"stateManagement.cookie.secure"
+	//	OLD Language options
+	,	noRoomToOpenTip:			"tips.noRoomToOpen"
+	,	togglerTip_open:			"tips.Close"	// open   = Close
+	,	togglerTip_closed:			"tips.Open"		// closed = Open
+	,	resizerTip:					"tips.Resize"
+	,	sliderTip:					"tips.Slide"
+	}
+
+/**
+* @param {Object}	opts
+*/
+,	renameOptions: function (opts) {
+		var map = $.layout.backwardCompatibility.map
+		,	oldData, newData, value
+		;
+		for (var itemPath in map) {
+			oldData	= getBranch( itemPath );
+			value	= oldData.branch[ oldData.key ];
+			if (value !== undefined) {
+				newData = getBranch( map[itemPath], true );
+				newData.branch[ newData.key ] = value;
+				delete oldData.branch[ oldData.key ];
+			}
+		}
+
+		/**
+		* @param {string}	path
+		* @param {boolean=}	[create=false]	Create path if does not exist
+		*/
+		function getBranch (path, create) {
+			var a = path.split(".") // split keys into array
+			,	c = a.length - 1
+			,	D = { branch: opts, key: a[c] } // init branch at top & set key (last item)
+			,	i = 0, k, undef;
+			for (; i<c; i++) { // skip the last key (data)
+				k = a[i];
+				if (D.branch[ k ] == undefined) { // child-key does not exist
+					if (create) {
+						D.branch = D.branch[ k ] = {}; // create child-branch
+					}
+					else // can't go any farther
+						D.branch = {}; // branch is undefined
+				}
+				else
+					D.branch = D.branch[ k ]; // get child-branch
+			}
+			return D;
+		};
+	}
+
+/**
+* @param {Object}	opts
+*/
+,	renameAllOptions: function (opts) {
+		var ren = $.layout.backwardCompatibility.renameOptions;
+		// rename root (layout) options
+		ren( opts );
+		// rename 'defaults' to 'panes'
+		if (opts.defaults) {
+			if (typeof opts.panes !== "object")
+				opts.panes = {};
+			$.extend(true, opts.panes, opts.defaults);
+			delete opts.defaults;
+		}
+		// rename options in the the options.panes key
+		if (opts.panes) ren( opts.panes );
+		// rename options inside *each pane key*, eg: options.west
+		$.each($.layout.config.allPanes, function (i, pane) {
+			if (opts[pane]) ren( opts[pane] );
+		});	
+		return opts;
+	}
+};
+
+
+
+
+/*	============================================================
+ *	BEGIN WIDGET: $( selector ).layout( {options} );
+ *	============================================================
+ */
+$.fn.layout = function (opts) {
+	var
+
+	// local aliases to global data
+	browser	= $.layout.browser
+,	_c		= $.layout.config
+
+	// local aliases to utlity methods
+,	cssW	= $.layout.cssWidth
+,	cssH	= $.layout.cssHeight
+,	elDims	= $.layout.getElementDimensions
+,	elCSS	= $.layout.getElementCSS
+,	evtObj	= $.layout.getEventObject
+,	evtPane	= $.layout.parsePaneName
+
+/**
+ * options - populated by initOptions()
+ */
+,	options = $.extend(true, {}, $.layout.defaults)
+,	effects	= options.effects = $.extend(true, {}, $.layout.effects)
+
+/**
+ * layout-state object
+ */
+,	state = {
+		// generate unique ID to use for event.namespace so can unbind only events added by 'this layout'
+		id:			"layout"+ $.now()	// code uses alias: sID
+	,	initialized: false
+	,	container:	{} // init all keys
+	,	north:		{}
+	,	south:		{}
+	,	east:		{}
+	,	west:		{}
+	,	center:		{}
+	}
+
+/**
+ * parent/child-layout pointers
+ */
+//,	hasParentLayout	= false	- exists ONLY inside Instance so can be set externally
+,	children = {
+		north:		null
+	,	south:		null
+	,	east:		null
+	,	west:		null
+	,	center:		null
+	}
+
+/*
+ * ###########################
+ *  INTERNAL HELPER FUNCTIONS
+ * ###########################
+ */
+
+	/**
+	* Manages all internal timers
+	*/
+,	timer = {
+		data:	{}
+	,	set:	function (s, fn, ms) { timer.clear(s); timer.data[s] = setTimeout(fn, ms); }
+	,	clear:	function (s) { var t=timer.data; if (t[s]) {clearTimeout(t[s]); delete t[s];} }
+	}
+
+	/**
+	* Alert or console.log a message - IF option is enabled.
+	*
+	* @param {(string|!Object)}	msg		Message (or debug-data) to display
+	* @param {?boolean}			popup	True by default, means 'alert', false means use console.log
+	* @param {?boolean}			debug	True means is a widget debugging message
+	*/
+,	_log = function (msg, popup, debug) {
+		var o = options;
+		if ((o.showErrorMessages && !debug) || (debug && o.showDebugMessages))
+			$.layout.msg( o.name +' / '+ msg, (popup !== false) );
+		return false;
+	}
+
+	/**
+	* Executes a Callback function after a trigger event, like resize, open or close
+	*
+	* @param {string}			evtName			Name of the layout callback, eg "onresize_start"
+	* @param {?string}			pane			This is passed only so we can pass the 'pane object' to the callback
+	* @param {?string|?boolean}	skipBoundEvents	True = do not run events bound to the elements - only the callbacks set in options
+	*/
+,	_runCallbacks = function (evtName, pane, skipBoundEvents) {
+		var	paneCB	= pane && isStr(pane)
+		,	s		= paneCB ? state[pane] : state
+		,	o		= paneCB ? options[pane] : options
+		,	lName	= options.name
+			// names like onopen and onopen_end separate are interchangeable in options...
+		,	lng		= evtName + (evtName.match(/_/) ? "" : "_end")
+		,	shrt	= lng.match(/_end$/) ? lng.substr(0, lng.length - 4) : ""
+		,	fn		= o[lng] || o[shrt]
+		,	retVal	= "NC" // NC = No Callback
+		,	args	= []
+		,	$P
+		;
+		if ( !paneCB && $.type(skipBoundEvents) !== 'boolean' )
+			skipBoundEvents = pane; // allow pane param to be skipped for Layout callback
+
+		// first trigger the callback set in the options
+		if (fn) {
+			try {
+				// convert function name (string) to function object
+				if (isStr( fn )) {
+					if (fn.match(/,/)) {
+						// function name cannot contain a comma, 
+						// so must be a function name AND a parameter to pass
+						args = fn.split(",")
+						,	fn = eval(args[0]);
+					}
+					else // just the name of an external function?
+						fn = eval(fn);
+				}
+				// execute the callback, if exists
+				if ($.isFunction( fn )) {
+					if (args.length)
+						retVal = fn(args[1]); // pass the argument parsed from 'list'
+					else if ( paneCB )
+						// pass data: pane-name, pane-element, pane-state, pane-options, and layout-name
+						retVal = fn( pane, $Ps[pane], s, o, lName );
+					else // must be a layout/container callback - pass suitable info
+						retVal = fn( Instance, s, o, lName );
+				}
+			}
+			catch (ex) {
+				_log( options.errors.callbackError.replace(/EVENT/, $.trim(pane +" "+ lng)), false );
+			}
+		}
+
+		// trigger additional events bound directly to the pane
+		if (!skipBoundEvents && retVal !== false) {
+			if ( paneCB ) { // PANE events can be bound to each pane-elements
+				$P	= $Ps[pane];
+				o	= options[pane];
+				s	= state[pane];
+				$P.triggerHandler('layoutpane'+ lng, [ pane, $P, s, o, lName ]);
+				if (shrt)
+					$P.triggerHandler('layoutpane'+ shrt, [ pane, $P, s, o, lName ]);
+			}
+			else { // LAYOUT events can be bound to the container-element
+				$N.triggerHandler('layout'+ lng, [ Instance, s, o, lName ]);
+				if (shrt)
+					$N.triggerHandler('layout'+ shrt, [ Instance, s, o, lName ]);
+			}
+		}
+
+		// ALWAYS resizeChildLayout after a resize event - even during initialization
+		if (evtName === "onresize_end" || evtName === "onsizecontent_end")
+			resizeChildLayout(pane); 
+
+		return retVal;
+	}
+
+
+	/**
+	* cure iframe display issues in IE & other browsers
+	*/
+,	_fixIframe = function (pane) {
+		if (browser.mozilla) return; // skip FireFox - it auto-refreshes iframes onShow
+		var $P = $Ps[pane];
+		// if the 'pane' is an iframe, do it
+		if (state[pane].tagName === "IFRAME")
+			$P.css(_c.hidden).css(_c.visible); 
+		else // ditto for any iframes INSIDE the pane
+			$P.find('IFRAME').css(_c.hidden).css(_c.visible);
+	}
+
+	/**
+	* @param  {string}		pane		Can accept ONLY a 'pane' (east, west, etc)
+	* @param  {number=}		outerSize	(optional) Can pass a width, allowing calculations BEFORE element is resized
+	* @return {number}		Returns the innerHeight/Width of el by subtracting padding and borders
+	*/
+,	cssSize = function (pane, outerSize) {
+		var fn = _c[pane].dir=="horz" ? cssH : cssW;
+		return fn($Ps[pane], outerSize);
+	}
+
+	/**
+	* @param  {string}		pane		Can accept ONLY a 'pane' (east, west, etc)
+	* @return {Object}		Returns hash of minWidth & minHeight
+	*/
+,	cssMinDims = function (pane) {
+		// minWidth/Height means CSS width/height = 1px
+		var	$P	= $Ps[pane]
+		,	dir	= _c[pane].dir
+		,	d	= {
+				minWidth:	1001 - cssW($P, 1000)
+			,	minHeight:	1001 - cssH($P, 1000)
+			}
+		;
+		if (dir === "horz") d.minSize = d.minHeight;
+		if (dir === "vert") d.minSize = d.minWidth;
+		return d;
+	}
+
+	// TODO: see if these methods can be made more useful...
+	// TODO: *maybe* return cssW/H from these so caller can use this info
+
+	/**
+	* @param {(string|!Object)}		el
+	* @param {number=}				outerWidth
+	* @param {boolean=}				[autoHide=false]
+	*/
+,	setOuterWidth = function (el, outerWidth, autoHide) {
+		var $E = el, w;
+		if (isStr(el)) $E = $Ps[el]; // west
+		else if (!el.jquery) $E = $(el);
+		w = cssW($E, outerWidth);
+		$E.css({ width: w });
+		if (w > 0) {
+			if (autoHide && $E.data('autoHidden') && $E.innerHeight() > 0) {
+				$E.show().data('autoHidden', false);
+				if (!browser.mozilla) // FireFox refreshes iframes - IE does not
+					// make hidden, then visible to 'refresh' display after animation
+					$E.css(_c.hidden).css(_c.visible);
+			}
+		}
+		else if (autoHide && !$E.data('autoHidden'))
+			$E.hide().data('autoHidden', true);
+	}
+
+	/**
+	* @param {(string|!Object)}		el
+	* @param {number=}				outerHeight
+	* @param {boolean=}				[autoHide=false]
+	*/
+,	setOuterHeight = function (el, outerHeight, autoHide) {
+		var $E = el, h;
+		if (isStr(el)) $E = $Ps[el]; // west
+		else if (!el.jquery) $E = $(el);
+		h = cssH($E, outerHeight);
+		$E.css({ height: h, visibility: "visible" }); // may have been 'hidden' by sizeContent
+		if (h > 0 && $E.innerWidth() > 0) {
+			if (autoHide && $E.data('autoHidden')) {
+				$E.show().data('autoHidden', false);
+				if (!browser.mozilla) // FireFox refreshes iframes - IE does not
+					$E.css(_c.hidden).css(_c.visible);
+			}
+		}
+		else if (autoHide && !$E.data('autoHidden'))
+			$E.hide().data('autoHidden', true);
+	}
+
+	/**
+	* @param {(string|!Object)}		el
+	* @param {number=}				outerSize
+	* @param {boolean=}				[autoHide=false]
+	*/
+,	setOuterSize = function (el, outerSize, autoHide) {
+		if (_c[pane].dir=="horz") // pane = north or south
+			setOuterHeight(el, outerSize, autoHide);
+		else // pane = east or west
+			setOuterWidth(el, outerSize, autoHide);
+	}
+
+
+	/**
+	* Converts any 'size' params to a pixel/integer size, if not already
+	* If 'auto' or a decimal/percentage is passed as 'size', a pixel-size is calculated
+	*
+	/**
+	* @param  {string}				pane
+	* @param  {(string|number)=}	size
+	* @param  {string=}				[dir]
+	* @return {number}
+	*/
+,	_parseSize = function (pane, size, dir) {
+		if (!dir) dir = _c[pane].dir;
+
+		if (isStr(size) && size.match(/%/))
+			size = (size === '100%') ? -1 : parseInt(size, 10) / 100; // convert % to decimal
+
+		if (size === 0)
+			return 0;
+		else if (size >= 1)
+			return parseInt(size, 10);
+
+		var o = options, avail = 0;
+		if (dir=="horz") // north or south or center.minHeight
+			avail = sC.innerHeight - ($Ps.north ? o.north.spacing_open : 0) - ($Ps.south ? o.south.spacing_open : 0);
+		else if (dir=="vert") // east or west or center.minWidth
+			avail = sC.innerWidth - ($Ps.west ? o.west.spacing_open : 0) - ($Ps.east ? o.east.spacing_open : 0);
+
+		if (size === -1) // -1 == 100%
+			return avail;
+		else if (size > 0) // percentage, eg: .25
+			return round(avail * size);
+		else if (pane=="center")
+			return 0;
+		else { // size < 0 || size=='auto' || size==Missing || size==Invalid
+			// auto-size the pane
+			var	dim	= (dir === "horz" ? "height" : "width")
+			,	$P	= $Ps[pane]
+			,	$C	= dim === 'height' ? $Cs[pane] : false
+			,	vis	= $.layout.showInvisibly($P) // show pane invisibly if hidden
+			,	szP	= $P.css(dim) // SAVE current pane size
+			,	szC	= $C ? $C.css(dim) : 0 // SAVE current content size
+			;
+			$P.css(dim, "auto");
+			if ($C) $C.css(dim, "auto");
+			size = (dim === "height") ? $P.outerHeight() : $P.outerWidth(); // MEASURE
+			$P.css(dim, szP).css(vis); // RESET size & visibility
+			if ($C) $C.css(dim, szC);
+			return size;
+		}
+	}
+
+	/**
+	* Calculates current 'size' (outer-width or outer-height) of a border-pane - optionally with 'pane-spacing' added
+	*
+	* @param  {(string|!Object)}	pane
+	* @param  {boolean=}			[inclSpace=false]
+	* @return {number}				Returns EITHER Width for east/west panes OR Height for north/south panes
+	*/
+,	getPaneSize = function (pane, inclSpace) {
+		var 
+			$P	= $Ps[pane]
+		,	o	= options[pane]
+		,	s	= state[pane]
+		,	oSp	= (inclSpace ? o.spacing_open : 0)
+		,	cSp	= (inclSpace ? o.spacing_closed : 0)
+		;
+		if (!$P || s.isHidden)
+			return 0;
+		else if (s.isClosed || (s.isSliding && inclSpace))
+			return cSp;
+		else if (_c[pane].dir === "horz")
+			return $P.outerHeight() + oSp;
+		else // dir === "vert"
+			return $P.outerWidth() + oSp;
+	}
+
+	/**
+	* Calculate min/max pane dimensions and limits for resizing
+	*
+	* @param  {string}		pane
+	* @param  {boolean=}	[slide=false]
+	*/
+,	setSizeLimits = function (pane, slide) {
+		if (!isInitialized()) return;
+		var 
+			o				= options[pane]
+		,	s				= state[pane]
+		,	c				= _c[pane]
+		,	dir				= c.dir
+		,	side			= c.side.toLowerCase()
+		,	type			= c.sizeType.toLowerCase()
+		,	isSliding		= (slide != undefined ? slide : s.isSliding) // only open() passes 'slide' param
+		,	$P				= $Ps[pane]
+		,	paneSpacing		= o.spacing_open
+		//	measure the pane on the *opposite side* from this pane
+		,	altPane			= _c.oppositeEdge[pane]
+		,	altS			= state[altPane]
+		,	$altP			= $Ps[altPane]
+		,	altPaneSize		= (!$altP || altS.isVisible===false || altS.isSliding ? 0 : (dir=="horz" ? $altP.outerHeight() : $altP.outerWidth()))
+		,	altPaneSpacing	= ((!$altP || altS.isHidden ? 0 : options[altPane][ altS.isClosed !== false ? "spacing_closed" : "spacing_open" ]) || 0)
+		//	limitSize prevents this pane from 'overlapping' opposite pane
+		,	containerSize	= (dir=="horz" ? sC.innerHeight : sC.innerWidth)
+		,	minCenterDims	= cssMinDims("center")
+		,	minCenterSize	= dir=="horz" ? max(options.center.minHeight, minCenterDims.minHeight) : max(options.center.minWidth, minCenterDims.minWidth)
+		//	if pane is 'sliding', then ignore center and alt-pane sizes - because 'overlays' them
+		,	limitSize		= (containerSize - paneSpacing - (isSliding ? 0 : (_parseSize("center", minCenterSize, dir) + altPaneSize + altPaneSpacing)))
+		,	minSize			= s.minSize = max( _parseSize(pane, o.minSize), cssMinDims(pane).minSize )
+		,	maxSize			= s.maxSize = min( (o.maxSize ? _parseSize(pane, o.maxSize) : 100000), limitSize )
+		,	r				= s.resizerPosition = {} // used to set resizing limits
+		,	top				= sC.insetTop
+		,	left			= sC.insetLeft
+		,	W				= sC.innerWidth
+		,	H				= sC.innerHeight
+		,	rW				= o.spacing_open // subtract resizer-width to get top/left position for south/east
+		;
+		switch (pane) {
+			case "north":	r.min = top + minSize;
+							r.max = top + maxSize;
+							break;
+			case "west":	r.min = left + minSize;
+							r.max = left + maxSize;
+							break;
+			case "south":	r.min = top + H - maxSize - rW;
+							r.max = top + H - minSize - rW;
+							break;
+			case "east":	r.min = left + W - maxSize - rW;
+							r.max = left + W - minSize - rW;
+							break;
+		};
+	}
+
+	/**
+	* Returns data for setting the size/position of center pane. Also used to set Height for east/west panes
+	*
+	* @return JSON  Returns a hash of all dimensions: top, bottom, left, right, (outer) width and (outer) height
+	*/
+,	calcNewCenterPaneDims = function () {
+		var d = {
+			top:	getPaneSize("north", true) // true = include 'spacing' value for pane
+		,	bottom:	getPaneSize("south", true)
+		,	left:	getPaneSize("west", true)
+		,	right:	getPaneSize("east", true)
+		,	width:	0
+		,	height:	0
+		};
+
+		// NOTE: sC = state.container
+		// calc center-pane outer dimensions
+		d.width		= sC.innerWidth - d.left - d.right;  // outerWidth
+		d.height	= sC.innerHeight - d.bottom - d.top; // outerHeight
+		// add the 'container border/padding' to get final positions relative to the container
+		d.top		+= sC.insetTop;
+		d.bottom	+= sC.insetBottom;
+		d.left		+= sC.insetLeft;
+		d.right		+= sC.insetRight;
+
+		return d;
+	}
+
+
+	/**
+	* @param {!Object}		el
+	* @param {boolean=}		[allStates=false]
+	*/
+,	getHoverClasses = function (el, allStates) {
+		var
+			$El		= $(el)
+		,	type	= $El.data("layoutRole")
+		,	pane	= $El.data("layoutEdge")
+		,	o		= options[pane]
+		,	root	= o[type +"Class"]
+		,	_pane	= "-"+ pane // eg: "-west"
+		,	_open	= "-open"
+		,	_closed	= "-closed"
+		,	_slide	= "-sliding"
+		,	_hover	= "-hover " // NOTE the trailing space
+		,	_state	= $El.hasClass(root+_closed) ? _closed : _open
+		,	_alt	= _state === _closed ? _open : _closed
+		,	classes = (root+_hover) + (root+_pane+_hover) + (root+_state+_hover) + (root+_pane+_state+_hover)
+		;
+		if (allStates) // when 'removing' classes, also remove alternate-state classes
+			classes += (root+_alt+_hover) + (root+_pane+_alt+_hover);
+
+		if (type=="resizer" && $El.hasClass(root+_slide))
+			classes += (root+_slide+_hover) + (root+_pane+_slide+_hover);
+
+		return $.trim(classes);
+	}
+,	addHover	= function (evt, el) {
+		var $E = $(el || this);
+		if (evt && $E.data("layoutRole") === "toggler")
+			evt.stopPropagation(); // prevent triggering 'slide' on Resizer-bar
+		$E.addClass( getHoverClasses($E) );
+	}
+,	removeHover	= function (evt, el) {
+		var $E = $(el || this);
+		$E.removeClass( getHoverClasses($E, true) );
+	}
+
+,	onResizerEnter	= function (evt) { // ALSO called by toggler.mouseenter
+		if ($.fn.disableSelection)
+			$("body").disableSelection();
+	}
+,	onResizerLeave	= function (evt, el) {
+		var
+			e = el || this // el is only passed when called by the timer
+		,	pane = $(e).data("layoutEdge")
+		,	name = pane +"ResizerLeave"
+		;
+		timer.clear(pane+"_openSlider"); // cancel slideOpen timer, if set
+		timer.clear(name); // cancel enableSelection timer - may re/set below
+		// this method calls itself on a timer because it needs to allow
+		// enough time for dragging to kick-in and set the isResizing flag
+		// dragging has a 100ms delay set, so this delay must be >100
+		if (!el) // 1st call - mouseleave event
+			timer.set(name, function(){ onResizerLeave(evt, e); }, 200);
+		// if user is resizing, then dragStop will enableSelection(), so can skip it here
+		else if (!state[pane].isResizing && $.fn.enableSelection) // 2nd call - by timer
+			$("body").enableSelection();
+	}
+
+/*
+ * ###########################
+ *   INITIALIZATION METHODS
+ * ###########################
+ */
+
+	/**
+	* Initialize the layout - called automatically whenever an instance of layout is created
+	*
+	* @see  none - triggered onInit
+	* @return  mixed	true = fully initialized | false = panes not initialized (yet) | 'cancel' = abort
+	*/
+,	_create = function () {
+		// initialize config/options
+		initOptions();
+		var o = options;
+
+		// TEMP state so isInitialized returns true during init process
+		state.creatingLayout = true;
+
+		// init plugins for this layout, if there are any (eg: stateManagement)
+		runPluginCallbacks( Instance, $.layout.onCreate );
+
+		// options & state have been initialized, so now run beforeLoad callback
+		// onload will CANCEL layout creation if it returns false
+		if (false === _runCallbacks("onload_start"))
+			return 'cancel';
+
+		// initialize the container element
+		_initContainer();
+
+		// bind hotkey function - keyDown - if required
+		initHotkeys();
+
+		// bind window.onunload
+		$(window).bind("unload."+ sID, unload);
+
+		// init plugins for this layout, if there are any (eg: customButtons)
+		runPluginCallbacks( Instance, $.layout.onLoad );
+
+		// if layout elements are hidden, then layout WILL NOT complete initialization!
+		// initLayoutElements will set initialized=true and run the onload callback IF successful
+		if (o.initPanes) _initLayoutElements();
+
+		delete state.creatingLayout;
+
+		return state.initialized;
+	}
+
+	/**
+	* Initialize the layout IF not already
+	*
+	* @see  All methods in Instance run this test
+	* @return  boolean	true = layoutElements have been initialized | false = panes are not initialized (yet)
+	*/
+,	isInitialized = function () {
+		if (state.initialized || state.creatingLayout) return true;	// already initialized
+		else return _initLayoutElements();	// try to init panes NOW
+	}
+
+	/**
+	* Initialize the layout - called automatically whenever an instance of layout is created
+	*
+	* @see  _create() & isInitialized
+	* @return  An object pointer to the instance created
+	*/
+,	_initLayoutElements = function (retry) {
+		// initialize config/options
+		var o = options;
+
+		// CANNOT init panes inside a hidden container!
+		if (!$N.is(":visible")) {
+			// handle Chrome bug where popup window 'has no height'
+			// if layout is BODY element, try again in 50ms
+			// SEE: http://layout.jquery-dev.net/samples/test_popup_window.html
+			if ( !retry && browser.webkit && $N[0].tagName === "BODY" )
+				setTimeout(function(){ _initLayoutElements(true); }, 50);
+			return false;
+		}
+
+		// a center pane is required, so make sure it exists
+		if (!getPane("center").length) {
+			return _log( o.errors.centerPaneMissing );
+		}
+
+		// TEMP state so isInitialized returns true during init process
+		state.creatingLayout = true;
+
+		// update Container dims
+		$.extend(sC, elDims( $N ));
+
+		// initialize all layout elements
+		initPanes();	// size & position panes - calls initHandles() - which calls initResizable()
+
+		if (o.scrollToBookmarkOnLoad) {
+			var l = self.location;
+			if (l.hash) l.replace( l.hash ); // scrollTo Bookmark
+		}
+
+		// check to see if this layout 'nested' inside a pane
+		if (Instance.hasParentLayout)
+			o.resizeWithWindow = false;
+		// bind resizeAll() for 'this layout instance' to window.resize event
+		else if (o.resizeWithWindow)
+			$(window).bind("resize."+ sID, windowResize);
+
+		delete state.creatingLayout;
+		state.initialized = true;
+
+		// init plugins for this layout, if there are any
+		runPluginCallbacks( Instance, $.layout.onReady );
+
+		// now run the onload callback, if exists
+		_runCallbacks("onload_end");
+
+		return true; // elements initialized successfully
+	}
+
+	/**
+	* Initialize nested layouts - called when _initLayoutElements completes
+	*
+	* NOT CURRENTLY USED
+	*
+	* @see _initLayoutElements
+	* @return  An object pointer to the instance created
+	*/
+,	_initChildLayouts = function () {
+		$.each(_c.allPanes, function (idx, pane) {
+			if (options[pane].initChildLayout)
+				createChildLayout( pane );
+		});
+	}
+
+	/**
+	* Initialize nested layouts for a specific pane - can optionally pass layout-options
+	*
+	* @see _initChildLayouts
+	* @param {string|Object}	evt_or_pane	The pane being opened, ie: north, south, east, or west
+	* @param {Object=}			[opts]		Layout-options - if passed, will OVERRRIDE options[pane].childOptions
+	* @return  An object pointer to the layout instance created - or null
+	*/
+,	createChildLayout = function (evt_or_pane, opts) {
+		var	pane = evtPane.call(this, evt_or_pane)
+		,	$P	= $Ps[pane]
+		,	C	= children
+		;
+		if ($P) {
+			var	$C	= $Cs[pane]
+			,	o	= opts || options[pane].childOptions
+			,	d	= "layout"
+			//	determine which element is supposed to be the 'child container'
+			//	if pane has a 'containerSelector' OR a 'content-div', use those instead of the pane
+			,	$Cont = o.containerSelector ? $P.find( o.containerSelector ) : ($C || $P)
+			,	containerFound = $Cont.length
+			//	see if a child-layout ALREADY exists on this element
+			,	child = containerFound ? (C[pane] = $Cont.data(d) || null) : null
+			;
+			// if no layout exists, but childOptions are set, try to create the layout now
+			if (!child && containerFound && o)
+				child = C[pane] = $Cont.eq(0).layout(o) || null;
+			if (child)
+				child.hasParentLayout = true;	// set parent-flag in child
+		}
+		Instance[pane].child = C[pane]; // ALWAYS set pane-object pointer, even if null
+	}
+
+,	windowResize = function () {
+		var delay = Number(options.resizeWithWindowDelay);
+		if (delay < 10) delay = 100; // MUST have a delay!
+		// resizing uses a delay-loop because the resize event fires repeatly - except in FF, but delay anyway
+		timer.clear("winResize"); // if already running
+		timer.set("winResize", function(){
+			timer.clear("winResize");
+			timer.clear("winResizeRepeater");
+			var dims = elDims( $N );
+			// only trigger resizeAll() if container has changed size
+			if (dims.innerWidth !== sC.innerWidth || dims.innerHeight !== sC.innerHeight)
+				resizeAll();
+		}, delay);
+		// ALSO set fixed-delay timer, if not already running
+		if (!timer.data["winResizeRepeater"]) setWindowResizeRepeater();
+	}
+
+,	setWindowResizeRepeater = function () {
+		var delay = Number(options.resizeWithWindowMaxDelay);
+		if (delay > 0)
+			timer.set("winResizeRepeater", function(){ setWindowResizeRepeater(); resizeAll(); }, delay);
+	}
+
+,	unload = function () {
+		var o = options;
+
+		_runCallbacks("onunload_start");
+
+		// trigger plugin callabacks for this layout (eg: stateManagement)
+		runPluginCallbacks( Instance, $.layout.onUnload );
+
+		_runCallbacks("onunload_end");
+	}
+
+	/**
+	* Validate and initialize container CSS and events
+	*
+	* @see  _create()
+	*/
+,	_initContainer = function () {
+		var
+			N		= $N[0]
+		,	tag		= sC.tagName = N.tagName
+		,	id		= sC.id = N.id
+		,	cls		= sC.className = N.className
+		,	o		= options
+		,	name	= o.name
+		,	fullPage= (tag === "BODY")
+		,	props	= "overflow,position,margin,padding,border"
+		,	css		= "layoutCSS"
+		,	CSS		= {}
+		,	hid		= "hidden" // used A LOT!
+		//	see if this container is a 'pane' inside an outer-layout
+		,	parent	= $N.data("parentLayout")	// parent-layout Instance
+		,	pane	= $N.data("layoutEdge")		// pane-name in parent-layout
+		,	isChild	= parent && pane
+		;
+		// sC -> state.container
+		sC.selector = $N.selector.split(".slice")[0];
+		sC.ref		= (o.name ? o.name +' layout / ' : '') + tag + (id ? "#"+id : cls ? '.['+cls+']' : ''); // used in messages
+
+		$N	.data({
+				layout: Instance
+			,	layoutContainer: sID // FLAG to indicate this is a layout-container - contains unique internal ID
+			})
+			.addClass(o.containerClass)
+		;
+		var layoutMethods = {
+			destroy:	''
+		,	initPanes:	''
+		,	resizeAll:	'resizeAll'
+		,	resize:		'resizeAll'
+		};
+		// loop hash and bind all methods - include layoutID namespacing
+		for (name in layoutMethods) {
+			$N.bind("layout"+ name.toLowerCase() +"."+ sID, Instance[ layoutMethods[name] || name ]);
+		}
+
+		// if this container is another layout's 'pane', then set child/parent pointers
+		if (isChild) {
+			// update parent flag
+			Instance.hasParentLayout = true;
+			// set pointers to THIS child-layout (Instance) in parent-layout
+			// NOTE: parent.PANE.child is an ALIAS to parent.children.PANE
+			parent[pane].child = parent.children[pane] = $N.data("layout");
+		}
+
+		// SAVE original container CSS for use in destroy()
+		if (!$N.data(css)) {
+			// handle props like overflow different for BODY & HTML - has 'system default' values
+			if (fullPage) {
+				CSS = $.extend( elCSS($N, props), {
+					height:		$N.css("height")
+				,	overflow:	$N.css("overflow")
+				,	overflowX:	$N.css("overflowX")
+				,	overflowY:	$N.css("overflowY")
+				});
+				// ALSO SAVE <HTML> CSS
+				var $H = $("html");
+				$H.data(css, {
+					height:		"auto" // FF would return a fixed px-size!
+				,	overflow:	$H.css("overflow")
+				,	overflowX:	$H.css("overflowX")
+				,	overflowY:	$H.css("overflowY")
+				});
+			}
+			else // handle props normally for non-body elements
+				CSS = elCSS($N, props+",top,bottom,left,right,width,height,overflow,overflowX,overflowY");
+
+			$N.data(css, CSS);
+		}
+
+		try { // format html/body if this is a full page layout
+			if (fullPage) {
+				$("html").css({
+					height:		"100%"
+				,	overflow:	hid
+				,	overflowX:	hid
+				,	overflowY:	hid
+				});
+				$("body").css({
+					position:	"relative"
+				,	height:		"100%"
+				,	overflow:	hid
+				,	overflowX:	hid
+				,	overflowY:	hid
+				,	margin:		0
+				,	padding:	0		// TODO: test whether body-padding could be handled?
+				,	border:		"none"	// a body-border creates problems because it cannot be measured!
+				});
+
+				// set current layout-container dimensions
+				$.extend(sC, elDims( $N ));
+			}
+			else { // set required CSS for overflow and position
+				// ENSURE container will not 'scroll'
+				CSS = { overflow: hid, overflowX: hid, overflowY: hid }
+				var
+					p = $N.css("position")
+				,	h = $N.css("height")
+				;
+				// if this is a NESTED layout, then container/outer-pane ALREADY has position and height
+				if (!isChild) {
+					if (!p || !p.match(/fixed|absolute|relative/))
+						CSS.position = "relative"; // container MUST have a 'position'
+					/*
+					if (!h || h=="auto")
+						CSS.height = "100%"; // container MUST have a 'height'
+					*/
+				}
+				$N.css( CSS );
+
+				// set current layout-container dimensions
+				if ( $N.is(":visible") ) {
+					$.extend(sC, elDims( $N ));
+					if (sC.innerHeight < 1)
+						_log( o.errors.noContainerHeight.replace(/CONTAINER/, sC.ref) );
+				}
+			}
+		} catch (ex) {}
+	}
+
+	/**
+	* Bind layout hotkeys - if options enabled
+	*
+	* @see  _create() and addPane()
+	* @param {string=}	[panes=""]	The edge(s) to process
+	*/
+,	initHotkeys = function (panes) {
+		panes = panes ? panes.split(",") : _c.borderPanes;
+		// bind keyDown to capture hotkeys, if option enabled for ANY pane
+		$.each(panes, function (i, pane) {
+			var o = options[pane];
+			if (o.enableCursorHotkey || o.customHotkey) {
+				$(document).bind("keydown."+ sID, keyDown); // only need to bind this ONCE
+				return false; // BREAK - binding was done
+			}
+		});
+	}
+
+	/**
+	* Build final OPTIONS data
+	*
+	* @see  _create()
+	*/
+,	initOptions = function () {
+		var data, d, pane, key, val, i, c, o;
+
+		// reprocess user's layout-options to have correct options sub-key structure
+		opts = $.layout.transformData( opts ); // panes = default subkey
+
+		// auto-rename old options for backward compatibility
+		opts = $.layout.backwardCompatibility.renameAllOptions( opts );
+
+		// if user-options has 'panes' key (pane-defaults), clean it...
+		if (!$.isEmptyObject(opts.panes)) {
+			// REMOVE any pane-defaults that MUST be set per-pane
+			data = $.layout.optionsMap.noDefault;
+			for (i=0, c=data.length; i<c; i++) {
+				key = data[i];
+				delete opts.panes[key]; // OK if does not exist
+			}
+			// REMOVE any layout-options specified under opts.panes
+			data = $.layout.optionsMap.layout;
+			for (i=0, c=data.length; i<c; i++) {
+				key = data[i];
+				delete opts.panes[key]; // OK if does not exist
+			}
+		}
+
+		// MOVE any NON-layout-options from opts-root to opts.panes
+		data = $.layout.optionsMap.layout;
+		var rootKeys = $.layout.config.optionRootKeys;
+		for (key in opts) {
+			val = opts[key];
+			if ($.inArray(key, rootKeys) < 0 && $.inArray(key, data) < 0) {
+				if (!opts.panes[key])
+					opts.panes[key] = $.isPlainObject(val) ? $.extend(true, {}, val) : val;
+				delete opts[key]
+			}
+		}
+
+		// START by updating ALL options from opts
+		$.extend(true, options, opts);
+
+		// CREATE final options (and config) for EACH pane
+		$.each(_c.allPanes, function (i, pane) {
+
+			// apply 'pane-defaults' to CONFIG.[PANE]
+			_c[pane] = $.extend(true, {}, _c.panes, _c[pane]);
+
+			d = options.panes;
+			o = options[pane];
+
+			// center-pane uses SOME keys in defaults.panes branch
+			if (pane === 'center') {
+				// ONLY copy keys from opts.panes listed in: $.layout.optionsMap.center
+				data = $.layout.optionsMap.center;		// list of 'center-pane keys'
+				for (i=0, c=data.length; i<c; i++) {	// loop the list...
+					key = data[i];
+					// only need to use pane-default if pane-specific value not set
+					if (!opts.center[key] && (opts.panes[key] || !o[key]))
+						o[key] = d[key]; // pane-default
+				}
+			}
+			else {
+				// border-panes use ALL keys in defaults.panes branch
+				o = options[pane] = $.extend(true, {}, d, o); // re-apply pane-specific opts AFTER pane-defaults
+				createFxOptions( pane );
+				// ensure all border-pane-specific base-classes exist
+				if (!o.resizerClass)	o.resizerClass	= "ui-layout-resizer";
+				if (!o.togglerClass)	o.togglerClass	= "ui-layout-toggler";
+			}
+			// ensure we have base pane-class (ALL panes)
+			if (!o.paneClass) o.paneClass = "ui-layout-pane";
+		});
+
+		// update options.zIndexes if a zIndex-option specified
+		var zo	= opts.zIndex
+		,	z	= options.zIndexes;
+		if (zo > 0) {
+			z.pane_normal		= zo;
+			z.content_mask		= max(zo+1, z.content_mask);	// MIN = +1
+			z.resizer_normal	= max(zo+2, z.resizer_normal);	// MIN = +2
+		}
+
+		// DELETE 'panes' key now that we are done - values were copied to EACH pane
+		delete options.panes;
+
+
+		function createFxOptions ( pane ) {
+			var	o = options[pane]
+			,	d = options.panes;
+			// ensure fxSettings key to avoid errors
+			if (!o.fxSettings) o.fxSettings = {};
+			if (!d.fxSettings) d.fxSettings = {};
+
+			$.each(["_open","_close","_size"], function (i,n) { 
+				var
+					sName		= "fxName"+ n
+				,	sSpeed		= "fxSpeed"+ n
+				,	sSettings	= "fxSettings"+ n
+					// recalculate fxName according to specificity rules
+				,	fxName = o[sName] =
+						o[sName]	// options.west.fxName_open
+					||	d[sName]	// options.panes.fxName_open
+					||	o.fxName	// options.west.fxName
+					||	d.fxName	// options.panes.fxName
+					||	"none"		// MEANS $.layout.defaults.panes.fxName == "" || false || null || 0
+				;
+				// validate fxName to ensure is valid effect - MUST have effect-config data in options.effects
+				if (fxName === "none" || !$.effects || !$.effects[fxName] || !options.effects[fxName])
+					fxName = o[sName] = "none"; // effect not loaded OR unrecognized fxName
+
+				// set vars for effects subkeys to simplify logic
+				var	fx		= options.effects[fxName] || {}	// effects.slide
+				,	fx_all	= fx.all	|| null				// effects.slide.all
+				,	fx_pane	= fx[pane]	|| null				// effects.slide.west
+				;
+				// create fxSpeed[_open|_close|_size]
+				o[sSpeed] =
+					o[sSpeed]				// options.west.fxSpeed_open
+				||	d[sSpeed]				// options.west.fxSpeed_open
+				||	o.fxSpeed				// options.west.fxSpeed
+				||	d.fxSpeed				// options.panes.fxSpeed
+				||	null					// DEFAULT - let fxSetting.duration control speed
+				;
+				// create fxSettings[_open|_close|_size]
+				o[sSettings] = $.extend(
+					true
+				,	{}
+				,	fx_all					// effects.slide.all
+				,	fx_pane					// effects.slide.west
+				,	d.fxSettings			// options.panes.fxSettings
+				,	o.fxSettings			// options.west.fxSettings
+				,	d[sSettings]			// options.panes.fxSettings_open
+				,	o[sSettings]			// options.west.fxSettings_open
+				);
+			});
+
+			// DONE creating action-specific-settings for this pane,
+			// so DELETE generic options - are no longer meaningful
+			delete o.fxName;
+			delete o.fxSpeed;
+			delete o.fxSettings;
+		}
+	}
+
+	/**
+	* Initialize module objects, styling, size and position for all panes
+	*
+	* @see  _initElements()
+	* @param {string}	pane		The pane to process
+	*/
+,	getPane = function (pane) {
+		var sel = options[pane].paneSelector
+		if (sel.substr(0,1)==="#") // ID selector
+			// NOTE: elements selected 'by ID' DO NOT have to be 'children'
+			return $N.find(sel).eq(0);
+		else { // class or other selector
+			var $P = $N.children(sel).eq(0);
+			// look for the pane nested inside a 'form' element
+			return $P.length ? $P : $N.children("form:first").children(sel).eq(0);
+		}
+	}
+
+,	initPanes = function (evt) {
+		// stopPropagation if called by trigger("layoutinitpanes") - use evtPane utility 
+		evtPane(evt);
+
+		// NOTE: do north & south FIRST so we can measure their height - do center LAST
+		$.each(_c.allPanes, function (idx, pane) {
+			addPane( pane, true );
+		});
+
+		// init the pane-handles NOW in case we have to hide or close the pane below
+		initHandles();
+
+		// now that all panes have been initialized and initially-sized,
+		// make sure there is really enough space available for each pane
+		$.each(_c.borderPanes, function (i, pane) {
+			if ($Ps[pane] && state[pane].isVisible) { // pane is OPEN
+				setSizeLimits(pane);
+				makePaneFit(pane); // pane may be Closed, Hidden or Resized by makePaneFit()
+			}
+		});
+		// size center-pane AGAIN in case we 'closed' a border-pane in loop above
+		sizeMidPanes("center");
+
+		//	Chrome/Webkit sometimes fires callbacks BEFORE it completes resizing!
+		//	Before RC30.3, there was a 10ms delay here, but that caused layout 
+		//	to load asynchrously, which is BAD, so try skipping delay for now
+
+		// process pane contents and callbacks, and init/resize child-layout if exists
+		$.each(_c.allPanes, function (i, pane) {
+			var o = options[pane];
+			if ($Ps[pane]) {
+				if (state[pane].isVisible) { // pane is OPEN
+					sizeContent(pane);
+					// trigger pane.onResize if triggerEventsOnLoad = true
+					if (o.triggerEventsOnLoad)
+						_runCallbacks("onresize_end", pane);
+				else // automatic if onresize called, otherwise call it specifically
+					// resize child - IF inner-layout already exists (created before this layout)
+					resizeChildLayout(pane);
+				}
+				// init childLayout - even if pane is not visible
+				if (o.initChildLayout && o.childOptions)
+					createChildLayout(pane);
+			}
+		});
+	}
+
+	/**
+	* Add a pane to the layout - subroutine of initPanes()
+	*
+	* @see  initPanes()
+	* @param {string}	pane			The pane to process
+	* @param {boolean=}	[force=false]	Size content after init
+	*/
+,	addPane = function (pane, force) {
+		if (!force && !isInitialized()) return;
+		var
+			o		= options[pane]
+		,	s		= state[pane]
+		,	c		= _c[pane]
+		,	fx		= s.fx
+		,	dir		= c.dir
+		,	spacing	= o.spacing_open || 0
+		,	isCenter = (pane === "center")
+		,	CSS		= {}
+		,	$P		= $Ps[pane]
+		,	size, minSize, maxSize
+		;
+		// if pane-pointer already exists, remove the old one first
+		if ($P)
+			removePane( pane, false, true, false );
+		else
+			$Cs[pane] = false; // init
+
+		$P = $Ps[pane] = getPane(pane);
+		if (!$P.length) {
+			$Ps[pane] = false; // logic
+			return;
+		}
+
+		// SAVE original Pane CSS
+		if (!$P.data("layoutCSS")) {
+			var props = "position,top,left,bottom,right,width,height,overflow,zIndex,display,backgroundColor,padding,margin,border";
+			$P.data("layoutCSS", elCSS($P, props));
+		}
+
+		// create alias for pane data in Instance - initHandles will add more
+		Instance[pane] = { name: pane, pane: $Ps[pane], content: $Cs[pane], options: options[pane], state: state[pane], child: children[pane] };
+
+		// add classes, attributes & events
+		$P	.data({
+				parentLayout:	Instance		// pointer to Layout Instance
+			,	layoutPane:		Instance[pane]	// NEW pointer to pane-alias-object
+			,	layoutEdge:		pane
+			,	layoutRole:		"pane"
+			})
+			.css(c.cssReq).css("zIndex", options.zIndexes.pane_normal)
+			.css(o.applyDemoStyles ? c.cssDemo : {}) // demo styles
+			.addClass( o.paneClass +" "+ o.paneClass+"-"+pane ) // default = "ui-layout-pane ui-layout-pane-west" - may be a dupe of 'paneSelector'
+			.bind("mouseenter."+ sID, addHover )
+			.bind("mouseleave."+ sID, removeHover )
+			;
+		var paneMethods = {
+				hide:				''
+			,	show:				''
+			,	toggle:				''
+			,	close:				''
+			,	open:				''
+			,	slideOpen:			''
+			,	slideClose:			''
+			,	slideToggle:		''
+			,	size:				'sizePane'
+			,	sizePane:			'sizePane'
+			,	sizeContent:		''
+			,	sizeHandles:		''
+			,	enableClosable:		''
+			,	disableClosable:	''
+			,	enableSlideable:	''
+			,	disableSlideable:	''
+			,	enableResizable:	''
+			,	disableResizable:	''
+			,	swapPanes:			'swapPanes'
+			,	swap:				'swapPanes'
+			,	move:				'swapPanes'
+			,	removePane:			'removePane'
+			,	remove:				'removePane'
+			,	createChildLayout:	''
+			,	resizeChildLayout:	''
+			,	resizeAll:			'resizeAll'
+			,	resizeLayout:		'resizeAll'
+			}
+		,	name;
+		// loop hash and bind all methods - include layoutID namespacing
+		for (name in paneMethods) {
+			$P.bind("layoutpane"+ name.toLowerCase() +"."+ sID, Instance[ paneMethods[name] || name ]);
+		}
+
+		// see if this pane has a 'scrolling-content element'
+		initContent(pane, false); // false = do NOT sizeContent() - called later
+
+		if (!isCenter) {
+			// call _parseSize AFTER applying pane classes & styles - but before making visible (if hidden)
+			// if o.size is auto or not valid, then MEASURE the pane and use that as its 'size'
+			size	= s.size = _parseSize(pane, o.size);
+			minSize	= _parseSize(pane,o.minSize) || 1;
+			maxSize	= _parseSize(pane,o.maxSize) || 100000;
+			if (size > 0) size = max(min(size, maxSize), minSize);
+
+			// state for border-panes
+			s.isClosed  = false; // true = pane is closed
+			s.isSliding = false; // true = pane is currently open by 'sliding' over adjacent panes
+			s.isResizing= false; // true = pane is in process of being resized
+			s.isHidden	= false; // true = pane is hidden - no spacing, resizer or toggler is visible!
+
+			// array for 'pin buttons' whose classNames are auto-updated on pane-open/-close
+			if (!s.pins) s.pins = [];
+		}
+		//	states common to ALL panes
+		s.tagName	= $P[0].tagName;
+		s.edge		= pane;		// useful if pane is (or about to be) 'swapped' - easy find out where it is (or is going)
+		s.noRoom	= false;	// true = pane 'automatically' hidden due to insufficient room - will unhide automatically
+		s.isVisible	= true;		// false = pane is invisible - closed OR hidden - simplify logic
+
+		// set css-position to account for container borders & padding
+		switch (pane) {
+			case "north": 	CSS.top 	= sC.insetTop;
+							CSS.left 	= sC.insetLeft;
+							CSS.right	= sC.insetRight;
+							break;
+			case "south": 	CSS.bottom	= sC.insetBottom;
+							CSS.left 	= sC.insetLeft;
+							CSS.right 	= sC.insetRight;
+							break;
+			case "west": 	CSS.left 	= sC.insetLeft; // top, bottom & height set by sizeMidPanes()
+							break;
+			case "east": 	CSS.right 	= sC.insetRight; // ditto
+							break;
+			case "center":	// top, left, width & height set by sizeMidPanes()
+		}
+
+		if (dir === "horz") // north or south pane
+			CSS.height = cssH($P, size);
+		else if (dir === "vert") // east or west pane
+			CSS.width = cssW($P, size);
+		//else if (isCenter) {}
+
+		$P.css(CSS); // apply size -- top, bottom & height will be set by sizeMidPanes
+		if (dir != "horz") sizeMidPanes(pane, true); // true = skipCallback
+
+		// close or hide the pane if specified in settings
+		if (o.initClosed && o.closable && !o.initHidden)
+			close(pane, true, true); // true, true = force, noAnimation
+		else if (o.initHidden || o.initClosed)
+			hide(pane); // will be completely invisible - no resizer or spacing
+		else if (!s.noRoom)
+			// make the pane visible - in case was initially hidden
+			$P.css("display","block");
+		// ELSE setAsOpen() - called later by initHandles()
+
+		// RESET visibility now - pane will appear IF display:block
+		$P.css("visibility","visible");
+
+		// check option for auto-handling of pop-ups & drop-downs
+		if (o.showOverflowOnHover)
+			$P.hover( allowOverflow, resetOverflow );
+
+		// if manually adding a pane AFTER layout initialization, then...
+		if (state.initialized) {
+			initHandles( pane );
+			initHotkeys( pane );
+			resizeAll(); // will sizeContent if pane is visible
+			if (s.isVisible) { // pane is OPEN
+				if (o.triggerEventsOnLoad)
+					_runCallbacks("onresize_end", pane);
+				else // automatic if onresize called, otherwise call it specifically
+					// resize child - IF inner-layout already exists (created before this layout)
+					resizeChildLayout(pane); // a previously existing childLayout
+			}
+			if (o.initChildLayout && o.childOptions)
+				createChildLayout(pane);
+		}
+	}
+
+	/**
+	* Initialize module objects, styling, size and position for all resize bars and toggler buttons
+	*
+	* @see  _create()
+	* @param {string=}	[panes=""]	The edge(s) to process
+	*/
+,	initHandles = function (panes) {
+		panes = panes ? panes.split(",") : _c.borderPanes;
+
+		// create toggler DIVs for each pane, and set object pointers for them, eg: $R.north = north toggler DIV
+		$.each(panes, function (i, pane) {
+			var $P		= $Ps[pane];
+			$Rs[pane]	= false; // INIT
+			$Ts[pane]	= false;
+			if (!$P) return; // pane does not exist - skip
+
+			var 
+				o		= options[pane]
+			,	s		= state[pane]
+			,	c		= _c[pane]
+			,	paneId	= o.paneSelector.substr(0,1) === "#" ? o.paneSelector.substr(1) : ""
+			,	rClass	= o.resizerClass
+			,	tClass	= o.togglerClass
+			,	side	= c.side.toLowerCase()
+			,	spacing	= (s.isVisible ? o.spacing_open : o.spacing_closed)
+			,	_pane	= "-"+ pane // used for classNames
+			,	_state	= (s.isVisible ? "-open" : "-closed") // used for classNames
+			,	I		= Instance[pane]
+				// INIT RESIZER BAR
+			,	$R		= I.resizer = $Rs[pane] = $("<div></div>")
+				// INIT TOGGLER BUTTON
+			,	$T		= I.toggler = (o.closable ? $Ts[pane] = $("<div></div>") : false)
+			;
+
+			//if (s.isVisible && o.resizable) ... handled by initResizable
+			if (!s.isVisible && o.slidable)
+				$R.attr("title", o.tips.Slide).css("cursor", o.sliderCursor);
+
+			$R	// if paneSelector is an ID, then create a matching ID for the resizer, eg: "#paneLeft" => "paneLeft-resizer"
+				.attr("id", paneId ? paneId +"-resizer" : "" )
+				.data({
+					parentLayout:	Instance
+				,	layoutPane:		Instance[pane]	// NEW pointer to pane-alias-object
+				,	layoutEdge:		pane
+				,	layoutRole:		"resizer"
+				})
+				.css(_c.resizers.cssReq).css("zIndex", options.zIndexes.resizer_normal)
+				.css(o.applyDemoStyles ? _c.resizers.cssDemo : {}) // add demo styles
+				.addClass(rClass +" "+ rClass+_pane)
+				.hover(addHover, removeHover) // ALWAYS add hover-classes, even if resizing is not enabled - handle with CSS instead
+				.hover(onResizerEnter, onResizerLeave) // ALWAYS NEED resizer.mouseleave to balance toggler.mouseenter
+				.appendTo($N) // append DIV to container
+			;
+
+			if ($T) {
+				$T	// if paneSelector is an ID, then create a matching ID for the resizer, eg: "#paneLeft" => "#paneLeft-toggler"
+					.attr("id", paneId ? paneId +"-toggler" : "" )
+					.data({
+						parentLayout:	Instance
+					,	layoutPane:		Instance[pane]	// NEW pointer to pane-alias-object
+					,	layoutEdge:		pane
+					,	layoutRole:		"toggler"
+					})
+					.css(_c.togglers.cssReq) // add base/required styles
+					.css(o.applyDemoStyles ? _c.togglers.cssDemo : {}) // add demo styles
+					.addClass(tClass +" "+ tClass+_pane)
+					.hover(addHover, removeHover) // ALWAYS add hover-classes, even if toggling is not enabled - handle with CSS instead
+					.bind("mouseenter", onResizerEnter) // NEED toggler.mouseenter because mouseenter MAY NOT fire on resizer
+					.appendTo($R) // append SPAN to resizer DIV
+				;
+				// ADD INNER-SPANS TO TOGGLER
+				if (o.togglerContent_open) // ui-layout-open
+					$("<span>"+ o.togglerContent_open +"</span>")
+						.data({
+							layoutEdge:		pane
+						,	layoutRole:		"togglerContent"
+						})
+						.data("layoutRole", "togglerContent")
+						.data("layoutEdge", pane)
+						.addClass("content content-open")
+						.css("display","none")
+						.appendTo( $T )
+						//.hover( addHover, removeHover ) // use ui-layout-toggler-west-hover .content-open instead!
+					;
+				if (o.togglerContent_closed) // ui-layout-closed
+					$("<span>"+ o.togglerContent_closed +"</span>")
+						.data({
+							layoutEdge:		pane
+						,	layoutRole:		"togglerContent"
+						})
+						.addClass("content content-closed")
+						.css("display","none")
+						.appendTo( $T )
+						//.hover( addHover, removeHover ) // use ui-layout-toggler-west-hover .content-closed instead!
+					;
+				// ADD TOGGLER.click/.hover
+				enableClosable(pane);
+			}
+
+			// add Draggable events
+			initResizable(pane);
+
+			// ADD CLASSNAMES & SLIDE-BINDINGS - eg: class="resizer resizer-west resizer-open"
+			if (s.isVisible)
+				setAsOpen(pane);	// onOpen will be called, but NOT onResize
+			else {
+				setAsClosed(pane);	// onClose will be called
+				bindStartSlidingEvent(pane, true); // will enable events IF option is set
+			}
+
+		});
+
+		// SET ALL HANDLE DIMENSIONS
+		sizeHandles();
+	}
+
+
+	/**
+	* Initialize scrolling ui-layout-content div - if exists
+	*
+	* @see  initPane() - or externally after an Ajax injection
+	* @param {string}	[pane]			The pane to process
+	* @param {boolean=}	[resize=true]	Size content after init
+	*/
+,	initContent = function (pane, resize) {
+		if (!isInitialized()) return;
+		var 
+			o	= options[pane]
+		,	sel	= o.contentSelector
+		,	I	= Instance[pane]
+		,	$P	= $Ps[pane]
+		,	$C
+		;
+		if (sel) $C = I.content = $Cs[pane] = (o.findNestedContent)
+			? $P.find(sel).eq(0) // match 1-element only
+			: $P.children(sel).eq(0)
+		;
+		if ($C && $C.length) {
+			$C.data("layoutRole", "content");
+			// SAVE original Pane CSS
+			if (!$C.data("layoutCSS"))
+				$C.data("layoutCSS", elCSS($C, "height"));
+			$C.css( _c.content.cssReq );
+			if (o.applyDemoStyles) {
+				$C.css( _c.content.cssDemo ); // add padding & overflow: auto to content-div
+				$P.css( _c.content.cssDemoPane ); // REMOVE padding/scrolling from pane
+			}
+			state[pane].content = {}; // init content state
+			if (resize !== false) sizeContent(pane);
+			// sizeContent() is called AFTER init of all elements
+		}
+		else
+			I.content = $Cs[pane] = false;
+	}
+
+
+	/**
+	* Add resize-bars to all panes that specify it in options
+	* -dependancy: $.fn.resizable - will skip if not found
+	*
+	* @see  _create()
+	* @param {string=}	[panes=""]	The edge(s) to process
+	*/
+,	initResizable = function (panes) {
+		var	draggingAvailable = $.layout.plugins.draggable
+		,	side // set in start()
+		;
+		panes = panes ? panes.split(",") : _c.borderPanes;
+
+		$.each(panes, function (idx, pane) {
+			var o = options[pane];
+			if (!draggingAvailable || !$Ps[pane] || !o.resizable) {
+				o.resizable = false;
+				return true; // skip to next
+			}
+
+			var s		= state[pane]
+			,	z		= options.zIndexes
+			,	c		= _c[pane]
+			,	side	= c.dir=="horz" ? "top" : "left"
+			,	opEdge	= _c.oppositeEdge[pane]
+			,	masks	=  pane +",center,"+ opEdge + (c.dir=="horz" ? ",west,east" : "")
+			,	$P 		= $Ps[pane]
+			,	$R		= $Rs[pane]
+			,	base	= o.resizerClass
+			,	lastPos	= 0 // used when live-resizing
+			,	r, live // set in start because may change
+			//	'drag' classes are applied to the ORIGINAL resizer-bar while dragging is in process
+			,	resizerClass		= base+"-drag"				// resizer-drag
+			,	resizerPaneClass	= base+"-"+pane+"-drag"		// resizer-north-drag
+			//	'helper' class is applied to the CLONED resizer-bar while it is being dragged
+			,	helperClass			= base+"-dragging"			// resizer-dragging
+			,	helperPaneClass		= base+"-"+pane+"-dragging" // resizer-north-dragging
+			,	helperLimitClass	= base+"-dragging-limit"	// resizer-drag
+			,	helperPaneLimitClass = base+"-"+pane+"-dragging-limit"	// resizer-north-drag
+			,	helperClassesSet	= false 					// logic var
+			;
+
+			if (!s.isClosed)
+				$R.attr("title", o.tips.Resize)
+				  .css("cursor", o.resizerCursor); // n-resize, s-resize, etc
+
+			$R.draggable({
+				containment:	$N[0] // limit resizing to layout container
+			,	axis:			(c.dir=="horz" ? "y" : "x") // limit resizing to horz or vert axis
+			,	delay:			0
+			,	distance:		1
+			,	grid:			o.resizingGrid
+			//	basic format for helper - style it using class: .ui-draggable-dragging
+			,	helper:			"clone"
+			,	opacity:		o.resizerDragOpacity
+			,	addClasses:		false // avoid ui-state-disabled class when disabled
+			//,	iframeFix:		o.draggableIframeFix // TODO: consider using when bug is fixed
+			,	zIndex:			z.resizer_drag
+
+			,	start: function (e, ui) {
+					// REFRESH options & state pointers in case we used swapPanes
+					o = options[pane];
+					s = state[pane];
+					// re-read options
+					live = o.livePaneResizing;
+
+					// ondrag_start callback - will CANCEL hide if returns false
+					// TODO: dragging CANNOT be cancelled like this, so see if there is a way?
+					if (false === _runCallbacks("ondrag_start", pane)) return false;
+
+					s.isResizing	= true; // prevent pane from closing while resizing
+					timer.clear(pane+"_closeSlider"); // just in case already triggered
+
+					// SET RESIZER LIMITS - used in drag()
+					setSizeLimits(pane); // update pane/resizer state
+					r = s.resizerPosition;
+					lastPos = ui.position[ side ]
+
+					$R.addClass( resizerClass +" "+ resizerPaneClass ); // add drag classes
+					helperClassesSet = false; // reset logic var - see drag()
+
+					// DISABLE TEXT SELECTION (probably already done by resizer.mouseOver)
+					$('body').disableSelection(); 
+
+					// MASK PANES CONTAINING IFRAMES, APPLETS OR OTHER TROUBLESOME ELEMENTS
+					showMasks( masks );
+				}
+
+			,	drag: function (e, ui) {
+					if (!helperClassesSet) { // can only add classes after clone has been added to the DOM
+						//$(".ui-draggable-dragging")
+						ui.helper
+							.addClass( helperClass +" "+ helperPaneClass ) // add helper classes
+							.css({ right: "auto", bottom: "auto" })	// fix dir="rtl" issue
+							.children().css("visibility","hidden")	// hide toggler inside dragged resizer-bar
+						;
+						helperClassesSet = true;
+						// draggable bug!? RE-SET zIndex to prevent E/W resize-bar showing through N/S pane!
+						if (s.isSliding) $Ps[pane].css("zIndex", z.pane_sliding);
+					}
+					// CONTAIN RESIZER-BAR TO RESIZING LIMITS
+					var limit = 0;
+					if (ui.position[side] < r.min) {
+						ui.position[side] = r.min;
+						limit = -1;
+					}
+					else if (ui.position[side] > r.max) {
+						ui.position[side] = r.max;
+						limit = 1;
+					}
+					// ADD/REMOVE dragging-limit CLASS
+					if (limit) {
+						ui.helper.addClass( helperLimitClass +" "+ helperPaneLimitClass ); // at dragging-limit
+						window.defaultStatus = (limit>0 && pane.match(/(north|west)/)) || (limit<0 && pane.match(/(south|east)/)) ? o.tips.maxSizeWarning : o.tips.minSizeWarning;
+					}
+					else {
+						ui.helper.removeClass( helperLimitClass +" "+ helperPaneLimitClass ); // not at dragging-limit
+						window.defaultStatus = "";
+					}
+					// DYNAMICALLY RESIZE PANES IF OPTION ENABLED
+					// won't trigger unless resizer has actually moved!
+					if (live && Math.abs(ui.position[side] - lastPos) >= o.liveResizingTolerance) {
+						lastPos = ui.position[side];
+						resizePanes(e, ui, pane)
+					}
+				}
+
+			,	stop: function (e, ui) {
+					$('body').enableSelection(); // RE-ENABLE TEXT SELECTION
+					window.defaultStatus = ""; // clear 'resizing limit' message from statusbar
+					$R.removeClass( resizerClass +" "+ resizerPaneClass ); // remove drag classes from Resizer
+					s.isResizing = false;
+					resizePanes(e, ui, pane, true, masks); // true = resizingDone
+				}
+
+			});
+		});
+
+		/**
+		* resizePanes
+		*
+		* Sub-routine called from stop() - and drag() if livePaneResizing
+		*
+		* @param {!Object}		evt
+		* @param {!Object}		ui
+		* @param {string}		pane
+		* @param {boolean=}		[resizingDone=false]
+		*/
+		var resizePanes = function (evt, ui, pane, resizingDone, masks) {
+			var	dragPos	= ui.position
+			,	c		= _c[pane]
+			,	o		= options[pane]
+			,	s		= state[pane]
+			,	resizerPos
+			;
+			switch (pane) {
+				case "north":	resizerPos = dragPos.top; break;
+				case "west":	resizerPos = dragPos.left; break;
+				case "south":	resizerPos = sC.offsetHeight - dragPos.top  - o.spacing_open; break;
+				case "east":	resizerPos = sC.offsetWidth  - dragPos.left - o.spacing_open; break;
+			};
+			// remove container margin from resizer position to get the pane size
+			var newSize = resizerPos - sC["inset"+ c.side];
+
+			// Disable OR Resize Mask(s) created in drag.start
+			if (!resizingDone) {
+				// ensure we meet liveResizingTolerance criteria
+				if (Math.abs(newSize - s.size) < o.liveResizingTolerance)
+					return; // SKIP resize this time
+				// resize the pane
+				manualSizePane(pane, newSize, false, true); // true = noAnimation
+				sizeMasks(); // resize all visible masks
+			}
+			else { // resizingDone
+				// ondrag_end callback
+				if (false !== _runCallbacks("ondrag_end", pane))
+					manualSizePane(pane, newSize, false, true); // true = noAnimation
+				hideMasks(); // hide all masks, which include panes with 'content/iframe-masks'
+				if (s.isSliding && masks) // RE-SHOW only 'object-masks' so objects won't show through sliding pane
+					showMasks( masks, true ); // true = onlyForObjects
+			}
+		};
+	}
+
+	/**
+	 *	sizeMask
+	 *
+	 *	Needed to overlay a DIV over an IFRAME-pane because mask CANNOT be *inside* the pane
+	 *	Called when mask created, and during livePaneResizing
+	 */
+,	sizeMask = function () {
+		var $M		= $(this)
+		,	pane	= $M.data("layoutMask") // eg: "west"
+		,	s		= state[pane]
+		;
+		// only masks over an IFRAME-pane need manual resizing
+		if (s.tagName == "IFRAME" && s.isVisible) // no need to mask closed/hidden panes
+			$M.css({
+				top:	s.offsetTop
+			,	left:	s.offsetLeft
+			,	width:	s.outerWidth
+			,	height:	s.outerHeight
+			});
+		/* ALT Method...
+		var $P = $Ps[pane];
+		$M.css( $P.position() ).css({ width: $P[0].offsetWidth, height: $P[0].offsetHeight });
+		*/
+	}
+,	sizeMasks = function () {
+		$Ms.each( sizeMask ); // resize all 'visible' masks
+	}
+
+,	showMasks = function (panes, onlyForObjects) {
+		var a	= panes ? panes.split(",") : $.layout.config.allPanes
+		,	z	= options.zIndexes
+		,	o, s;
+		$.each(a, function(i,p){
+			s = state[p];
+			o = options[p];
+			if (s.isVisible && ( (!onlyForObjects && o.maskContents) || o.maskObjects )) {
+				getMasks(p).each(function(){
+					sizeMask.call(this);
+					this.style.zIndex = s.isSliding ? z.pane_sliding+1 : z.pane_normal+1
+					this.style.display = "block";
+				});
+			}
+		});
+	}
+
+,	hideMasks = function () {
+		// ensure no pane is resizing - could be a timing issue
+		var skip;
+		$.each( $.layout.config.borderPanes, function(i,p){
+			if (state[p].isResizing) {
+				skip = true;
+				return false; // BREAK
+			}
+		});
+		if (!skip)
+			$Ms.hide(); // hide ALL masks
+	}
+
+,	getMasks = function (pane) {
+		var $Masks	= $([])
+		,	$M, i = 0, c = $Ms.length
+		;
+		for (; i<c; i++) {
+			$M = $Ms.eq(i);
+			if ($M.data("layoutMask") === pane)
+				$Masks = $Masks.add( $M );
+		}
+		if ($Masks.length)
+			return $Masks;
+		else
+			return createMasks(pane);
+	}
+
+	/**
+	 *	createMasks
+	 *
+	 *	Generates both DIV (ALWAYS used) and IFRAME (optional) elements as masks
+	 *	An IFRAME mask is created *under* the DIV when maskObjects=true, because a DIV cannot mask an applet
+	 */
+,	createMasks = function (pane) {
+		var
+			$P		= $Ps[pane]
+		,	s		= state[pane]
+		,	o		= options[pane]
+		,	z		= options.zIndexes
+		//,	objMask	= o.maskObjects && s.tagName != "IFRAME" // check for option
+		,	$Masks	= $([])
+		,	isIframe, el, $M, css, i
+		;
+		if (!o.maskContents && !o.maskObjects) return $Masks;
+		// if o.maskObjects=true, then loop TWICE to create BOTH kinds of mask, else only create a DIV
+		for (i=0; i < (o.maskObjects ? 2 : 1); i++) {
+			isIframe = o.maskObjects && i==0;
+			el = document.createElement( isIframe ? "iframe" : "div" );
+			$M = $(el).data("layoutMask", pane); // add data to relate mask to pane
+			el.className = "ui-layout-mask ui-layout-mask-"+ pane; // for user styling
+			css = el.style;
+			// styles common to both DIVs and IFRAMES
+			css.display		= "block";
+			css.position	= "absolute";
+			if (isIframe) { // IFRAME-only props
+				el.frameborder = 0;
+				el.src		= "about:blank";
+				css.opacity	= 0;
+				css.filter	= "Alpha(Opacity='0')";
+				css.border	= 0;
+			}
+			// if pane is an IFRAME, then must mask the pane itself
+			if (s.tagName == "IFRAME") {
+				// NOTE sizing done by a subroutine so can be called during live-resizing
+				css.zIndex	= z.pane_normal+1; // 1-higher than pane
+				$N.append( el ); // append to LAYOUT CONTAINER
+			}
+			// otherwise put masks *inside the pane* to mask its contents
+			else {
+				$M.addClass("ui-layout-mask-inside-pane");
+				css.zIndex	= o.maskZindex || z.content_mask; // usually 1, but customizable
+				css.top		= 0;
+				css.left	= 0;
+				css.width	= "100%";
+				css.height	= "100%";
+				$P.append( el ); // append INSIDE pane element
+			}
+			// add to return object
+			$Masks = $Masks.add( el );
+			// add Mask to cached array so can be resized & reused
+			$Ms = $Ms.add( el );
+		}
+		return $Masks;
+	}
+
+
+	/**
+	* Destroy this layout and reset all elements
+	*
+	* @param {boolean=}	[destroyChildren=false]		Destory Child-Layouts first?
+	*/
+,	destroy = function (evt_or_destroyChildren, destroyChildren) {
+		// UNBIND layout events and remove global object
+		$(window).unbind("."+ sID);		// resize & unload
+		$(document).unbind("."+ sID);	// keyDown (hotkeys)
+
+		if (typeof evt_or_destroyChildren === "object")
+			// stopPropagation if called by trigger("layoutdestroy") - use evtPane utility 
+			evtPane(evt_or_destroyChildren);
+		else // no event, so transfer 1st param to destroyChildren param
+			destroyChildren = evt_or_destroyChildren;
+
+		// need to look for parent layout BEFORE we remove the container data, else skips a level
+		//var parentPane = Instance.hasParentLayout ? $.layout.getParentPaneInstance( $N ) : null;
+
+		// reset layout-container
+		$N	.clearQueue()
+			.removeData("layout")
+			.removeData("layoutContainer")
+			.removeClass(options.containerClass)
+			.unbind("."+ sID) // remove ALL Layout events
+		;
+
+		// remove all mask elements that have been created
+		$Ms.remove();
+
+		// loop all panes to remove layout classes, attributes and bindings
+		$.each(_c.allPanes, function (i, pane) {
+			removePane( pane, false, true, destroyChildren ); // true = skipResize
+		});
+
+		// do NOT reset container CSS if is a 'pane' (or 'content') in an outer-layout - ie, THIS layout is 'nested'
+		var css = "layoutCSS";
+		if ($N.data(css) && !$N.data("layoutRole")) // RESET CSS
+			$N.css( $N.data(css) ).removeData(css);
+
+		// for full-page layouts, also reset the <HTML> CSS
+		if (sC.tagName === "BODY" && ($N = $("html")).data(css)) // RESET <HTML> CSS
+			$N.css( $N.data(css) ).removeData(css);
+
+		// trigger plugins for this layout, if there are any
+		runPluginCallbacks( Instance, $.layout.onDestroy );
+
+		// trigger state-management and onunload callback
+		unload();
+
+		// clear the Instance of everything except for container & options (so could recreate)
+		// RE-CREATE: myLayout = myLayout.container.layout( myLayout.options );
+		for (n in Instance)
+			if (!n.match(/^(container|options)$/)) delete Instance[ n ];
+		// add a 'destroyed' flag to make it easy to check
+		Instance.destroyed = true;
+
+		// if this is a child layout, CLEAR the child-pointer in the parent
+		/* for now the pointer REMAINS, but with only container, options and destroyed keys
+		if (parentPane) {
+			var layout = parentPane.pane.data("parentLayout");
+			parentPane.child = layout.children[ parentPane.name ] = null;
+		}
+		*/
+
+		return Instance; // for coding convenience
+	}
+
+	/**
+	* Remove a pane from the layout - subroutine of destroy()
+	*
+	* @see  destroy()
+	* @param {string|Object}	evt_or_pane			The pane to process
+	* @param {boolean=}			[remove=false]		Remove the DOM element?
+	* @param {boolean=}			[skipResize=false]	Skip calling resizeAll()?
+	* @param {boolean=}			[destroyChild=true]	Destroy Child-layouts? If not passed, obeys options setting
+	*/
+,	removePane = function (evt_or_pane, remove, skipResize, destroyChild) {
+		if (!isInitialized()) return;
+		var	pane = evtPane.call(this, evt_or_pane)
+		,	$P	= $Ps[pane]
+		,	$C	= $Cs[pane]
+		,	$R	= $Rs[pane]
+		,	$T	= $Ts[pane]
+		;
+		// NOTE: elements can still exist even after remove()
+		//		so check for missing data(), which is cleared by removed()
+		if ($P && $.isEmptyObject( $P.data() )) $P = false;
+		if ($C && $.isEmptyObject( $C.data() )) $C = false;
+		if ($R && $.isEmptyObject( $R.data() )) $R = false;
+		if ($T && $.isEmptyObject( $T.data() )) $T = false;
+
+		if ($P) $P.stop(true, true);
+
+		//	check for a child layout
+		var	o	= options[pane]
+		,	s	= state[pane]
+		,	d	= "layout"
+		,	css	= "layoutCSS"
+		,	child	= children[pane] || ($P ? $P.data(d) : 0) || ($C ? $C.data(d) : 0) || null
+		,	destroy	= destroyChild !== undefined ? destroyChild : o.destroyChildLayout
+		;
+
+		// FIRST destroy the child-layout(s)
+		if (destroy && child && !child.destroyed) {
+			child.destroy(true);	// tell child-layout to destroy ALL its child-layouts too
+			if (child.destroyed)	// destroy was successful
+				child = null;		// clear pointer for logic below 
+		}
+
+		if ($P && remove && !child)
+			$P.remove();
+		else if ($P && $P[0]) {
+			//	create list of ALL pane-classes that need to be removed
+			var	root	= o.paneClass // default="ui-layout-pane"
+			,	pRoot	= root +"-"+ pane // eg: "ui-layout-pane-west"
+			,	_open	= "-open"
+			,	_sliding= "-sliding"
+			,	_closed	= "-closed"
+			,	classes	= [	root, root+_open, root+_closed, root+_sliding,		// generic classes
+							pRoot, pRoot+_open, pRoot+_closed, pRoot+_sliding ]	// pane-specific classes
+			;
+			$.merge(classes, getHoverClasses($P, true)); // ADD hover-classes
+			// remove all Layout classes from pane-element
+			$P	.removeClass( classes.join(" ") ) // remove ALL pane-classes
+				.removeData("parentLayout")
+				.removeData("layoutPane")
+				.removeData("layoutRole")
+				.removeData("layoutEdge")
+				.removeData("autoHidden")	// in case set
+				.unbind("."+ sID) // remove ALL Layout events
+				// TODO: remove these extra unbind commands when jQuery is fixed
+				//.unbind("mouseenter"+ sID)
+				//.unbind("mouseleave"+ sID)
+			;
+			// do NOT reset CSS if this pane/content is STILL the container of a nested layout!
+			// the nested layout will reset its 'container' CSS when/if it is destroyed
+			if ($C && $C.data(d)) {
+				// a content-div may not have a specific width, so give it one to contain the Layout
+				$C.width( $C.width() );
+				child.resizeAll(); // now resize the Layout
+			}
+			else if ($C)
+				$C.css( $C.data(css) ).removeData(css).removeData("layoutRole");
+			// remove pane AFTER content in case there was a nested layout
+			if (!$P.data(d))
+				$P.css( $P.data(css) ).removeData(css);
+		}
+
+		// REMOVE pane resizer and toggler elements
+		if ($T) $T.remove();
+		if ($R) $R.remove();
+
+		// CLEAR all pointers and state data
+		Instance[pane] = $Ps[pane] = $Cs[pane] = $Rs[pane] = $Ts[pane] = children[pane] = false;
+		s = { removed: true };
+
+		if (!skipResize)
+			resizeAll();
+	}
+
+
+/*
+ * ###########################
+ *	   ACTION METHODS
+ * ###########################
+ */
+
+,	_hidePane = function (pane) {
+		var $P	= $Ps[pane]
+		,	o	= options[pane]
+		,	s	= $P[0].style
+		;
+		if (o.useOffscreenClose) {
+			if (!$P.data(_c.offscreenReset))
+				$P.data(_c.offscreenReset, { left: s.left, right: s.right });
+			$P.css( _c.offscreenCSS );
+		}
+		else
+			$P.hide().removeData(_c.offscreenReset);
+	}
+
+,	_showPane = function (pane) {
+		var $P	= $Ps[pane]
+		,	o	= options[pane]
+		,	off	= _c.offscreenCSS
+		,	old	= $P.data(_c.offscreenReset)
+		,	s	= $P[0].style
+		;
+		$P	.show() // ALWAYS show, just in case
+			.removeData(_c.offscreenReset);
+		if (o.useOffscreenClose && old) {
+			if (s.left == off.left)
+				s.left = old.left;
+			if (s.right == off.right)
+				s.right = old.right;
+		}
+	}
+
+
+	/**
+	* Completely 'hides' a pane, including its spacing - as if it does not exist
+	* The pane is not actually 'removed' from the source, so can use 'show' to un-hide it
+	*
+	* @param {string|Object}	evt_or_pane			The pane being hidden, ie: north, south, east, or west
+	* @param {boolean=}			[noAnimation=false]	
+	*/
+,	hide = function (evt_or_pane, noAnimation) {
+		if (!isInitialized()) return;
+		var	pane = evtPane.call(this, evt_or_pane)
+		,	o	= options[pane]
+		,	s	= state[pane]
+		,	$P	= $Ps[pane]
+		,	$R	= $Rs[pane]
+		;
+		if (!$P || s.isHidden) return; // pane does not exist OR is already hidden
+
+		// onhide_start callback - will CANCEL hide if returns false
+		if (state.initialized && false === _runCallbacks("onhide_start", pane)) return;
+
+		s.isSliding = false; // just in case
+
+		// now hide the elements
+		if ($R) $R.hide(); // hide resizer-bar
+		if (!state.initialized || s.isClosed) {
+			s.isClosed = true; // to trigger open-animation on show()
+			s.isHidden  = true;
+			s.isVisible = false;
+			if (!state.initialized)
+				_hidePane(pane); // no animation when loading page
+			sizeMidPanes(_c[pane].dir === "horz" ? "" : "center");
+			if (state.initialized || o.triggerEventsOnLoad)
+				_runCallbacks("onhide_end", pane);
+		}
+		else {
+			s.isHiding = true; // used by onclose
+			close(pane, false, noAnimation); // adjust all panes to fit
+		}
+	}
+
+	/**
+	* Show a hidden pane - show as 'closed' by default unless openPane = true
+	*
+	* @param {string|Object}	evt_or_pane			The pane being opened, ie: north, south, east, or west
+	* @param {boolean=}			[openPane=false]
+	* @param {boolean=}			[noAnimation=false]
+	* @param {boolean=}			[noAlert=false]
+	*/
+,	show = function (evt_or_pane, openPane, noAnimation, noAlert) {
+		if (!isInitialized()) return;
+		var	pane = evtPane.call(this, evt_or_pane)
+		,	o	= options[pane]
+		,	s	= state[pane]
+		,	$P	= $Ps[pane]
+		,	$R	= $Rs[pane]
+		;
+		if (!$P || !s.isHidden) return; // pane does not exist OR is not hidden
+
+		// onshow_start callback - will CANCEL show if returns false
+		if (false === _runCallbacks("onshow_start", pane)) return;
+
+		s.isSliding = false; // just in case
+		s.isShowing = true; // used by onopen/onclose
+		//s.isHidden  = false; - will be set by open/close - if not cancelled
+
+		// now show the elements
+		//if ($R) $R.show(); - will be shown by open/close
+		if (openPane === false)
+			close(pane, true); // true = force
+		else
+			open(pane, false, noAnimation, noAlert); // adjust all panes to fit
+	}
+
+
+	/**
+	* Toggles a pane open/closed by calling either open or close
+	*
+	* @param {string|Object}	evt_or_pane		The pane being toggled, ie: north, south, east, or west
+	* @param {boolean=}			[slide=false]
+	*/
+,	toggle = function (evt_or_pane, slide) {
+		if (!isInitialized()) return;
+		var	evt		= evtObj(evt_or_pane)
+		,	pane	= evtPane.call(this, evt_or_pane)
+		,	s		= state[pane]
+		;
+		if (evt) // called from to $R.dblclick OR triggerPaneEvent
+			evt.stopImmediatePropagation();
+		if (s.isHidden)
+			show(pane); // will call 'open' after unhiding it
+		else if (s.isClosed)
+			open(pane, !!slide);
+		else
+			close(pane);
+	}
+
+
+	/**
+	* Utility method used during init or other auto-processes
+	*
+	* @param {string}	pane   The pane being closed
+	* @param {boolean=}	[setHandles=false]
+	*/
+,	_closePane = function (pane, setHandles) {
+		var
+			$P	= $Ps[pane]
+		,	s	= state[pane]
+		;
+		_hidePane(pane);
+		s.isClosed = true;
+		s.isVisible = false;
+		// UNUSED: if (setHandles) setAsClosed(pane, true); // true = force
+	}
+
+	/**
+	* Close the specified pane (animation optional), and resize all other panes as needed
+	*
+	* @param {string|Object}	evt_or_pane			The pane being closed, ie: north, south, east, or west
+	* @param {boolean=}			[force=false]
+	* @param {boolean=}			[noAnimation=false]
+	* @param {boolean=}			[skipCallback=false]
+	*/
+,	close = function (evt_or_pane, force, noAnimation, skipCallback) {
+		var	pane = evtPane.call(this, evt_or_pane);
+		// if pane has been initialized, but NOT the complete layout, close pane instantly
+		if (!state.initialized && $Ps[pane]) {
+			_closePane(pane); // INIT pane as closed
+			return;
+		}
+		if (!isInitialized()) return;
+
+		var
+			$P	= $Ps[pane]
+		,	$R	= $Rs[pane]
+		,	$T	= $Ts[pane]
+		,	o	= options[pane]
+		,	s	= state[pane]
+		,	c	= _c[pane]
+		,	doFX, isShowing, isHiding, wasSliding;
+
+		// QUEUE in case another action/animation is in progress
+		$N.queue(function( queueNext ){
+	
+			if ( !$P
+			||	(!o.closable && !s.isShowing && !s.isHiding)	// invalid request // (!o.resizable && !o.closable) ???
+			||	(!force && s.isClosed && !s.isShowing)			// already closed
+			) return queueNext();
+
+			// onclose_start callback - will CANCEL hide if returns false
+			// SKIP if just 'showing' a hidden pane as 'closed'
+			var abort = !s.isShowing && false === _runCallbacks("onclose_start", pane);
+
+			// transfer logic vars to temp vars
+			isShowing	= s.isShowing;
+			isHiding	= s.isHiding;
+			wasSliding	= s.isSliding;
+			// now clear the logic vars (REQUIRED before aborting)
+			delete s.isShowing;
+			delete s.isHiding;
+
+			if (abort) return queueNext();
+
+			doFX		= !noAnimation && !s.isClosed && (o.fxName_close != "none");
+			s.isMoving	= true;
+			s.isClosed	= true;
+			s.isVisible	= false;
+			// update isHidden BEFORE sizing panes
+			if (isHiding) s.isHidden = true;
+			else if (isShowing) s.isHidden = false;
+
+			if (s.isSliding) // pane is being closed, so UNBIND trigger events
+				bindStopSlidingEvents(pane, false); // will set isSliding=false
+			else // resize panes adjacent to this one
+				sizeMidPanes(_c[pane].dir === "horz" ? "" : "center", false); // false = NOT skipCallback
+
+			// if this pane has a resizer bar, move it NOW - before animation
+			setAsClosed(pane);
+
+			// CLOSE THE PANE
+			if (doFX) { // animate the close
+				// mask panes with objects
+				var masks = "center"+ (c.dir=="horz" ? ",west,east" : "");
+				showMasks( masks, true );	// true = ONLY mask panes with maskObjects=true
+				lockPaneForFX(pane, true);	// need to set left/top so animation will work
+				$P.hide( o.fxName_close, o.fxSettings_close, o.fxSpeed_close, function () {
+					lockPaneForFX(pane, false); // undo
+					if (s.isClosed) close_2();
+					queueNext();
+				});
+			}
+			else { // hide the pane without animation
+				_hidePane(pane);
+				close_2();
+				queueNext();
+			};
+		});
+
+		// SUBROUTINE
+		function close_2 () {
+			s.isMoving	= false;
+			bindStartSlidingEvent(pane, true); // will enable if o.slidable = true
+
+			// if opposite-pane was autoClosed, see if it can be autoOpened now
+			var altPane = _c.oppositeEdge[pane];
+			if (state[ altPane ].noRoom) {
+				setSizeLimits( altPane );
+				makePaneFit( altPane );
+			}
+
+			// hide any masks shown while closing
+			hideMasks();
+
+			if (!skipCallback && (state.initialized || o.triggerEventsOnLoad)) {
+				// onclose callback - UNLESS just 'showing' a hidden pane as 'closed'
+				if (!isShowing)	_runCallbacks("onclose_end", pane);
+				// onhide OR onshow callback
+				if (isShowing)	_runCallbacks("onshow_end", pane);
+				if (isHiding)	_runCallbacks("onhide_end", pane);
+			}
+		}
+	}
+
+	/**
+	* @param {string}	pane	The pane just closed, ie: north, south, east, or west
+	*/
+,	setAsClosed = function (pane) {
+		var
+			$P		= $Ps[pane]
+		,	$R		= $Rs[pane]
+		,	$T		= $Ts[pane]
+		,	o		= options[pane]
+		,	s		= state[pane]
+		,	side	= _c[pane].side.toLowerCase()
+		,	inset	= "inset"+ _c[pane].side
+		,	rClass	= o.resizerClass
+		,	tClass	= o.togglerClass
+		,	_pane	= "-"+ pane // used for classNames
+		,	_open	= "-open"
+		,	_sliding= "-sliding"
+		,	_closed	= "-closed"
+		;
+		$R
+			.css(side, sC[inset]) // move the resizer
+			.removeClass( rClass+_open +" "+ rClass+_pane+_open )
+			.removeClass( rClass+_sliding +" "+ rClass+_pane+_sliding )
+			.addClass( rClass+_closed +" "+ rClass+_pane+_closed )
+			.unbind("dblclick."+ sID)
+		;
+		// DISABLE 'resizing' when closed - do this BEFORE bindStartSlidingEvent?
+		if (o.resizable && $.layout.plugins.draggable)
+			$R
+				.draggable("disable")
+				.removeClass("ui-state-disabled") // do NOT apply disabled styling - not suitable here
+				.css("cursor", "default")
+				.attr("title","")
+			;
+
+		// if pane has a toggler button, adjust that too
+		if ($T) {
+			$T
+				.removeClass( tClass+_open +" "+ tClass+_pane+_open )
+				.addClass( tClass+_closed +" "+ tClass+_pane+_closed )
+				.attr("title", o.tips.Open) // may be blank
+			;
+			// toggler-content - if exists
+			$T.children(".content-open").hide();
+			$T.children(".content-closed").css("display","block");
+		}
+
+		// sync any 'pin buttons'
+		syncPinBtns(pane, false);
+
+		if (state.initialized) {
+			// resize 'length' and position togglers for adjacent panes
+			sizeHandles();
+		}
+	}
+
+	/**
+	* Open the specified pane (animation optional), and resize all other panes as needed
+	*
+	* @param {string|Object}	evt_or_pane			The pane being opened, ie: north, south, east, or west
+	* @param {boolean=}			[slide=false]
+	* @param {boolean=}			[noAnimation=false]
+	* @param {boolean=}			[noAlert=false]
+	*/
+,	open = function (evt_or_pane, slide, noAnimation, noAlert) {
+		if (!isInitialized()) return;
+		var	pane = evtPane.call(this, evt_or_pane)
+		,	$P	= $Ps[pane]
+		,	$R	= $Rs[pane]
+		,	$T	= $Ts[pane]
+		,	o	= options[pane]
+		,	s	= state[pane]
+		,	c	= _c[pane]
+		,	doFX, isShowing
+		;
+		// QUEUE in case another action/animation is in progress
+		$N.queue(function( queueNext ){
+
+			if ( !$P
+			||	(!o.resizable && !o.closable && !s.isShowing)	// invalid request
+			||	(s.isVisible && !s.isSliding)					// already open
+			) return queueNext();
+
+			// pane can ALSO be unhidden by just calling show(), so handle this scenario
+			if (s.isHidden && !s.isShowing) {
+				queueNext(); // call before show() because it needs the queue free
+				show(pane, true);
+				return;
+			}
+
+			if (o.autoResize && s.size != o.size) // resize pane to original size set in options
+				sizePane(pane, o.size, true, true, true); // true=skipCallback/forceResize/noAnimation
+			else
+				// make sure there is enough space available to open the pane
+				setSizeLimits(pane, slide);
+
+			// onopen_start callback - will CANCEL open if returns false
+			var cbReturn = _runCallbacks("onopen_start", pane);
+
+			if (cbReturn === "abort")
+				return queueNext();
+
+			// update pane-state again in case options were changed in onopen_start
+			if (cbReturn !== "NC") // NC = "No Callback"
+				setSizeLimits(pane, slide);
+
+			if (s.minSize > s.maxSize) { // INSUFFICIENT ROOM FOR PANE TO OPEN!
+				syncPinBtns(pane, false); // make sure pin-buttons are reset
+				if (!noAlert && o.tips.noRoomToOpen)
+					alert(o.tips.noRoomToOpen);
+				return queueNext(); // ABORT
+			}
+
+			if (slide) // START Sliding - will set isSliding=true
+				bindStopSlidingEvents(pane, true); // BIND trigger events to close sliding-pane
+			else if (s.isSliding) // PIN PANE (stop sliding) - open pane 'normally' instead
+				bindStopSlidingEvents(pane, false); // UNBIND trigger events - will set isSliding=false
+			else if (o.slidable)
+				bindStartSlidingEvent(pane, false); // UNBIND trigger events
+
+			s.noRoom = false; // will be reset by makePaneFit if 'noRoom'
+			makePaneFit(pane);
+
+			// transfer logic var to temp var
+			isShowing = s.isShowing;
+			// now clear the logic var
+			delete s.isShowing;
+
+			doFX		= !noAnimation && s.isClosed && (o.fxName_open != "none");
+			s.isMoving	= true;
+			s.isVisible	= true;
+			s.isClosed	= false;
+			// update isHidden BEFORE sizing panes - WHY??? Old?
+			if (isShowing) s.isHidden = false;
+
+			if (doFX) { // ANIMATE
+				// mask panes with objects
+				var masks = "center"+ (c.dir=="horz" ? ",west,east" : "");
+				if (s.isSliding) masks += ","+ _c.oppositeEdge[pane];
+				showMasks( masks, true );	// true = ONLY mask panes with maskObjects=true
+				lockPaneForFX(pane, true);	// need to set left/top so animation will work
+				$P.show( o.fxName_open, o.fxSettings_open, o.fxSpeed_open, function() {
+					lockPaneForFX(pane, false); // undo
+					if (s.isVisible) open_2(); // continue
+					queueNext();
+				});
+			}
+			else { // no animation
+				_showPane(pane);// just show pane and...
+				open_2();		// continue
+				queueNext();
+			};
+		});
+
+		// SUBROUTINE
+		function open_2 () {
+			s.isMoving	= false;
+
+			// cure iframe display issues
+			_fixIframe(pane);
+
+			// NOTE: if isSliding, then other panes are NOT 'resized'
+			if (!s.isSliding) { // resize all panes adjacent to this one
+				hideMasks(); // remove any masks shown while opening
+				sizeMidPanes(_c[pane].dir=="vert" ? "center" : "", false); // false = NOT skipCallback
+			}
+
+			// set classes, position handles and execute callbacks...
+			setAsOpen(pane);
+		};
+	
+	}
+
+	/**
+	* @param {string}	pane		The pane just opened, ie: north, south, east, or west
+	* @param {boolean=}	[skipCallback=false]
+	*/
+,	setAsOpen = function (pane, skipCallback) {
+		var 
+			$P		= $Ps[pane]
+		,	$R		= $Rs[pane]
+		,	$T		= $Ts[pane]
+		,	o		= options[pane]
+		,	s		= state[pane]
+		,	side	= _c[pane].side.toLowerCase()
+		,	inset	= "inset"+ _c[pane].side
+		,	rClass	= o.resizerClass
+		,	tClass	= o.togglerClass
+		,	_pane	= "-"+ pane // used for classNames
+		,	_open	= "-open"
+		,	_closed	= "-closed"
+		,	_sliding= "-sliding"
+		;
+		$R
+			.css(side, sC[inset] + getPaneSize(pane)) // move the resizer
+			.removeClass( rClass+_closed +" "+ rClass+_pane+_closed )
+			.addClass( rClass+_open +" "+ rClass+_pane+_open )
+		;
+		if (s.isSliding)
+			$R.addClass( rClass+_sliding +" "+ rClass+_pane+_sliding )
+		else // in case 'was sliding'
+			$R.removeClass( rClass+_sliding +" "+ rClass+_pane+_sliding )
+
+		if (o.resizerDblClickToggle)
+			$R.bind("dblclick", toggle );
+		removeHover( 0, $R ); // remove hover classes
+		if (o.resizable && $.layout.plugins.draggable)
+			$R	.draggable("enable")
+				.css("cursor", o.resizerCursor)
+				.attr("title", o.tips.Resize);
+		else if (!s.isSliding)
+			$R.css("cursor", "default"); // n-resize, s-resize, etc
+
+		// if pane also has a toggler button, adjust that too
+		if ($T) {
+			$T	.removeClass( tClass+_closed +" "+ tClass+_pane+_closed )
+				.addClass( tClass+_open +" "+ tClass+_pane+_open )
+				.attr("title", o.tips.Close); // may be blank
+			removeHover( 0, $T ); // remove hover classes
+			// toggler-content - if exists
+			$T.children(".content-closed").hide();
+			$T.children(".content-open").css("display","block");
+		}
+
+		// sync any 'pin buttons'
+		syncPinBtns(pane, !s.isSliding);
+
+		// update pane-state dimensions - BEFORE resizing content
+		$.extend(s, elDims($P));
+
+		if (state.initialized) {
+			// resize resizer & toggler sizes for all panes
+			sizeHandles();
+			// resize content every time pane opens - to be sure
+			sizeContent(pane, true); // true = remeasure headers/footers, even if 'pane.isMoving'
+		}
+
+		if (!skipCallback && (state.initialized || o.triggerEventsOnLoad) && $P.is(":visible")) {
+			// onopen callback
+			_runCallbacks("onopen_end", pane);
+			// onshow callback - TODO: should this be here?
+			if (s.isShowing) _runCallbacks("onshow_end", pane);
+
+			// ALSO call onresize because layout-size *may* have changed while pane was closed
+			if (state.initialized)
+				_runCallbacks("onresize_end", pane);
+		}
+
+		// TODO: Somehow sizePane("north") is being called after this point???
+	}
+
+
+	/**
+	* slideOpen / slideClose / slideToggle
+	*
+	* Pass-though methods for sliding
+	*/
+,	slideOpen = function (evt_or_pane) {
+		if (!isInitialized()) return;
+		var	evt		= evtObj(evt_or_pane)
+		,	pane	= evtPane.call(this, evt_or_pane)
+		,	s		= state[pane]
+		,	delay	= options[pane].slideDelay_open
+		;
+		// prevent event from triggering on NEW resizer binding created below
+		if (evt) evt.stopImmediatePropagation();
+
+		if (s.isClosed && evt && evt.type === "mouseenter" && delay > 0)
+			// trigger = mouseenter - use a delay
+			timer.set(pane+"_openSlider", open_NOW, delay);
+		else
+			open_NOW(); // will unbind events if is already open
+
+		/**
+		* SUBROUTINE for timed open
+		*/
+		function open_NOW () {
+			if (!s.isClosed) // skip if no longer closed!
+				bindStopSlidingEvents(pane, true); // BIND trigger events to close sliding-pane
+			else if (!s.isMoving)
+				open(pane, true); // true = slide - open() will handle binding
+		};
+	}
+
+,	slideClose = function (evt_or_pane) {
+		if (!isInitialized()) return;
+		var	evt		= evtObj(evt_or_pane)
+		,	pane	= evtPane.call(this, evt_or_pane)
+		,	o		= options[pane]
+		,	s		= state[pane]
+		,	delay	= s.isMoving ? 1000 : 300 // MINIMUM delay - option may override
+		;
+		if (s.isClosed || s.isResizing)
+			return; // skip if already closed OR in process of resizing
+		else if (o.slideTrigger_close === "click")
+			close_NOW(); // close immediately onClick
+		else if (o.preventQuickSlideClose && s.isMoving)
+			return; // handle Chrome quick-close on slide-open
+		else if (o.preventPrematureSlideClose && evt && $.layout.isMouseOverElem(evt, $Ps[pane]))
+			return; // handle incorrect mouseleave trigger, like when over a SELECT-list in IE
+		else if (evt) // trigger = mouseleave - use a delay
+			// 1 sec delay if 'opening', else .3 sec
+			timer.set(pane+"_closeSlider", close_NOW, max(o.slideDelay_close, delay));
+		else // called programically
+			close_NOW();
+
+		/**
+		* SUBROUTINE for timed close
+		*/
+		function close_NOW () {
+			if (s.isClosed) // skip 'close' if already closed!
+				bindStopSlidingEvents(pane, false); // UNBIND trigger events - TODO: is this needed here?
+			else if (!s.isMoving)
+				close(pane); // close will handle unbinding
+		};
+	}
+
+	/**
+	* @param {string|Object}	evt_or_pane		The pane being opened, ie: north, south, east, or west
+	*/
+,	slideToggle = function (evt_or_pane) {
+		var pane = evtPane.call(this, evt_or_pane);
+		toggle(pane, true);
+	}
+
+
+	/**
+	* Must set left/top on East/South panes so animation will work properly
+	*
+	* @param {string}	pane	The pane to lock, 'east' or 'south' - any other is ignored!
+	* @param {boolean}	doLock  true = set left/top, false = remove
+	*/
+,	lockPaneForFX = function (pane, doLock) {
+		var $P	= $Ps[pane]
+		,	s	= state[pane]
+		,	o	= options[pane]
+		,	z	= options.zIndexes
+		;
+		if (doLock) {
+			$P.css({ zIndex: z.pane_animate }); // overlay all elements during animation
+			if (pane=="south")
+				$P.css({ top: sC.insetTop + sC.innerHeight - $P.outerHeight() });
+			else if (pane=="east")
+				$P.css({ left: sC.insetLeft + sC.innerWidth - $P.outerWidth() });
+		}
+		else { // animation DONE - RESET CSS
+			// TODO: see if this can be deleted. It causes a quick-close when sliding in Chrome
+			$P.css({ zIndex: (s.isSliding ? z.pane_sliding : z.pane_normal) });
+			if (pane=="south")
+				$P.css({ top: "auto" });
+			// if pane is positioned 'off-screen', then DO NOT screw with it!
+			else if (pane=="east" && !$P.css("left").match(/\-99999/))
+				$P.css({ left: "auto" });
+			// fix anti-aliasing in IE - only needed for animations that change opacity
+			if (browser.msie && o.fxOpacityFix && o.fxName_open != "slide" && $P.css("filter") && $P.css("opacity") == 1)
+				$P[0].style.removeAttribute('filter');
+		}
+	}
+
+
+	/**
+	* Toggle sliding functionality of a specific pane on/off by adding removing 'slide open' trigger
+	*
+	* @see  open(), close()
+	* @param {string}	pane	The pane to enable/disable, 'north', 'south', etc.
+	* @param {boolean}	enable	Enable or Disable sliding?
+	*/
+,	bindStartSlidingEvent = function (pane, enable) {
+		var o		= options[pane]
+		,	$P		= $Ps[pane]
+		,	$R		= $Rs[pane]
+		,	evtName	= o.slideTrigger_open.toLowerCase()
+		;
+		if (!$R || (enable && !o.slidable)) return;
+
+		// make sure we have a valid event
+		if (evtName.match(/mouseover/))
+			evtName = o.slideTrigger_open = "mouseenter";
+		else if (!evtName.match(/click|dblclick|mouseenter/)) 
+			evtName = o.slideTrigger_open = "click";
+
+		$R
+			// add or remove event
+			[enable ? "bind" : "unbind"](evtName +'.'+ sID, slideOpen)
+			// set the appropriate cursor & title/tip
+			.css("cursor", enable ? o.sliderCursor : "default")
+			.attr("title", enable ? o.tips.Slide : "")
+		;
+	}
+
+	/**
+	* Add or remove 'mouseleave' events to 'slide close' when pane is 'sliding' open or closed
+	* Also increases zIndex when pane is sliding open
+	* See bindStartSlidingEvent for code to control 'slide open'
+	*
+	* @see  slideOpen(), slideClose()
+	* @param {string}	pane	The pane to process, 'north', 'south', etc.
+	* @param {boolean}	enable	Enable or Disable events?
+	*/
+,	bindStopSlidingEvents = function (pane, enable) {
+		var	o		= options[pane]
+		,	s		= state[pane]
+		,	c		= _c[pane]
+		,	z		= options.zIndexes
+		,	evtName	= o.slideTrigger_close.toLowerCase()
+		,	action	= (enable ? "bind" : "unbind")
+		,	$P		= $Ps[pane]
+		,	$R		= $Rs[pane]
+		;
+		s.isSliding = enable; // logic
+		timer.clear(pane+"_closeSlider"); // just in case
+
+		// remove 'slideOpen' event from resizer
+		// ALSO will raise the zIndex of the pane & resizer
+		if (enable) bindStartSlidingEvent(pane, false);
+
+		// RE/SET zIndex - increases when pane is sliding-open, resets to normal when not
+		$P.css("zIndex", enable ? z.pane_sliding : z.pane_normal);
+		$R.css("zIndex", enable ? z.pane_sliding+2 : z.resizer_normal); // NOTE: mask = pane_sliding+1
+
+		// make sure we have a valid event
+		if (!evtName.match(/click|mouseleave/))
+			evtName = o.slideTrigger_close = "mouseleave"; // also catches 'mouseout'
+
+		// add/remove slide triggers
+		$R[action](evtName, slideClose); // base event on resize
+		// need extra events for mouseleave
+		if (evtName === "mouseleave") {
+			// also close on pane.mouseleave
+			$P[action]("mouseleave."+ sID, slideClose);
+			// cancel timer when mouse moves between 'pane' and 'resizer'
+			$R[action]("mouseenter."+ sID, cancelMouseOut);
+			$P[action]("mouseenter."+ sID, cancelMouseOut);
+		}
+
+		if (!enable)
+			timer.clear(pane+"_closeSlider");
+		else if (evtName === "click" && !o.resizable) {
+			// IF pane is not resizable (which already has a cursor and tip) 
+			// then set the a cursor & title/tip on resizer when sliding
+			$R.css("cursor", enable ? o.sliderCursor : "default");
+			$R.attr("title", enable ? o.tips.Close : ""); // use Toggler-tip, eg: "Close Pane"
+		}
+
+		// SUBROUTINE for mouseleave timer clearing
+		function cancelMouseOut (evt) {
+			timer.clear(pane+"_closeSlider");
+			evt.stopPropagation();
+		}
+	}
+
+
+	/**
+	* Hides/closes a pane if there is insufficient room - reverses this when there is room again
+	* MUST have already called setSizeLimits() before calling this method
+	*
+	* @param {string}	pane					The pane being resized
+	* @param {boolean=}	[isOpening=false]		Called from onOpen?
+	* @param {boolean=}	[skipCallback=false]	Should the onresize callback be run?
+	* @param {boolean=}	[force=false]
+	*/
+,	makePaneFit = function (pane, isOpening, skipCallback, force) {
+		var
+			o	= options[pane]
+		,	s	= state[pane]
+		,	c	= _c[pane]
+		,	$P	= $Ps[pane]
+		,	$R	= $Rs[pane]
+		,	isSidePane 	= c.dir==="vert"
+		,	hasRoom		= false
+		;
+		// special handling for center & east/west panes
+		if (pane === "center" || (isSidePane && s.noVerticalRoom)) {
+			// see if there is enough room to display the pane
+			// ERROR: hasRoom = s.minHeight <= s.maxHeight && (isSidePane || s.minWidth <= s.maxWidth);
+			hasRoom = (s.maxHeight >= 0);
+			if (hasRoom && s.noRoom) { // previously hidden due to noRoom, so show now
+				_showPane(pane);
+				if ($R) $R.show();
+				s.isVisible = true;
+				s.noRoom = false;
+				if (isSidePane) s.noVerticalRoom = false;
+				_fixIframe(pane);
+			}
+			else if (!hasRoom && !s.noRoom) { // not currently hidden, so hide now
+				_hidePane(pane);
+				if ($R) $R.hide();
+				s.isVisible = false;
+				s.noRoom = true;
+			}
+		}
+
+		// see if there is enough room to fit the border-pane
+		if (pane === "center") {
+			// ignore center in this block
+		}
+		else if (s.minSize <= s.maxSize) { // pane CAN fit
+			hasRoom = true;
+			if (s.size > s.maxSize) // pane is too big - shrink it
+				sizePane(pane, s.maxSize, skipCallback, force, true); // true = noAnimation
+			else if (s.size < s.minSize) // pane is too small - enlarge it
+				sizePane(pane, s.minSize, skipCallback, force, true);
+			// need s.isVisible because new pseudoClose method keeps pane visible, but off-screen
+			else if ($R && s.isVisible && $P.is(":visible")) {
+				// make sure resizer-bar is positioned correctly
+				// handles situation where nested layout was 'hidden' when initialized
+				var	side = c.side.toLowerCase()
+				,	pos  = s.size + sC["inset"+ c.side]
+				;
+				if ($.layout.cssNum($R, side) != pos) $R.css( side, pos );
+			}
+
+			// if was previously hidden due to noRoom, then RESET because NOW there is room
+			if (s.noRoom) {
+				// s.noRoom state will be set by open or show
+				if (s.wasOpen && o.closable) {
+					if (o.autoReopen)
+						open(pane, false, true, true); // true = noAnimation, true = noAlert
+					else // leave the pane closed, so just update state
+						s.noRoom = false;
+				}
+				else
+					show(pane, s.wasOpen, true, true); // true = noAnimation, true = noAlert
+			}
+		}
+		else { // !hasRoom - pane CANNOT fit
+			if (!s.noRoom) { // pane not set as noRoom yet, so hide or close it now...
+				s.noRoom = true; // update state
+				s.wasOpen = !s.isClosed && !s.isSliding;
+				if (s.isClosed){} // SKIP
+				else if (o.closable) // 'close' if possible
+					close(pane, true, true); // true = force, true = noAnimation
+				else // 'hide' pane if cannot just be closed
+					hide(pane, true); // true = noAnimation
+			}
+		}
+	}
+
+
+	/**
+	* sizePane / manualSizePane
+	* sizePane is called only by internal methods whenever a pane needs to be resized
+	* manualSizePane is an exposed flow-through method allowing extra code when pane is 'manually resized'
+	*
+	* @param {string|Object}	evt_or_pane				The pane being resized
+	* @param {number}			size					The *desired* new size for this pane - will be validated
+	* @param {boolean=}			[skipCallback=false]	Should the onresize callback be run?
+	* @param {boolean=}			[noAnimation=false]
+	*/
+,	manualSizePane = function (evt_or_pane, size, skipCallback, noAnimation) {
+		if (!isInitialized()) return;
+		var	pane = evtPane.call(this, evt_or_pane)
+		,	o	= options[pane]
+		,	s	= state[pane]
+		//	if resizing callbacks have been delayed and resizing is now DONE, force resizing to complete...
+		,	forceResize = o.livePaneResizing && !s.isResizing
+		;
+		// ANY call to manualSizePane disables autoResize - ie, percentage sizing
+		o.autoResize = false;
+		// flow-through...
+		sizePane(pane, size, skipCallback, forceResize, noAnimation); // will animate resize if option enabled
+	}
+
+	/**
+	* @param {string|Object}	evt_or_pane				The pane being resized
+	* @param {number}			size					The *desired* new size for this pane - will be validated
+	* @param {boolean=}			[skipCallback=false]	Should the onresize callback be run?
+	* @param {boolean=}			[force=false]			Force resizing even if does not seem necessary
+	* @param {boolean=}			[noAnimation=false]
+	*/
+,	sizePane = function (evt_or_pane, size, skipCallback, force, noAnimation) {
+		if (!isInitialized()) return;
+		var	pane	= evtPane.call(this, evt_or_pane) // probably NEVER called from event?
+		,	o		= options[pane]
+		,	s		= state[pane]
+		,	$P		= $Ps[pane]
+		,	$R		= $Rs[pane]
+		,	side	= _c[pane].side.toLowerCase()
+		,	dimName	= _c[pane].sizeType.toLowerCase()
+		,	inset	= "inset"+ _c[pane].side
+		,	skipResizeWhileDragging = s.isResizing && !o.triggerEventsDuringLiveResize
+		,	doFX	= noAnimation !== true && o.animatePaneSizing
+		,	oldSize, newSize
+		;
+		// QUEUE in case another action/animation is in progress
+		$N.queue(function( queueNext ){
+			// calculate 'current' min/max sizes
+			setSizeLimits(pane); // update pane-state
+			oldSize = s.size;
+			size = _parseSize(pane, size); // handle percentages & auto
+			size = max(size, _parseSize(pane, o.minSize));
+			size = min(size, s.maxSize);
+			if (size < s.minSize) { // not enough room for pane!
+				queueNext(); // call before makePaneFit() because it needs the queue free
+				makePaneFit(pane, false, skipCallback);	// will hide or close pane
+				return;
+			}
+
+			// IF newSize is same as oldSize, then nothing to do - abort
+			if (!force && size === oldSize)
+				return queueNext();
+
+			// onresize_start callback CANNOT cancel resizing because this would break the layout!
+			if (!skipCallback && state.initialized && s.isVisible)
+				_runCallbacks("onresize_start", pane);
+
+			// resize the pane, and make sure its visible
+			newSize = cssSize(pane, size);
+
+			if (doFX && $P.is(":visible")) { // ANIMATE
+				var fx		= $.layout.effects.size[pane] || $.layout.effects.size.all
+				,	easing	= o.fxSettings_size.easing || fx.easing
+				,	z		= options.zIndexes
+				,	props	= {};
+				props[ dimName ] = newSize +'px';
+				s.isMoving = true;
+				// overlay all elements during animation
+				$P.css({ zIndex: z.pane_animate })
+				  .show().animate( props, o.fxSpeed_size, easing, function(){
+					// reset zIndex after animation
+					$P.css({ zIndex: (s.isSliding ? z.pane_sliding : z.pane_normal) });
+					s.isMoving = false;
+					sizePane_2(); // continue
+					queueNext();
+				});
+			}
+			else { // no animation
+				$P.css( dimName, newSize );	// resize pane
+				// if pane is visible, then 
+				if ($P.is(":visible"))
+					sizePane_2(); // continue
+				else {
+					// pane is NOT VISIBLE, so just update state data...
+					// when pane is *next opened*, it will have the new size
+					s.size = size;				// update state.size
+					$.extend(s, elDims($P));	// update state dimensions
+				}
+				queueNext();
+			};
+
+		});
+
+		// SUBROUTINE
+		function sizePane_2 () {
+			/*	Panes are sometimes not sized precisely in some browsers!?
+			 *	This code will resize the pane up to 3 times to nudge the pane to the correct size
+			 */
+			var	actual	= dimName==='width' ? $P.outerWidth() : $P.outerHeight()
+			,	tries	= [{
+						   	pane:		pane
+						,	count:		1
+						,	target:		size
+						,	actual:		actual
+						,	correct:	(size === actual)
+						,	attempt:	size
+						,	cssSize:	newSize
+						}]
+			,	lastTry = tries[0]
+			,	msg		= 'Inaccurate size after resizing the '+ pane +'-pane.'
+			;
+			while ( !lastTry.correct ) {
+				thisTry = { pane: pane, count: lastTry.count+1, target: size };
+
+				if (lastTry.actual > size)
+					thisTry.attempt = max(0, lastTry.attempt - (lastTry.actual - size));
+				else // lastTry.actual < size
+					thisTry.attempt = max(0, lastTry.attempt + (size - lastTry.actual));
+
+				thisTry.cssSize = cssSize(pane, thisTry.attempt);
+				$P.css( dimName, thisTry.cssSize );
+
+				thisTry.actual	= dimName=='width' ? $P.outerWidth() : $P.outerHeight();
+				thisTry.correct	= (size === thisTry.actual);
+
+				// log attempts and alert the user of this *non-fatal error* (if showDebugMessages)
+				if ( tries.length === 1) {
+					_log(msg, false, true);
+					_log(lastTry, false, true);
+				}
+				_log(thisTry, false, true);
+				// after 4 tries, is as close as its gonna get!
+				if (tries.length > 3) break;
+
+				tries.push( thisTry );
+				lastTry = tries[ tries.length - 1 ];
+			}
+			// END TESTING CODE
+
+			// update pane-state dimensions
+			s.size	= size;
+			$.extend(s, elDims($P));
+
+			if (s.isVisible && $P.is(":visible")) {
+				// reposition the resizer-bar
+				if ($R) $R.css( side, size + sC[inset] );
+				// resize the content-div
+				sizeContent(pane);
+			}
+
+			if (!skipCallback && !skipResizeWhileDragging && state.initialized && s.isVisible)
+				_runCallbacks("onresize_end", pane);
+
+			// resize all the adjacent panes, and adjust their toggler buttons
+			// when skipCallback passed, it means the controlling method will handle 'other panes'
+			if (!skipCallback) {
+				// also no callback if live-resize is in progress and NOT triggerEventsDuringLiveResize
+				if (!s.isSliding) sizeMidPanes(_c[pane].dir=="horz" ? "" : "center", skipResizeWhileDragging, force);
+				sizeHandles();
+			}
+
+			// if opposite-pane was autoClosed, see if it can be autoOpened now
+			var altPane = _c.oppositeEdge[pane];
+			if (size < oldSize && state[ altPane ].noRoom) {
+				setSizeLimits( altPane );
+				makePaneFit( altPane, false, skipCallback );
+			}
+
+			// DEBUG - ALERT user/developer so they know there was a sizing problem
+			if (tries.length > 1)
+				_log(msg +'\nSee the Error Console for details.', true, true);
+		}
+	}
+
+	/**
+	* @see  initPanes(), sizePane(), resizeAll(), open(), close(), hide()
+	* @param {Array.<string>|string} panes					The pane(s) being resized, comma-delmited string
+	* @param {boolean=}				[skipCallback=false]	Should the onresize callback be run?
+	* @param {boolean=}				[force=false]
+	*/
+,	sizeMidPanes = function (panes, skipCallback, force) {
+		panes = (panes ? panes : "east,west,center").split(",");
+
+		$.each(panes, function (i, pane) {
+			if (!$Ps[pane]) return; // NO PANE - skip
+			var 
+				o		= options[pane]
+			,	s		= state[pane]
+			,	$P		= $Ps[pane]
+			,	$R		= $Rs[pane]
+			,	isCenter= (pane=="center")
+			,	hasRoom	= true
+			,	CSS		= {}
+			,	newCenter	= calcNewCenterPaneDims()
+			;
+			// update pane-state dimensions
+			$.extend(s, elDims($P));
+
+			if (pane === "center") {
+				if (!force && s.isVisible && newCenter.width === s.outerWidth && newCenter.height === s.outerHeight)
+					return true; // SKIP - pane already the correct size
+				// set state for makePaneFit() logic
+				$.extend(s, cssMinDims(pane), {
+					maxWidth:	newCenter.width
+				,	maxHeight:	newCenter.height
+				});
+				CSS = newCenter;
+				// convert OUTER width/height to CSS width/height 
+				CSS.width	= cssW($P, CSS.width);
+				// NEW - allow pane to extend 'below' visible area rather than hide it
+				CSS.height	= cssH($P, CSS.height);
+				hasRoom		= CSS.width >= 0 && CSS.height >= 0; // height >= 0 = ALWAYS TRUE NOW
+				// during layout init, try to shrink east/west panes to make room for center
+				if (!state.initialized && o.minWidth > s.outerWidth) {
+					var
+						reqPx	= o.minWidth - s.outerWidth
+					,	minE	= options.east.minSize || 0
+					,	minW	= options.west.minSize || 0
+					,	sizeE	= state.east.size
+					,	sizeW	= state.west.size
+					,	newE	= sizeE
+					,	newW	= sizeW
+					;
+					if (reqPx > 0 && state.east.isVisible && sizeE > minE) {
+						newE = max( sizeE-minE, sizeE-reqPx );
+						reqPx -= sizeE-newE;
+					}
+					if (reqPx > 0 && state.west.isVisible && sizeW > minW) {
+						newW = max( sizeW-minW, sizeW-reqPx );
+						reqPx -= sizeW-newW;
+					}
+					// IF we found enough extra space, then resize the border panes as calculated
+					if (reqPx === 0) {
+						if (sizeE && sizeE != minE)
+							sizePane('east', newE, true, force, true); // true = skipCallback/noAnimation - initPanes will handle when done
+						if (sizeW && sizeW != minW)
+							sizePane('west', newW, true, force, true);
+						// now start over!
+						sizeMidPanes('center', skipCallback, force);
+						return; // abort this loop
+					}
+				}
+			}
+			else { // for east and west, set only the height, which is same as center height
+				// set state.min/maxWidth/Height for makePaneFit() logic
+				if (s.isVisible && !s.noVerticalRoom)
+					$.extend(s, elDims($P), cssMinDims(pane))
+				if (!force && !s.noVerticalRoom && newCenter.height === s.outerHeight)
+					return true; // SKIP - pane already the correct size
+				// east/west have same top, bottom & height as center
+				CSS.top		= newCenter.top;
+				CSS.bottom	= newCenter.bottom;
+				// NEW - allow pane to extend 'below' visible area rather than hide it
+				CSS.height	= cssH($P, newCenter.height);
+				s.maxHeight	= CSS.height;
+				hasRoom		= (s.maxHeight >= 0); // ALWAYS TRUE NOW
+				if (!hasRoom) s.noVerticalRoom = true; // makePaneFit() logic
+			}
+
+			if (hasRoom) {
+				// resizeAll passes skipCallback because it triggers callbacks after ALL panes are resized
+				if (!skipCallback && state.initialized)
+					_runCallbacks("onresize_start", pane);
+
+				$P.css(CSS); // apply the CSS to pane
+				if (pane !== "center")
+					sizeHandles(pane); // also update resizer length
+				if (s.noRoom && !s.isClosed && !s.isHidden)
+					makePaneFit(pane); // will re-open/show auto-closed/hidden pane
+				if (s.isVisible) {
+					$.extend(s, elDims($P)); // update pane dimensions
+					if (state.initialized) sizeContent(pane); // also resize the contents, if exists
+				}
+			}
+			else if (!s.noRoom && s.isVisible) // no room for pane
+				makePaneFit(pane); // will hide or close pane
+
+			if (!s.isVisible)
+				return true; // DONE - next pane
+
+			/*
+			* Extra CSS for IE6 or IE7 in Quirks-mode - add 'width' to NORTH/SOUTH panes
+			* Normally these panes have only 'left' & 'right' positions so pane auto-sizes
+			* ALSO required when pane is an IFRAME because will NOT default to 'full width'
+			*	TODO: Can I use width:100% for a north/south iframe?
+			*	TODO: Sounds like a job for $P.outerWidth( sC.innerWidth ) SETTER METHOD
+			*/
+			if (pane === "center") { // finished processing midPanes
+				var fix = browser.isIE6 || !browser.boxModel;
+				if ($Ps.north && (fix || state.north.tagName=="IFRAME")) 
+					$Ps.north.css("width", cssW($Ps.north, sC.innerWidth));
+				if ($Ps.south && (fix || state.south.tagName=="IFRAME"))
+					$Ps.south.css("width", cssW($Ps.south, sC.innerWidth));
+			}
+
+			// resizeAll passes skipCallback because it triggers callbacks after ALL panes are resized
+			if (!skipCallback && state.initialized)
+				_runCallbacks("onresize_end", pane);
+		});
+	}
+
+
+	/**
+	* @see  window.onresize(), callbacks or custom code
+	*/
+,	resizeAll = function (evt) {
+		// stopPropagation if called by trigger("layoutdestroy") - use evtPane utility 
+		evtPane(evt);
+
+		if (!state.initialized) {
+			_initLayoutElements();
+			return; // no need to resize since we just initialized!
+		}
+		var	oldW	= sC.innerWidth
+		,	oldH	= sC.innerHeight
+		;
+		// cannot size layout when 'container' is hidden or collapsed
+		if (!$N.is(":visible:") ) return;
+		$.extend(state.container, elDims( $N )); // UPDATE container dimensions
+		if (!sC.outerHeight) return;
+
+		// onresizeall_start will CANCEL resizing if returns false
+		// state.container has already been set, so user can access this info for calcuations
+		if (false === _runCallbacks("onresizeall_start")) return false;
+
+		var	// see if container is now 'smaller' than before
+			shrunkH	= (sC.innerHeight < oldH)
+		,	shrunkW	= (sC.innerWidth < oldW)
+		,	$P, o, s, dir
+		;
+		// NOTE special order for sizing: S-N-E-W
+		$.each(["south","north","east","west"], function (i, pane) {
+			if (!$Ps[pane]) return; // no pane - SKIP
+			s	= state[pane];
+			o	= options[pane];
+			dir	= _c[pane].dir;
+
+			if (o.autoResize && s.size != o.size) // resize pane to original size set in options
+				sizePane(pane, o.size, true, true, true); // true=skipCallback/forceResize/noAnimation
+			else {
+				setSizeLimits(pane);
+				makePaneFit(pane, false, true, true); // true=skipCallback/forceResize
+			}
+		});
+
+		sizeMidPanes("", true, true); // true=skipCallback, true=forceResize
+		sizeHandles(); // reposition the toggler elements
+
+		// trigger all individual pane callbacks AFTER layout has finished resizing
+		o = options; // reuse alias
+		$.each(_c.allPanes, function (i, pane) {
+			$P = $Ps[pane];
+			if (!$P) return; // SKIP
+			if (state[pane].isVisible) // undefined for non-existent panes
+				_runCallbacks("onresize_end", pane); // callback - if exists
+		});
+
+		_runCallbacks("onresizeall_end");
+		//_triggerLayoutEvent(pane, 'resizeall');
+	}
+
+	/**
+	* Whenever a pane resizes or opens that has a nested layout, trigger resizeAll
+	*
+	* @param {string|Object}	evt_or_pane		The pane just resized or opened
+	*/
+,	resizeChildLayout = function (evt_or_pane) {
+		var	pane = evtPane.call(this, evt_or_pane);
+		if (!options[pane].resizeChildLayout) return;
+		var	$P	= $Ps[pane]
+		,	$C	= $Cs[pane]
+		,	d	= "layout"
+		,	P	= Instance[pane]
+		,	L	= children[pane]
+		;
+		// user may have manually set EITHER instance pointer, so handle that
+		if (P.child && !L) {
+			// have to reverse the pointers!
+			var el = P.child.container;
+			L = children[pane] = (el ? el.data(d) : 0) || null; // set pointer _directly_ to layout instance
+		}
+
+		// if a layout-pointer exists, see if child has been destroyed
+		if (L && L.destroyed)
+			L = children[pane] = null; // clear child pointers
+		// no child layout pointer is set - see if there is a child layout NOW
+		if (!L)	L = children[pane] = $P.data(d) || ($C ? $C.data(d) : 0) || null; // set/update child pointers
+
+		// ALWAYS refresh the pane.child alias
+		P.child = children[pane];
+
+		if (L) L.resizeAll();
+	}
+
+
+	/**
+	* IF pane has a content-div, then resize all elements inside pane to fit pane-height
+	*
+	* @param {string|Object}	evt_or_panes		The pane(s) being resized
+	* @param {boolean=}			[remeasure=false]	Should the content (header/footer) be remeasured?
+	*/
+,	sizeContent = function (evt_or_panes, remeasure) {
+		if (!isInitialized()) return;
+
+		var panes = evtPane.call(this, evt_or_panes);
+		panes = panes ? panes.split(",") : _c.allPanes;
+
+		$.each(panes, function (idx, pane) {
+			var
+				$P	= $Ps[pane]
+			,	$C	= $Cs[pane]
+			,	o	= options[pane]
+			,	s	= state[pane]
+			,	m	= s.content // m = measurements
+			;
+			if (!$P || !$C || !$P.is(":visible")) return true; // NOT VISIBLE - skip
+
+			// if content-element was REMOVED, update OR remove the pointer
+			if (!$C.length) {
+				initContent(pane, false);	// false = do NOT sizeContent() - already there!
+				if (!$C) return;			// no replacement element found - pointer have been removed
+			}
+
+			// onsizecontent_start will CANCEL resizing if returns false
+			if (false === _runCallbacks("onsizecontent_start", pane)) return;
+
+			// skip re-measuring offsets if live-resizing
+			if ((!s.isMoving && !s.isResizing) || o.liveContentResizing || remeasure || m.top == undefined) {
+				_measure();
+				// if any footers are below pane-bottom, they may not measure correctly,
+				// so allow pane overflow and re-measure
+				if (m.hiddenFooters > 0 && $P.css("overflow") === "hidden") {
+					$P.css("overflow", "visible");
+					_measure(); // remeasure while overflowing
+					$P.css("overflow", "hidden");
+				}
+			}
+			// NOTE: spaceAbove/Below *includes* the pane paddingTop/Bottom, but not pane.borders
+			var newH = s.innerHeight - (m.spaceAbove - s.css.paddingTop) - (m.spaceBelow - s.css.paddingBottom);
+
+			if (!$C.is(":visible") || m.height != newH) {
+				// size the Content element to fit new pane-size - will autoHide if not enough room
+				setOuterHeight($C, newH, true); // true=autoHide
+				m.height = newH; // save new height
+			};
+
+			if (state.initialized)
+				_runCallbacks("onsizecontent_end", pane);
+
+			function _below ($E) {
+				return max(s.css.paddingBottom, (parseInt($E.css("marginBottom"), 10) || 0));
+			};
+
+			function _measure () {
+				var
+					ignore	= options[pane].contentIgnoreSelector
+				,	$Fs		= $C.nextAll().not(ignore || ':lt(0)') // not :lt(0) = ALL
+				,	$Fs_vis	= $Fs.filter(':visible')
+				,	$F		= $Fs_vis.filter(':last')
+				;
+				m = {
+					top:			$C[0].offsetTop
+				,	height:			$C.outerHeight()
+				,	numFooters:		$Fs.length
+				,	hiddenFooters:	$Fs.length - $Fs_vis.length
+				,	spaceBelow:		0 // correct if no content footer ($E)
+				}
+					m.spaceAbove	= m.top; // just for state - not used in calc
+					m.bottom		= m.top + m.height;
+				if ($F.length)
+					//spaceBelow = (LastFooter.top + LastFooter.height) [footerBottom] - Content.bottom + max(LastFooter.marginBottom, pane.paddingBotom)
+					m.spaceBelow = ($F[0].offsetTop + $F.outerHeight()) - m.bottom + _below($F);
+				else // no footer - check marginBottom on Content element itself
+					m.spaceBelow = _below($C);
+			};
+		});
+	}
+
+
+	/**
+	* Called every time a pane is opened, closed, or resized to slide the togglers to 'center' and adjust their length if necessary
+	*
+	* @see  initHandles(), open(), close(), resizeAll()
+	* @param {string|Object}	evt_or_panes		The pane(s) being resized
+	*/
+,	sizeHandles = function (evt_or_panes) {
+		var panes = evtPane.call(this, evt_or_panes)
+		panes = panes ? panes.split(",") : _c.borderPanes;
+
+		$.each(panes, function (i, pane) {
+			var 
+				o	= options[pane]
+			,	s	= state[pane]
+			,	$P	= $Ps[pane]
+			,	$R	= $Rs[pane]
+			,	$T	= $Ts[pane]
+			,	$TC
+			;
+			if (!$P || !$R) return;
+
+			var
+				dir			= _c[pane].dir
+			,	_state		= (s.isClosed ? "_closed" : "_open")
+			,	spacing		= o["spacing"+ _state]
+			,	togAlign	= o["togglerAlign"+ _state]
+			,	togLen		= o["togglerLength"+ _state]
+			,	paneLen
+			,	left
+			,	offset
+			,	CSS = {}
+			;
+
+			if (spacing === 0) {
+				$R.hide();
+				return;
+			}
+			else if (!s.noRoom && !s.isHidden) // skip if resizer was hidden for any reason
+				$R.show(); // in case was previously hidden
+
+			// Resizer Bar is ALWAYS same width/height of pane it is attached to
+			if (dir === "horz") { // north/south
+				//paneLen = $P.outerWidth(); // s.outerWidth || 
+				paneLen = sC.innerWidth; // handle offscreen-panes
+				s.resizerLength = paneLen;
+				left = $.layout.cssNum($P, "left")
+				$R.css({
+					width:	cssW($R, paneLen) // account for borders & padding
+				,	height:	cssH($R, spacing) // ditto
+				,	left:	left > -9999 ? left : sC.insetLeft // handle offscreen-panes
+				});
+			}
+			else { // east/west
+				paneLen = $P.outerHeight(); // s.outerHeight || 
+				s.resizerLength = paneLen;
+				$R.css({
+					height:	cssH($R, paneLen) // account for borders & padding
+				,	width:	cssW($R, spacing) // ditto
+				,	top:	sC.insetTop + getPaneSize("north", true) // TODO: what if no North pane?
+				//,	top:	$.layout.cssNum($Ps["center"], "top")
+				});
+			}
+
+			// remove hover classes
+			removeHover( o, $R );
+
+			if ($T) {
+				if (togLen === 0 || (s.isSliding && o.hideTogglerOnSlide)) {
+					$T.hide(); // always HIDE the toggler when 'sliding'
+					return;
+				}
+				else
+					$T.show(); // in case was previously hidden
+
+				if (!(togLen > 0) || togLen === "100%" || togLen > paneLen) {
+					togLen = paneLen;
+					offset = 0;
+				}
+				else { // calculate 'offset' based on options.PANE.togglerAlign_open/closed
+					if (isStr(togAlign)) {
+						switch (togAlign) {
+							case "top":
+							case "left":	offset = 0;
+											break;
+							case "bottom":
+							case "right":	offset = paneLen - togLen;
+											break;
+							case "middle":
+							case "center":
+							default:		offset = round((paneLen - togLen) / 2); // 'default' catches typos
+						}
+					}
+					else { // togAlign = number
+						var x = parseInt(togAlign, 10); //
+						if (togAlign >= 0) offset = x;
+						else offset = paneLen - togLen + x; // NOTE: x is negative!
+					}
+				}
+
+				if (dir === "horz") { // north/south
+					var width = cssW($T, togLen);
+					$T.css({
+						width:	width  // account for borders & padding
+					,	height:	cssH($T, spacing) // ditto
+					,	left:	offset // TODO: VERIFY that toggler  positions correctly for ALL values
+					,	top:	0
+					});
+					// CENTER the toggler content SPAN
+					$T.children(".content").each(function(){
+						$TC = $(this);
+						$TC.css("marginLeft", round((width-$TC.outerWidth())/2)); // could be negative
+					});
+				}
+				else { // east/west
+					var height = cssH($T, togLen);
+					$T.css({
+						height:	height // account for borders & padding
+					,	width:	cssW($T, spacing) // ditto
+					,	top:	offset // POSITION the toggler
+					,	left:	0
+					});
+					// CENTER the toggler content SPAN
+					$T.children(".content").each(function(){
+						$TC = $(this);
+						$TC.css("marginTop", round((height-$TC.outerHeight())/2)); // could be negative
+					});
+				}
+
+				// remove ALL hover classes
+				removeHover( 0, $T );
+			}
+
+			// DONE measuring and sizing this resizer/toggler, so can be 'hidden' now
+			if (!state.initialized && (o.initHidden || s.noRoom)) {
+				$R.hide();
+				if ($T) $T.hide();
+			}
+		});
+	}
+
+
+	/**
+	* @param {string|Object}	evt_or_pane
+	*/
+,	enableClosable = function (evt_or_pane) {
+		if (!isInitialized()) return;
+		var	pane = evtPane.call(this, evt_or_pane)
+		,	$T	= $Ts[pane]
+		,	o	= options[pane]
+		;
+		if (!$T) return;
+		o.closable = true;
+		$T	.bind("click."+ sID, function(evt){ evt.stopPropagation(); toggle(pane); })
+			.css("visibility", "visible")
+			.css("cursor", "pointer")
+			.attr("title", state[pane].isClosed ? o.tips.Open : o.tips.Close) // may be blank
+			.show();
+	}
+	/**
+	* @param {string|Object}	evt_or_pane
+	* @param {boolean=}			[hide=false]
+	*/
+,	disableClosable = function (evt_or_pane, hide) {
+		if (!isInitialized()) return;
+		var	pane = evtPane.call(this, evt_or_pane)
+		,	$T	= $Ts[pane]
+		;
+		if (!$T) return;
+		options[pane].closable = false;
+		// is closable is disable, then pane MUST be open!
+		if (state[pane].isClosed) open(pane, false, true);
+		$T	.unbind("."+ sID)
+			.css("visibility", hide ? "hidden" : "visible") // instead of hide(), which creates logic issues
+			.css("cursor", "default")
+			.attr("title", "");
+	}
+
+
+	/**
+	* @param {string|Object}	evt_or_pane
+	*/
+,	enableSlidable = function (evt_or_pane) {
+		if (!isInitialized()) return;
+		var	pane = evtPane.call(this, evt_or_pane)
+		,	$R	= $Rs[pane]
+		;
+		if (!$R || !$R.data('draggable')) return;
+		options[pane].slidable = true; 
+		if (state[pane].isClosed)
+			bindStartSlidingEvent(pane, true);
+	}
+	/**
+	* @param {string|Object}	evt_or_pane
+	*/
+,	disableSlidable = function (evt_or_pane) {
+		if (!isInitialized()) return;
+		var	pane = evtPane.call(this, evt_or_pane)
+		,	$R	= $Rs[pane]
+		;
+		if (!$R) return;
+		options[pane].slidable = false; 
+		if (state[pane].isSliding)
+			close(pane, false, true);
+		else {
+			bindStartSlidingEvent(pane, false);
+			$R	.css("cursor", "default")
+				.attr("title", "");
+			removeHover(null, $R[0]); // in case currently hovered
+		}
+	}
+
+
+	/**
+	* @param {string|Object}	evt_or_pane
+	*/
+,	enableResizable = function (evt_or_pane) {
+		if (!isInitialized()) return;
+		var	pane = evtPane.call(this, evt_or_pane)
+		,	$R	= $Rs[pane]
+		,	o	= options[pane]
+		;
+		if (!$R || !$R.data('draggable')) return;
+		o.resizable = true; 
+		$R.draggable("enable");
+		if (!state[pane].isClosed)
+			$R	.css("cursor", o.resizerCursor)
+			 	.attr("title", o.tips.Resize);
+	}
+	/**
+	* @param {string|Object}	evt_or_pane
+	*/
+,	disableResizable = function (evt_or_pane) {
+		if (!isInitialized()) return;
+		var	pane = evtPane.call(this, evt_or_pane)
+		,	$R	= $Rs[pane]
+		;
+		if (!$R || !$R.data('draggable')) return;
+		options[pane].resizable = false; 
+		$R	.draggable("disable")
+			.css("cursor", "default")
+			.attr("title", "");
+		removeHover(null, $R[0]); // in case currently hovered
+	}
+
+
+	/**
+	* Move a pane from source-side (eg, west) to target-side (eg, east)
+	* If pane exists on target-side, move that to source-side, ie, 'swap' the panes
+	*
+	* @param {string|Object}	evt_or_pane1	The pane/edge being swapped
+	* @param {string}			pane2			ditto
+	*/
+,	swapPanes = function (evt_or_pane1, pane2) {
+		if (!isInitialized()) return;
+		var pane1 = evtPane.call(this, evt_or_pane1);
+		// change state.edge NOW so callbacks can know where pane is headed...
+		state[pane1].edge = pane2;
+		state[pane2].edge = pane1;
+		// run these even if NOT state.initialized
+		if (false === _runCallbacks("onswap_start", pane1)
+		 ||	false === _runCallbacks("onswap_start", pane2)
+		) {
+			state[pane1].edge = pane1; // reset
+			state[pane2].edge = pane2;
+			return;
+		}
+
+		var
+			oPane1	= copy( pane1 )
+		,	oPane2	= copy( pane2 )
+		,	sizes	= {}
+		;
+		sizes[pane1] = oPane1 ? oPane1.state.size : 0;
+		sizes[pane2] = oPane2 ? oPane2.state.size : 0;
+
+		// clear pointers & state
+		$Ps[pane1] = false; 
+		$Ps[pane2] = false;
+		state[pane1] = {};
+		state[pane2] = {};
+		
+		// ALWAYS remove the resizer & toggler elements
+		if ($Ts[pane1]) $Ts[pane1].remove();
+		if ($Ts[pane2]) $Ts[pane2].remove();
+		if ($Rs[pane1]) $Rs[pane1].remove();
+		if ($Rs[pane2]) $Rs[pane2].remove();
+		$Rs[pane1] = $Rs[pane2] = $Ts[pane1] = $Ts[pane2] = false;
+
+		// transfer element pointers and data to NEW Layout keys
+		move( oPane1, pane2 );
+		move( oPane2, pane1 );
+
+		// cleanup objects
+		oPane1 = oPane2 = sizes = null;
+
+		// make panes 'visible' again
+		if ($Ps[pane1]) $Ps[pane1].css(_c.visible);
+		if ($Ps[pane2]) $Ps[pane2].css(_c.visible);
+
+		// fix any size discrepancies caused by swap
+		resizeAll();
+
+		// run these even if NOT state.initialized
+		_runCallbacks("onswap_end", pane1);
+		_runCallbacks("onswap_end", pane2);
+
+		return;
+
+		function copy (n) { // n = pane
+			var
+				$P	= $Ps[n]
+			,	$C	= $Cs[n]
+			;
+			return !$P ? false : {
+				pane:		n
+			,	P:			$P ? $P[0] : false
+			,	C:			$C ? $C[0] : false
+			,	state:		$.extend(true, {}, state[n])
+			,	options:	$.extend(true, {}, options[n])
+			}
+		};
+
+		function move (oPane, pane) {
+			if (!oPane) return;
+			var
+				P		= oPane.P
+			,	C		= oPane.C
+			,	oldPane = oPane.pane
+			,	c		= _c[pane]
+			,	side	= c.side.toLowerCase()
+			,	inset	= "inset"+ c.side
+			//	save pane-options that should be retained
+			,	s		= $.extend(true, {}, state[pane])
+			,	o		= options[pane]
+			//	RETAIN side-specific FX Settings - more below
+			,	fx		= { resizerCursor: o.resizerCursor }
+			,	re, size, pos
+			;
+			$.each("fxName,fxSpeed,fxSettings".split(","), function (i, k) {
+				fx[k +"_open"]  = o[k +"_open"];
+				fx[k +"_close"] = o[k +"_close"];
+				fx[k +"_size"]  = o[k +"_size"];
+			});
+
+			// update object pointers and attributes
+			$Ps[pane] = $(P)
+				.data({
+					layoutPane:		Instance[pane]	// NEW pointer to pane-alias-object
+				,	layoutEdge:		pane
+				})
+				.css(_c.hidden)
+				.css(c.cssReq)
+			;
+			$Cs[pane] = C ? $(C) : false;
+
+			// set options and state
+			options[pane]	= $.extend(true, {}, oPane.options, fx);
+			state[pane]		= $.extend(true, {}, oPane.state);
+
+			// change classNames on the pane, eg: ui-layout-pane-east ==> ui-layout-pane-west
+			re = new RegExp(o.paneClass +"-"+ oldPane, "g");
+			P.className = P.className.replace(re, o.paneClass +"-"+ pane);
+
+			// ALWAYS regenerate the resizer & toggler elements
+			initHandles(pane); // create the required resizer & toggler
+
+			// if moving to different orientation, then keep 'target' pane size
+			if (c.dir != _c[oldPane].dir) {
+				size = sizes[pane] || 0;
+				setSizeLimits(pane); // update pane-state
+				size = max(size, state[pane].minSize);
+				// use manualSizePane to disable autoResize - not useful after panes are swapped
+				manualSizePane(pane, size, true, true); // true/true = skipCallback/noAnimation
+			}
+			else // move the resizer here
+				$Rs[pane].css(side, sC[inset] + (state[pane].isVisible ? getPaneSize(pane) : 0));
+
+
+			// ADD CLASSNAMES & SLIDE-BINDINGS
+			if (oPane.state.isVisible && !s.isVisible)
+				setAsOpen(pane, true); // true = skipCallback
+			else {
+				setAsClosed(pane);
+				bindStartSlidingEvent(pane, true); // will enable events IF option is set
+			}
+
+			// DESTROY the object
+			oPane = null;
+		};
+	}
+
+
+	/**
+	* INTERNAL method to sync pin-buttons when pane is opened or closed
+	* Unpinned means the pane is 'sliding' - ie, over-top of the adjacent panes
+	*
+	* @see  open(), setAsOpen(), setAsClosed()
+	* @param {string}	pane   These are the params returned to callbacks by layout()
+	* @param {boolean}	doPin  True means set the pin 'down', False means 'up'
+	*/
+,	syncPinBtns = function (pane, doPin) {
+		if ($.layout.plugins.buttons)
+			$.each(state[pane].pins, function (i, selector) {
+				$.layout.buttons.setPinState(Instance, $(selector), pane, doPin);
+			});
+	}
+
+;	// END var DECLARATIONS
+
+	/**
+	* Capture keys when enableCursorHotkey - toggle pane if hotkey pressed
+	*
+	* @see  document.keydown()
+	*/
+	function keyDown (evt) {
+		if (!evt) return true;
+		var code = evt.keyCode;
+		if (code < 33) return true; // ignore special keys: ENTER, TAB, etc
+
+		var
+			PANE = {
+				38: "north" // Up Cursor	- $.ui.keyCode.UP
+			,	40: "south" // Down Cursor	- $.ui.keyCode.DOWN
+			,	37: "west"  // Left Cursor	- $.ui.keyCode.LEFT
+			,	39: "east"  // Right Cursor	- $.ui.keyCode.RIGHT
+			}
+		,	ALT		= evt.altKey // no worky!
+		,	SHIFT	= evt.shiftKey
+		,	CTRL	= evt.ctrlKey
+		,	CURSOR	= (CTRL && code >= 37 && code <= 40)
+		,	o, k, m, pane
+		;
+
+		if (CURSOR && options[PANE[code]].enableCursorHotkey) // valid cursor-hotkey
+			pane = PANE[code];
+		else if (CTRL || SHIFT) // check to see if this matches a custom-hotkey
+			$.each(_c.borderPanes, function (i, p) { // loop each pane to check its hotkey
+				o = options[p];
+				k = o.customHotkey;
+				m = o.customHotkeyModifier; // if missing or invalid, treated as "CTRL+SHIFT"
+				if ((SHIFT && m=="SHIFT") || (CTRL && m=="CTRL") || (CTRL && SHIFT)) { // Modifier matches
+					if (k && code === (isNaN(k) || k <= 9 ? k.toUpperCase().charCodeAt(0) : k)) { // Key matches
+						pane = p;
+						return false; // BREAK
+					}
+				}
+			});
+
+		// validate pane
+		if (!pane || !$Ps[pane] || !options[pane].closable || state[pane].isHidden)
+			return true;
+
+		toggle(pane);
+
+		evt.stopPropagation();
+		evt.returnValue = false; // CANCEL key
+		return false;
+	};
+
+
+/*
+ * ######################################
+ *	UTILITY METHODS
+ *	called externally or by initButtons
+ * ######################################
+ */
+
+	/**
+	* Change/reset a pane overflow setting & zIndex to allow popups/drop-downs to work
+	*
+	* @param {Object=}   [el]	(optional) Can also be 'bound' to a click, mouseOver, or other event
+	*/
+	function allowOverflow (el) {
+		if (!isInitialized()) return;
+		if (this && this.tagName) el = this; // BOUND to element
+		var $P;
+		if (isStr(el))
+			$P = $Ps[el];
+		else if ($(el).data("layoutRole"))
+			$P = $(el);
+		else
+			$(el).parents().each(function(){
+				if ($(this).data("layoutRole")) {
+					$P = $(this);
+					return false; // BREAK
+				}
+			});
+		if (!$P || !$P.length) return; // INVALID
+
+		var
+			pane	= $P.data("layoutEdge")
+		,	s		= state[pane]
+		;
+
+		// if pane is already raised, then reset it before doing it again!
+		// this would happen if allowOverflow is attached to BOTH the pane and an element 
+		if (s.cssSaved)
+			resetOverflow(pane); // reset previous CSS before continuing
+
+		// if pane is raised by sliding or resizing, or its closed, then abort
+		if (s.isSliding || s.isResizing || s.isClosed) {
+			s.cssSaved = false;
+			return;
+		}
+
+		var
+			newCSS	= { zIndex: (options.zIndexes.resizer_normal + 1) }
+		,	curCSS	= {}
+		,	of		= $P.css("overflow")
+		,	ofX		= $P.css("overflowX")
+		,	ofY		= $P.css("overflowY")
+		;
+		// determine which, if any, overflow settings need to be changed
+		if (of != "visible") {
+			curCSS.overflow = of;
+			newCSS.overflow = "visible";
+		}
+		if (ofX && !ofX.match(/(visible|auto)/)) {
+			curCSS.overflowX = ofX;
+			newCSS.overflowX = "visible";
+		}
+		if (ofY && !ofY.match(/(visible|auto)/)) {
+			curCSS.overflowY = ofX;
+			newCSS.overflowY = "visible";
+		}
+
+		// save the current overflow settings - even if blank!
+		s.cssSaved = curCSS;
+
+		// apply new CSS to raise zIndex and, if necessary, make overflow 'visible'
+		$P.css( newCSS );
+
+		// make sure the zIndex of all other panes is normal
+		$.each(_c.allPanes, function(i, p) {
+			if (p != pane) resetOverflow(p);
+		});
+
+	};
+	/**
+	* @param {Object=}   [el]	(optional) Can also be 'bound' to a click, mouseOver, or other event
+	*/
+	function resetOverflow (el) {
+		if (!isInitialized()) return;
+		if (this && this.tagName) el = this; // BOUND to element
+		var $P;
+		if (isStr(el))
+			$P = $Ps[el];
+		else if ($(el).data("layoutRole"))
+			$P = $(el);
+		else
+			$(el).parents().each(function(){
+				if ($(this).data("layoutRole")) {
+					$P = $(this);
+					return false; // BREAK
+				}
+			});
+		if (!$P || !$P.length) return; // INVALID
+
+		var
+			pane	= $P.data("layoutEdge")
+		,	s		= state[pane]
+		,	CSS		= s.cssSaved || {}
+		;
+		// reset the zIndex
+		if (!s.isSliding && !s.isResizing)
+			$P.css("zIndex", options.zIndexes.pane_normal);
+
+		// reset Overflow - if necessary
+		$P.css( CSS );
+
+		// clear var
+		s.cssSaved = false;
+	};
+
+/*
+ * #####################
+ * CREATE/RETURN LAYOUT
+ * #####################
+ */
+
+	// validate that container exists
+	var $N = $(this).eq(0); // FIRST matching Container element
+	if (!$N.length) {
+		return _log( options.errors.containerMissing );
+	};
+
+	// Users retrieve Instance of a layout with: $N.layout() OR $N.data("layout")
+	// return the Instance-pointer if layout has already been initialized
+	if ($N.data("layoutContainer") && $N.data("layout"))
+		return $N.data("layout"); // cached pointer
+
+	// init global vars
+	var 
+		$Ps	= {}	// Panes x5		- set in initPanes()
+	,	$Cs	= {}	// Content x5	- set in initPanes()
+	,	$Rs	= {}	// Resizers x4	- set in initHandles()
+	,	$Ts	= {}	// Togglers x4	- set in initHandles()
+	,	$Ms	= $([])	// Masks - up to 2 masks per pane (IFRAME + DIV)
+	//	aliases for code brevity
+	,	sC	= state.container // alias for easy access to 'container dimensions'
+	,	sID	= state.id // alias for unique layout ID/namespace - eg: "layout435"
+	;
+
+	// create Instance object to expose data & option Properties, and primary action Methods
+	var Instance = {
+	//	layout data
+		options:			options			// property - options hash
+	,	state:				state			// property - dimensions hash
+	//	object pointers
+	,	container:			$N				// property - object pointers for layout container
+	,	panes:				$Ps				// property - object pointers for ALL Panes: panes.north, panes.center
+	,	contents:			$Cs				// property - object pointers for ALL Content: contents.north, contents.center
+	,	resizers:			$Rs				// property - object pointers for ALL Resizers, eg: resizers.north
+	,	togglers:			$Ts				// property - object pointers for ALL Togglers, eg: togglers.north
+	//	border-pane open/close
+	,	hide:				hide			// method - ditto
+	,	show:				show			// method - ditto
+	,	toggle:				toggle			// method - pass a 'pane' ("north", "west", etc)
+	,	open:				open			// method - ditto
+	,	close:				close			// method - ditto
+	,	slideOpen:			slideOpen		// method - ditto
+	,	slideClose:			slideClose		// method - ditto
+	,	slideToggle:		slideToggle		// method - ditto
+	//	pane actions
+	,	setSizeLimits:		setSizeLimits	// method - pass a 'pane' - update state min/max data
+	,	_sizePane:			sizePane		// method -intended for user by plugins only!
+	,	sizePane:			manualSizePane	// method - pass a 'pane' AND an 'outer-size' in pixels or percent, or 'auto'
+	,	sizeContent:		sizeContent		// method - pass a 'pane'
+	,	swapPanes:			swapPanes		// method - pass TWO 'panes' - will swap them
+	,	showMasks:			showMasks		// method - pass a 'pane' OR list of panes - default = all panes with mask option set
+	,	hideMasks:			hideMasks		// method - ditto'
+	//	pane element methods
+	,	initContent:		initContent		// method - ditto
+	,	addPane:			addPane			// method - pass a 'pane'
+	,	removePane:			removePane		// method - pass a 'pane' to remove from layout, add 'true' to delete the pane-elem
+	,	createChildLayout:	createChildLayout// method - pass a 'pane' and (optional) layout-options (OVERRIDES options[pane].childOptions
+	//	special pane option setting
+	,	enableClosable:		enableClosable	// method - pass a 'pane'
+	,	disableClosable:	disableClosable	// method - ditto
+	,	enableSlidable:		enableSlidable	// method - ditto
+	,	disableSlidable:	disableSlidable	// method - ditto
+	,	enableResizable:	enableResizable	// method - ditto
+	,	disableResizable:	disableResizable// method - ditto
+	//	utility methods for panes
+	,	allowOverflow:		allowOverflow	// utility - pass calling element (this)
+	,	resetOverflow:		resetOverflow	// utility - ditto
+	//	layout control
+	,	destroy:			destroy			// method - no parameters
+	,	initPanes:			isInitialized	// method - no parameters
+	,	resizeAll:			resizeAll		// method - no parameters
+	//	callback triggering
+	,	runCallbacks:		_runCallbacks	// method - pass evtName & pane (if a pane-event), eg: trigger("onopen", "west")
+	//	alias collections of options, state and children - created in addPane and extended elsewhere
+	,	hasParentLayout:	false			// set by initContainer()
+	,	children:			children		// pointers to child-layouts, eg: Instance.children["west"]
+	,	north:				false			// alias group: { name: pane, pane: $Ps[pane], options: options[pane], state: state[pane], child: children[pane] }
+	,	south:				false			// ditto
+	,	west:				false			// ditto
+	,	east:				false			// ditto
+	,	center:				false			// ditto
+	};
+
+	// create the border layout NOW
+	if (_create() === 'cancel') // onload_start callback returned false to CANCEL layout creation
+		return null;
+	else // true OR false -- if layout-elements did NOT init (hidden or do not exist), can auto-init later
+		return Instance; // return the Instance object
+
+}
+
+
+/*	OLD versions of jQuery only set $.support.boxModel after page is loaded
+ *	so if this is IE, use support.boxModel to test for quirks-mode (ONLY IE changes boxModel).
+ */
+$(function(){
+	var b = $.layout.browser;
+	if (b.msie) b.boxModel = $.support.boxModel;
+});
+
+
+/**
+ * jquery.layout.state 1.0
+ * $Date: 2011-07-16 08:00:00 (Sat, 16 July 2011) $
+ *
+ * Copyright (c) 2010 
+ *   Kevin Dalman (http://allpro.net)
+ *
+ * Dual licensed under the GPL (http://www.gnu.org/licenses/gpl.html)
+ * and MIT (http://www.opensource.org/licenses/mit-license.php) licenses.
+ *
+ * @dependancies: UI Layout 1.3.0.rc30.1 or higher
+ * @dependancies: $.ui.cookie (above)
+ *
+ * @support: http://groups.google.com/group/jquery-ui-layout
+ */
+/*
+ *	State-management options stored in options.stateManagement, which includes a .cookie hash
+ *	Default options saves ALL KEYS for ALL PANES, ie: pane.size, pane.isClosed, pane.isHidden
+ *
+ *	// STATE/COOKIE OPTIONS
+ *	@example $(el).layout({
+				stateManagement: {
+					enabled:	true
+				,	stateKeys:	"east.size,west.size,east.isClosed,west.isClosed"
+				,	cookie:		{ name: "appLayout", path: "/" }
+				}
+			})
+ *	@example $(el).layout({ stateManagement__enabled: true }) // enable auto-state-management using cookies
+ *	@example $(el).layout({ stateManagement__cookie: { name: "appLayout", path: "/" } })
+ *	@example $(el).layout({ stateManagement__cookie__name: "appLayout", stateManagement__cookie__path: "/" })
+ *
+ *	// STATE/COOKIE METHODS
+ *	@example myLayout.saveCookie( "west.isClosed,north.size,south.isHidden", {expires: 7} );
+ *	@example myLayout.loadCookie();
+ *	@example myLayout.deleteCookie();
+ *	@example var JSON = myLayout.readState();	// CURRENT Layout State
+ *	@example var JSON = myLayout.readCookie();	// SAVED Layout State (from cookie)
+ *	@example var JSON = myLayout.state.stateData;	// LAST LOADED Layout State (cookie saved in layout.state hash)
+ *
+ *	CUSTOM STATE-MANAGEMENT (eg, saved in a database)
+ *	@example var JSON = myLayout.readState( "west.isClosed,north.size,south.isHidden" );
+ *	@example myLayout.loadState( JSON );
+ */
+
+/**
+ *	UI COOKIE UTILITY
+ *
+ *	A $.cookie OR $.ui.cookie namespace *should be standard*, but until then...
+ *	This creates $.ui.cookie so Layout does not need the cookie.jquery.js plugin
+ *	NOTE: This utility is REQUIRED by the layout.state plugin
+ *
+ *	Cookie methods in Layout are created as part of State Management 
+ */
+if (!$.ui) $.ui = {};
+$.ui.cookie = {
+
+	// cookieEnabled is not in DOM specs, but DOES works in all browsers,including IE6
+	acceptsCookies: !!navigator.cookieEnabled
+
+,	read: function (name) {
+		var
+			c		= document.cookie
+		,	cs		= c ? c.split(';') : []
+		,	pair	// loop var
+		;
+		for (var i=0, n=cs.length; i < n; i++) {
+			pair = $.trim(cs[i]).split('='); // name=value pair
+			if (pair[0] == name) // found the layout cookie
+				return decodeURIComponent(pair[1]);
+
+		}
+		return null;
+	}
+
+,	write: function (name, val, cookieOpts) {
+		var
+			params	= ''
+		,	date	= ''
+		,	clear	= false
+		,	o		= cookieOpts || {}
+		,	x		= o.expires
+		;
+		if (x && x.toUTCString)
+			date = x;
+		else if (x === null || typeof x === 'number') {
+			date = new Date();
+			if (x > 0)
+				date.setDate(date.getDate() + x);
+			else {
+				date.setFullYear(1970);
+				clear = true;
+			}
+		}
+		if (date)		params += ';expires='+ date.toUTCString();
+		if (o.path)		params += ';path='+ o.path;
+		if (o.domain)	params += ';domain='+ o.domain;
+		if (o.secure)	params += ';secure';
+		document.cookie = name +'='+ (clear ? "" : encodeURIComponent( val )) + params; // write or clear cookie
+	}
+
+,	clear: function (name) {
+		$.ui.cookie.write(name, '', {expires: -1});
+	}
+
+};
+// if cookie.jquery.js is not loaded, create an alias to replicate it
+// this may be useful to other plugins or code dependent on that plugin
+if (!$.cookie) $.cookie = function (k, v, o) {
+	var C = $.ui.cookie;
+	if (v === null)
+		C.clear(k);
+	else if (v === undefined)
+		return C.read(k);
+	else
+		C.write(k, v, o);
+};
+
+
+// tell Layout that the state plugin is available
+$.layout.plugins.stateManagement = true;
+
+//	Add State-Management options to layout.defaults
+$.layout.config.optionRootKeys.push("stateManagement");
+$.layout.defaults.stateManagement = {
+	enabled:	false	// true = enable state-management, even if not using cookies
+,	autoSave:	true	// Save a state-cookie when page exits?
+,	autoLoad:	true	// Load the state-cookie when Layout inits?
+	// List state-data to save - must be pane-specific
+,	stateKeys:	"north.size,south.size,east.size,west.size,"+
+				"north.isClosed,south.isClosed,east.isClosed,west.isClosed,"+
+				"north.isHidden,south.isHidden,east.isHidden,west.isHidden"
+,	cookie: {
+		name:	""	// If not specified, will use Layout.name, else just "Layout"
+	,	domain:	""	// blank = current domain
+	,	path:	""	// blank = current page, '/' = entire website
+	,	expires: ""	// 'days' to keep cookie - leave blank for 'session cookie'
+	,	secure:	false
+	}
+};
+// Set stateManagement as a layout-option, NOT a pane-option
+$.layout.optionsMap.layout.push("stateManagement");
+
+/*
+ *	State Management methods
+ */
+$.layout.state = {
+
+	/**
+	 * Get the current layout state and save it to a cookie
+	 *
+	 * myLayout.saveCookie( keys, cookieOpts )
+	 *
+	 * @param {Object}			inst
+	 * @param {(string|Array)=}	keys
+	 * @param {Object=}			cookieOpts
+	 */
+	saveCookie: function (inst, keys, cookieOpts) {
+		var o	= inst.options
+		,	oS	= o.stateManagement
+		,	oC	= $.extend(true, {}, oS.cookie, cookieOpts || null)
+		,	data = inst.state.stateData = inst.readState( keys || oS.stateKeys ) // read current panes-state
+		;
+		$.ui.cookie.write( oC.name || o.name || "Layout", $.layout.state.encodeJSON(data), oC );
+		return $.extend(true, {}, data); // return COPY of state.stateData data
+	}
+
+	/**
+	 * Remove the state cookie
+	 *
+	 * @param {Object}	inst
+	 */
+,	deleteCookie: function (inst) {
+		var o = inst.options;
+		$.ui.cookie.clear( o.stateManagement.cookie.name || o.name || "Layout" );
+	}
+
+	/**
+	 * Read & return data from the cookie - as JSON
+	 *
+	 * @param {Object}	inst
+	 */
+,	readCookie: function (inst) {
+		var o = inst.options;
+		var c = $.ui.cookie.read( o.stateManagement.cookie.name || o.name || "Layout" );
+		// convert cookie string back to a hash and return it
+		return c ? $.layout.state.decodeJSON(c) : {};
+	}
+
+	/**
+	 * Get data from the cookie and USE IT to loadState
+	 *
+	 * @param {Object}	inst
+	 */
+,	loadCookie: function (inst) {
+		var c = $.layout.state.readCookie(inst); // READ the cookie
+		if (c) {
+			inst.state.stateData = $.extend(true, {}, c); // SET state.stateData
+			inst.loadState(c); // LOAD the retrieved state
+		}
+		return c;
+	}
+	
+	/**
+	 * Update layout options from the cookie, if one exists
+	 *
+	 * @param {Object}		inst
+	 * @param {Object=}		stateData
+	 * @param {boolean=}	animate
+	 */
+,	loadState: function (inst, stateData, animate) {
+		stateData = $.layout.transformData( stateData ); // panes = default subkey
+		if ($.isEmptyObject( stateData )) return;
+		$.extend(true, inst.options, stateData); // update layout options
+		// if layout has already been initialized, then UPDATE layout state
+		if (inst.state.initialized) {
+			var pane, vis, o, s, h, c
+			,	noAnimate = (animate===false)
+			;
+			$.each($.layout.config.borderPanes, function (idx, pane) {
+				state = inst.state[pane];
+				o = stateData[ pane ];
+				if (typeof o != 'object') return; // no key, continue
+				s	= o.size;
+				c	= o.initClosed;
+				h	= o.initHidden;
+				vis	= state.isVisible;
+				// resize BEFORE opening
+				if (!vis)
+					inst.sizePane(pane, s, false, false);
+				if (h === true)			inst.hide(pane, noAnimate);
+				else if (c === false)	inst.open (pane, false, noAnimate);
+				else if (c === true)	inst.close(pane, false, noAnimate);
+				else if (h === false)	inst.show (pane, false, noAnimate);
+				// resize AFTER any other actions
+				if (vis)
+					inst.sizePane(pane, s, false, noAnimate); // animate resize if option passed
+			});
+		};
+	}
+
+	/**
+	 * Get the *current layout state* and return it as a hash
+	 *
+	 * @param {Object=}			inst
+	 * @param {(string|Array)=}	keys
+	 */
+,	readState: function (inst, keys) {
+		var
+			data	= {}
+		,	alt		= { isClosed: 'initClosed', isHidden: 'initHidden' }
+		,	state	= inst.state
+		,	panes	= $.layout.config.allPanes
+		,	pair, pane, key, val
+		;
+		if (!keys) keys = inst.options.stateManagement.stateKeys; // if called by user
+		if ($.isArray(keys)) keys = keys.join(",");
+		// convert keys to an array and change delimiters from '__' to '.'
+		keys = keys.replace(/__/g, ".").split(',');
+		// loop keys and create a data hash
+		for (var i=0, n=keys.length; i < n; i++) {
+			pair = keys[i].split(".");
+			pane = pair[0];
+			key  = pair[1];
+			if ($.inArray(pane, panes) < 0) continue; // bad pane!
+			val = state[ pane ][ key ];
+			if (val == undefined) continue;
+			if (key=="isClosed" && state[pane]["isSliding"])
+				val = true; // if sliding, then *really* isClosed
+			( data[pane] || (data[pane]={}) )[ alt[key] ? alt[key] : key ] = val;
+		}
+		return data;
+	}
+
+	/**
+	 *	Stringify a JSON hash so can save in a cookie or db-field
+	 */
+,	encodeJSON: function (JSON) {
+		return parse(JSON);
+		function parse (h) {
+			var D=[], i=0, k, v, t; // k = key, v = value
+			for (k in h) {
+				v = h[k];
+				t = typeof v;
+				if (t == 'string')		// STRING - add quotes
+					v = '"'+ v +'"';
+				else if (t == 'object')	// SUB-KEY - recurse into it
+					v = parse(v);
+				D[i++] = '"'+ k +'":'+ v;
+			}
+			return '{'+ D.join(',') +'}';
+		};
+	}
+
+	/**
+	 *	Convert stringified JSON back to a hash object
+	 *	@see		$.parseJSON(), adding in jQuery 1.4.1
+	 */
+,	decodeJSON: function (str) {
+		try { return $.parseJSON ? $.parseJSON(str) : window["eval"]("("+ str +")") || {}; }
+		catch (e) { return {}; }
+	}
+
+
+,	_create: function (inst) {
+		var _	= $.layout.state;
+		//	ADD State-Management plugin methods to inst
+		 $.extend( inst, {
+		//	readCookie - update options from cookie - returns hash of cookie data
+			readCookie:		function () { return _.readCookie(inst); }
+		//	deleteCookie
+		,	deleteCookie:	function () { _.deleteCookie(inst); }
+		//	saveCookie - optionally pass keys-list and cookie-options (hash)
+		,	saveCookie:		function (keys, cookieOpts) { return _.saveCookie(inst, keys, cookieOpts); }
+		//	loadCookie - readCookie and use to loadState() - returns hash of cookie data
+		,	loadCookie:		function () { return _.loadCookie(inst); }
+		//	loadState - pass a hash of state to use to update options
+		,	loadState:		function (stateData, animate) { _.loadState(inst, stateData, animate); }
+		//	readState - returns hash of current layout-state
+		,	readState:		function (keys) { return _.readState(inst, keys); }
+		//	add JSON utility methods too...
+		,	encodeJSON:		_.encodeJSON
+		,	decodeJSON:		_.decodeJSON
+		});
+
+		// init state.stateData key, even if plugin is initially disabled
+		inst.state.stateData = {};
+
+		// read and load cookie-data per options
+		var oS = inst.options.stateManagement;
+		if (oS.enabled) {
+			if (oS.autoLoad) // update the options from the cookie
+				inst.loadCookie();
+			else // don't modify options - just store cookie data in state.stateData
+				inst.state.stateData = inst.readCookie();
+		}
+	}
+
+,	_unload: function (inst) {
+		var oS = inst.options.stateManagement;
+		if (oS.enabled) {
+			if (oS.autoSave) // save a state-cookie automatically
+				inst.saveCookie();
+			else // don't save a cookie, but do store state-data in state.stateData key
+				inst.state.stateData = inst.readState();
+		}
+	}
+
+};
+
+// add state initialization method to Layout's onCreate array of functions
+$.layout.onCreate.push( $.layout.state._create );
+$.layout.onUnload.push( $.layout.state._unload );
+
+
+
+
+/**
+ * jquery.layout.buttons 1.0
+ * $Date: 2011-07-16 08:00:00 (Sat, 16 July 2011) $
+ *
+ * Copyright (c) 2010 
+ *   Kevin Dalman (http://allpro.net)
+ *
+ * Dual licensed under the GPL (http://www.gnu.org/licenses/gpl.html)
+ * and MIT (http://www.opensource.org/licenses/mit-license.php) licenses.
+ *
+ * @dependancies: UI Layout 1.3.0.rc30.1 or higher
+ *
+ * @support: http://groups.google.com/group/jquery-ui-layout
+ *
+ * Docs: [ to come ]
+ * Tips: [ to come ]
+ */
+
+// tell Layout that the state plugin is available
+$.layout.plugins.buttons = true;
+
+//	Add buttons options to layout.defaults
+$.layout.defaults.autoBindCustomButtons = false;
+// Specify autoBindCustomButtons as a layout-option, NOT a pane-option
+$.layout.optionsMap.layout.push("autoBindCustomButtons");
+
+/*
+ *	Button methods
+ */
+$.layout.buttons = {
+
+	/**
+	* Searches for .ui-layout-button-xxx elements and auto-binds them as layout-buttons
+	*
+	* @see  _create()
+	*
+	* @param  {Object}		inst	Layout Instance object
+	*/
+	init: function (inst) {
+		var pre		= "ui-layout-button-"
+		,	layout	= inst.options.name || ""
+		,	name;
+		$.each("toggle,open,close,pin,toggle-slide,open-slide".split(","), function (i, action) {
+			$.each($.layout.config.borderPanes, function (ii, pane) {
+				$("."+pre+action+"-"+pane).each(function(){
+					// if button was previously 'bound', data.layoutName was set, but is blank if layout has no 'name'
+					name = $(this).data("layoutName") || $(this).attr("layoutName");
+					if (name == undefined || name === layout)
+						inst.bindButton(this, action, pane);
+				});
+			});
+		});
+	}
+
+	/**
+	* Helper function to validate params received by addButton utilities
+	*
+	* Two classes are added to the element, based on the buttonClass...
+	* The type of button is appended to create the 2nd className:
+	*  - ui-layout-button-pin		// action btnClass
+	*  - ui-layout-button-pin-west	// action btnClass + pane
+	*  - ui-layout-button-toggle
+	*  - ui-layout-button-open
+	*  - ui-layout-button-close
+	*
+	* @param {Object}			inst		Layout Instance object
+	* @param {(string|!Object)}	selector	jQuery selector (or element) for button, eg: ".ui-layout-north .toggle-button"
+	* @param {string}   		pane 		Name of the pane the button is for: 'north', 'south', etc.
+	*
+	* @return {Array.<Object>}	If both params valid, the element matching 'selector' in a jQuery wrapper - otherwise returns null
+	*/
+,	get: function (inst, selector, pane, action) {
+		var $E	= $(selector)
+		,	o	= inst.options
+		,	err	= o.errors.addButtonError
+		;
+		if (!$E.length) { // element not found
+			$.layout.msg(err +" "+ o.errors.selector +": "+ selector, true);
+		}
+		else if ($.inArray(pane, $.layout.config.borderPanes) < 0) { // invalid 'pane' sepecified
+			$.layout.msg(err +" "+ o.errors.pane +": "+ pane, true);
+			$E = $("");  // NO BUTTON
+		}
+		else { // VALID
+			var btn = o[pane].buttonClass +"-"+ action;
+			$E	.addClass( btn +" "+ btn +"-"+ pane )
+				.data("layoutName", o.name); // add layout identifier - even if blank!
+		}
+		return $E;
+	}
+
+
+	/**
+	* NEW syntax for binding layout-buttons - will eventually replace addToggle, addOpen, etc.
+	*
+	* @param {Object}			inst		Layout Instance object
+	* @param {(string|!Object)}	selector	jQuery selector (or element) for button, eg: ".ui-layout-north .toggle-button"
+	* @param {string}			action
+	* @param {string}			pane
+	*/
+,	bind: function (inst, selector, action, pane) {
+		var _ = $.layout.buttons;
+		switch (action.toLowerCase()) {
+			case "toggle":			_.addToggle	(inst, selector, pane); break;	
+			case "open":			_.addOpen	(inst, selector, pane); break;
+			case "close":			_.addClose	(inst, selector, pane); break;
+			case "pin":				_.addPin	(inst, selector, pane); break;
+			case "toggle-slide":	_.addToggle	(inst, selector, pane, true); break;	
+			case "open-slide":		_.addOpen	(inst, selector, pane, true); break;
+		}
+		return inst;
+	}
+
+	/**
+	* Add a custom Toggler button for a pane
+	*
+	* @param {Object}			inst		Layout Instance object
+	* @param {(string|!Object)}	selector	jQuery selector (or element) for button, eg: ".ui-layout-north .toggle-button"
+	* @param {string}  			pane 		Name of the pane the button is for: 'north', 'south', etc.
+	* @param {boolean=}			slide 		true = slide-open, false = pin-open
+	*/
+,	addToggle: function (inst, selector, pane, slide) {
+		$.layout.buttons.get(inst, selector, pane, "toggle")
+			.click(function(evt){
+				inst.toggle(pane, !!slide);
+				evt.stopPropagation();
+			});
+		return inst;
+	}
+
+	/**
+	* Add a custom Open button for a pane
+	*
+	* @param {Object}			inst		Layout Instance object
+	* @param {(string|!Object)}	selector	jQuery selector (or element) for button, eg: ".ui-layout-north .toggle-button"
+	* @param {string}			pane 		Name of the pane the button is for: 'north', 'south', etc.
+	* @param {boolean=}			slide 		true = slide-open, false = pin-open
+	*/
+,	addOpen: function (inst, selector, pane, slide) {
+		$.layout.buttons.get(inst, selector, pane, "open")
+			.attr("title", inst.options[pane].tips.Close)
+			.click(function (evt) {
+				inst.open(pane, !!slide);
+				evt.stopPropagation();
+			});
+		return inst;
+	}
+
+	/**
+	* Add a custom Close button for a pane
+	*
+	* @param {Object}			inst		Layout Instance object
+	* @param {(string|!Object)}	selector	jQuery selector (or element) for button, eg: ".ui-layout-north .toggle-button"
+	* @param {string}   		pane 		Name of the pane the button is for: 'north', 'south', etc.
+	*/
+,	addClose: function (inst, selector, pane) {
+		$.layout.buttons.get(inst, selector, pane, "close")
+			.attr("title", inst.options[pane].tips.Open)
+			.click(function (evt) {
+				inst.close(pane);
+				evt.stopPropagation();
+			});
+		return inst;
+	}
+
+	/**
+	* Add a custom Pin button for a pane
+	*
+	* Four classes are added to the element, based on the paneClass for the associated pane...
+	* Assuming the default paneClass and the pin is 'up', these classes are added for a west-pane pin:
+	*  - ui-layout-pane-pin
+	*  - ui-layout-pane-west-pin
+	*  - ui-layout-pane-pin-up
+	*  - ui-layout-pane-west-pin-up
+	*
+	* @param {Object}			inst		Layout Instance object
+	* @param {(string|!Object)}	selector	jQuery selector (or element) for button, eg: ".ui-layout-north .toggle-button"
+	* @param {string}   		pane 		Name of the pane the pin is for: 'north', 'south', etc.
+	*/
+,	addPin: function (inst, selector, pane) {
+		var	_	= $.layout.buttons
+		,	$E	= _.get(inst, selector, pane, "pin");
+		if ($E.length) {
+			var s = inst.state[pane];
+			$E.click(function (evt) {
+				_.setPinState(inst, $(this), pane, (s.isSliding || s.isClosed));
+				if (s.isSliding || s.isClosed) inst.open( pane ); // change from sliding to open
+				else inst.close( pane ); // slide-closed
+				evt.stopPropagation();
+			});
+			// add up/down pin attributes and classes
+			_.setPinState(inst, $E, pane, (!s.isClosed && !s.isSliding));
+			// add this pin to the pane data so we can 'sync it' automatically
+			// PANE.pins key is an array so we can store multiple pins for each pane
+			s.pins.push( selector ); // just save the selector string
+		}
+		return inst;
+	}
+
+	/**
+	* Change the class of the pin button to make it look 'up' or 'down'
+	*
+	* @see  addPin(), syncPins()
+	*
+	* @param {Object}			inst	Layout Instance object
+	* @param {Array.<Object>}	$Pin	The pin-span element in a jQuery wrapper
+	* @param {string}			pane	These are the params returned to callbacks by layout()
+	* @param {boolean}			doPin	true = set the pin 'down', false = set it 'up'
+	*/
+,	setPinState: function (inst, $Pin, pane, doPin) {
+		var updown = $Pin.attr("pin");
+		if (updown && doPin === (updown=="down")) return; // already in correct state
+		var
+			o		= inst.options[pane]
+		,	pin		= o.buttonClass +"-pin"
+		,	side	= pin +"-"+ pane
+		,	UP		= pin +"-up "+	side +"-up"
+		,	DN		= pin +"-down "+side +"-down"
+		;
+		$Pin
+			.attr("pin", doPin ? "down" : "up") // logic
+			.attr("title", doPin ? o.tips.Unpin : o.tips.Pin)
+			.removeClass( doPin ? UP : DN ) 
+			.addClass( doPin ? DN : UP ) 
+		;
+	}
+
+	/**
+	* INTERNAL function to sync 'pin buttons' when pane is opened or closed
+	* Unpinned means the pane is 'sliding' - ie, over-top of the adjacent panes
+	*
+	* @see  open(), close()
+	*
+	* @param {Object}			inst	Layout Instance object
+	* @param {string}	pane	These are the params returned to callbacks by layout()
+	* @param {boolean}	doPin	True means set the pin 'down', False means 'up'
+	*/
+,	syncPinBtns: function (inst, pane, doPin) {
+		// REAL METHOD IS _INSIDE_ LAYOUT - THIS IS HERE JUST FOR REFERENCE
+		$.each(inst.state[pane].pins, function (i, selector) {
+			$.layout.buttons.setPinState(inst, $(selector), pane, doPin);
+		});
+	}
+
+
+,	_load: function (inst) {
+		var	_	= $.layout.buttons;
+		// ADD Button methods to Layout Instance
+		// Note: sel = jQuery Selector string
+		$.extend( inst, {
+			bindButton:		function (sel, action, pane) { return _.bind(inst, sel, action, pane); }
+		//	DEPRECATED METHODS
+		,	addToggleBtn:	function (sel, pane, slide) { return _.addToggle(inst, sel, pane, slide); }
+		,	addOpenBtn:		function (sel, pane, slide) { return _.addOpen(inst, sel, pane, slide); }
+		,	addCloseBtn:	function (sel, pane) { return _.addClose(inst, sel, pane); }
+		,	addPinBtn:		function (sel, pane) { return _.addPin(inst, sel, pane); }
+		});
+
+		// init state array to hold pin-buttons
+		for (var i=0; i<4; i++) {
+			var pane = $.layout.config.borderPanes[i];
+			inst.state[pane].pins = [];
+		}
+
+		// auto-init buttons onLoad if option is enabled
+		if ( inst.options.autoBindCustomButtons )
+			_.init(inst);
+	}
+
+,	_unload: function (inst) {
+		// TODO: unbind all buttons???
+	}
+
+};
+
+// add initialization method to Layout's onLoad array of functions
+$.layout.onLoad.push(  $.layout.buttons._load );
+//$.layout.onUnload.push( $.layout.buttons._unload );
+
+
+
+/**
+ * jquery.layout.browserZoom 1.0
+ * $Date: 2011-12-29 08:00:00 (Thu, 29 Dec 2011) $
+ *
+ * Copyright (c) 2012 
+ *   Kevin Dalman (http://allpro.net)
+ *
+ * Dual licensed under the GPL (http://www.gnu.org/licenses/gpl.html)
+ * and MIT (http://www.opensource.org/licenses/mit-license.php) licenses.
+ *
+ * @dependancies: UI Layout 1.3.0.rc30.1 or higher
+ *
+ * @support: http://groups.google.com/group/jquery-ui-layout
+ *
+ * @todo: Extend logic to handle other problematic zooming in browsers
+ * @todo: Add hotkey/mousewheel bindings to _instantly_ respond to these zoom event
+ */
+
+// tell Layout that the plugin is available
+$.layout.plugins.browserZoom = true;
+
+$.layout.defaults.browserZoomCheckInterval = 1000;
+$.layout.optionsMap.layout.push("browserZoomCheckInterval");
+
+/*
+ *	browserZoom methods
+ */
+$.layout.browserZoom = {
+
+	_init: function (inst) {
+		// abort if browser does not need this check
+		if ($.layout.browserZoom.ratio() !== false)
+			$.layout.browserZoom._setTimer(inst);
+	}
+
+,	_setTimer: function (inst) {
+		// abort if layout destroyed or browser does not need this check
+		if (inst.destroyed) return;
+		var o	= inst.options
+		,	s	= inst.state
+		//	don't need check if inst has parentLayout, but check occassionally in case parent destroyed!
+		//	MINIMUM 100ms interval, for performance
+		,	ms	= inst.hasParentLayout ?  5000 : Math.max( o.browserZoomCheckInterval, 100 )
+		;
+		// set the timer
+		setTimeout(function(){
+			if (inst.destroyed || !o.resizeWithWindow) return;
+			var d = $.layout.browserZoom.ratio();
+			if (d !== s.browserZoom) {
+				s.browserZoom = d;
+				inst.resizeAll();
+			}
+			// set a NEW timeout
+			$.layout.browserZoom._setTimer(inst);
+		}
+		,	ms );
+	}
+
+,	ratio: function () {
+		var w	= window
+		,	s	= screen
+		,	d	= document
+		,	dE	= d.documentElement || d.body
+		,	b	= $.layout.browser
+		,	v	= b.version
+		,	r, sW, cW
+		;
+		// we can ignore all browsers that fire window.resize event onZoom
+		if ((b.msie && v > 8)
+		||	!b.msie
+		) return false; // don't need to track zoom
+
+		if (s.deviceXDPI)
+			return calc(s.deviceXDPI, s.systemXDPI);
+		// everything below is just for future reference!
+		if (b.webkit && (r = d.body.getBoundingClientRect))
+			return calc((r.left - r.right), d.body.offsetWidth);
+		if (b.webkit && (sW = w.outerWidth))
+			return calc(sW, w.innerWidth);
+		if ((sW = s.width) && (cW = dE.clientWidth))
+			return calc(sW, cW);
+		return false; // no match, so cannot - or don't need to - track zoom
+
+		function calc (x,y) { return (parseInt(x,10) / parseInt(y,10) * 100).toFixed(); }
+	}
+
+};
+// add initialization method to Layout's onLoad array of functions
+$.layout.onReady.push( $.layout.browserZoom._init );
+
+
+
+})( jQuery );
+ static/jquery.scrollTo.js view
@@ -0,0 +1,215 @@+/**
+ * jQuery.ScrollTo
+ * Copyright (c) 2007-2009 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
+ * Dual licensed under MIT and GPL.
+ * Date: 5/25/2009
+ *
+ * @projectDescription Easy element scrolling using jQuery.
+ * http://flesler.blogspot.com/2007/10/jqueryscrollto.html
+ * Works with jQuery +1.2.6. Tested on FF 2/3, IE 6/7/8, Opera 9.5/6, Safari 3, Chrome 1 on WinXP.
+ *
+ * @author Ariel Flesler
+ * @version 1.4.2
+ *
+ * @id jQuery.scrollTo
+ * @id jQuery.fn.scrollTo
+ * @param {String, Number, DOMElement, jQuery, Object} target Where to scroll the matched elements.
+ *	  The different options for target are:
+ *		- A number position (will be applied to all axes).
+ *		- A string position ('44', '100px', '+=90', etc ) will be applied to all axes
+ *		- A jQuery/DOM element ( logically, child of the element to scroll )
+ *		- A string selector, that will be relative to the element to scroll ( 'li:eq(2)', etc )
+ *		- A hash { top:x, left:y }, x and y can be any kind of number/string like above.
+*		- A percentage of the container's dimension/s, for example: 50% to go to the middle.
+ *		- The string 'max' for go-to-end. 
+ * @param {Number} duration The OVERALL length of the animation, this argument can be the settings object instead.
+ * @param {Object,Function} settings Optional set of settings or the onAfter callback.
+ *	 @option {String} axis Which axis must be scrolled, use 'x', 'y', 'xy' or 'yx'.
+ *	 @option {Number} duration The OVERALL length of the animation.
+ *	 @option {String} easing The easing method for the animation.
+ *	 @option {Boolean} margin If true, the margin of the target element will be deducted from the final position.
+ *	 @option {Object, Number} offset Add/deduct from the end position. One number for both axes or { top:x, left:y }.
+ *	 @option {Object, Number} over Add/deduct the height/width multiplied by 'over', can be { top:x, left:y } when using both axes.
+ *	 @option {Boolean} queue If true, and both axis are given, the 2nd axis will only be animated after the first one ends.
+ *	 @option {Function} onAfter Function to be called after the scrolling ends. 
+ *	 @option {Function} onAfterFirst If queuing is activated, this function will be called after the first scrolling ends.
+ * @return {jQuery} Returns the same jQuery object, for chaining.
+ *
+ * @desc Scroll to a fixed position
+ * @example $('div').scrollTo( 340 );
+ *
+ * @desc Scroll relatively to the actual position
+ * @example $('div').scrollTo( '+=340px', { axis:'y' } );
+ *
+ * @dec Scroll using a selector (relative to the scrolled element)
+ * @example $('div').scrollTo( 'p.paragraph:eq(2)', 500, { easing:'swing', queue:true, axis:'xy' } );
+ *
+ * @ Scroll to a DOM element (same for jQuery object)
+ * @example var second_child = document.getElementById('container').firstChild.nextSibling;
+ *			$('#container').scrollTo( second_child, { duration:500, axis:'x', onAfter:function(){
+ *				alert('scrolled!!');																   
+ *			}});
+ *
+ * @desc Scroll on both axes, to different values
+ * @example $('div').scrollTo( { top: 300, left:'+=200' }, { axis:'xy', offset:-20 } );
+ */
+;(function( $ ){
+	
+	var $scrollTo = $.scrollTo = function( target, duration, settings ){
+		$(window).scrollTo( target, duration, settings );
+	};
+
+	$scrollTo.defaults = {
+		axis:'xy',
+		duration: parseFloat($.fn.jquery) >= 1.3 ? 0 : 1
+	};
+
+	// Returns the element that needs to be animated to scroll the window.
+	// Kept for backwards compatibility (specially for localScroll & serialScroll)
+	$scrollTo.window = function( scope ){
+		return $(window)._scrollable();
+	};
+
+	// Hack, hack, hack :)
+	// Returns the real elements to scroll (supports window/iframes, documents and regular nodes)
+	$.fn._scrollable = function(){
+		return this.map(function(){
+			var elem = this,
+				isWin = !elem.nodeName || $.inArray( elem.nodeName.toLowerCase(), ['iframe','#document','html','body'] ) != -1;
+
+				if( !isWin )
+					return elem;
+
+			var doc = (elem.contentWindow || elem).document || elem.ownerDocument || elem;
+			
+			return $.browser.safari || doc.compatMode == 'BackCompat' ?
+				doc.body : 
+				doc.documentElement;
+		});
+	};
+
+	$.fn.scrollTo = function( target, duration, settings ){
+		if( typeof duration == 'object' ){
+			settings = duration;
+			duration = 0;
+		}
+		if( typeof settings == 'function' )
+			settings = { onAfter:settings };
+			
+		if( target == 'max' )
+			target = 9e9;
+			
+		settings = $.extend( {}, $scrollTo.defaults, settings );
+		// Speed is still recognized for backwards compatibility
+		duration = duration || settings.speed || settings.duration;
+		// Make sure the settings are given right
+		settings.queue = settings.queue && settings.axis.length > 1;
+		
+		if( settings.queue )
+			// Let's keep the overall duration
+			duration /= 2;
+		settings.offset = both( settings.offset );
+		settings.over = both( settings.over );
+
+		return this._scrollable().each(function(){
+			var elem = this,
+				$elem = $(elem),
+				targ = target, toff, attr = {},
+				win = $elem.is('html,body');
+
+			switch( typeof targ ){
+				// A number will pass the regex
+				case 'number':
+				case 'string':
+					if( /^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(targ) ){
+						targ = both( targ );
+						// We are done
+						break;
+					}
+					// Relative selector, no break!
+					targ = $(targ,this);
+				case 'object':
+					// DOMElement / jQuery
+					if( targ.is || targ.style )
+						// Get the real position of the target 
+						toff = (targ = $(targ)).offset();
+			}
+			$.each( settings.axis.split(''), function( i, axis ){
+				var Pos	= axis == 'x' ? 'Left' : 'Top',
+					pos = Pos.toLowerCase(),
+					key = 'scroll' + Pos,
+					old = elem[key],
+					max = $scrollTo.max(elem, axis);
+
+				if( toff ){// jQuery / DOMElement
+					attr[key] = toff[pos] + ( win ? 0 : old - $elem.offset()[pos] );
+
+					// If it's a dom element, reduce the margin
+					if( settings.margin ){
+						attr[key] -= parseInt(targ.css('margin'+Pos)) || 0;
+						attr[key] -= parseInt(targ.css('border'+Pos+'Width')) || 0;
+					}
+					
+					attr[key] += settings.offset[pos] || 0;
+					
+					if( settings.over[pos] )
+						// Scroll to a fraction of its width/height
+						attr[key] += targ[axis=='x'?'width':'height']() * settings.over[pos];
+				}else{ 
+					var val = targ[pos];
+					// Handle percentage values
+					attr[key] = val.slice && val.slice(-1) == '%' ? 
+						parseFloat(val) / 100 * max
+						: val;
+				}
+
+				// Number or 'number'
+				if( /^\d+$/.test(attr[key]) )
+					// Check the limits
+					attr[key] = attr[key] <= 0 ? 0 : Math.min( attr[key], max );
+
+				// Queueing axes
+				if( !i && settings.queue ){
+					// Don't waste time animating, if there's no need.
+					if( old != attr[key] )
+						// Intermediate animation
+						animate( settings.onAfterFirst );
+					// Don't animate this axis again in the next iteration.
+					delete attr[key];
+				}
+			});
+
+			animate( settings.onAfter );			
+
+			function animate( callback ){
+				$elem.animate( attr, duration, settings.easing, callback && function(){
+					callback.call(this, target, settings);
+				});
+			};
+
+		}).end();
+	};
+	
+	// Max scrolling position, works on quirks mode
+	// It only fails (not too badly) on IE, quirks mode.
+	$scrollTo.max = function( elem, axis ){
+		var Dim = axis == 'x' ? 'Width' : 'Height',
+			scroll = 'scroll'+Dim;
+		
+		if( !$(elem).is('html,body') )
+			return elem[scroll] - $(elem)[Dim.toLowerCase()]();
+		
+		var size = 'client' + Dim,
+			html = elem.ownerDocument.documentElement,
+			body = elem.ownerDocument.body;
+
+		return Math.max( html[scroll], body[scroll] ) 
+			 - Math.min( html[size]  , body[size]   );
+			
+	};
+
+	function both( val ){
+		return typeof val == 'object' ? val : { top:val, left:val };
+	};
+
+})( jQuery );
+ static/layout/changelog.txt view
@@ -0,0 +1,60 @@+1.2.0
+* ADDED maskIframesOnResize option: true=ALL -OR- a selector string
+* ADDED options to set different animations on open and close
+* ADDED new callback events, ie: onshow, onhide
+* ADDED start/end callbacks, eg: onopen_start, onopen_end, etc.
+* ADDED ability to cancel events using callbacks, eg: onopen_start
+* CHANGED Layout.config.fxDefaults to Layout.effects (internal use)
+* FIXED missing semi-colon so minified version works in IE
+
+1.1.3
+* FIXED typo in cursor-hotkeys code
+* ADDED scrollToBookmarkOnLoad options - enables use of URL hash:
+    o www.site.com/page.html#myBookmark
+    o AFTER layout is created, attempts to scroll to bookmark
+    o default = true - otherwise bookmarks are non-functional
+
+1.1.2
+* UPDATED paneSelector rules to handle FORMS and pane-nesting
+    o automatically looks for panes inside 'first form' in container
+    o if using an ID as paneSelector, pane can be 'deeply nested'
+* ADDED auto-CSS for 'containers' other than BODY
+    o overflow: hidden   - ensures no scrollbars on container
+    o position: relative - IF NOT: fixed, absolute or relative
+    o height:   100%     - IF NOT specified or is 'auto'
+* ADDED noAnimation param to open() and close() - not used internally
+
+1.1.1
+* CHANGED toggler element from a SPAN to a DIV
+* CHANGED auto-generated custom-buttons classes for better consistency
+    o [buttonClass]-[pane]-[buttonType] ==> [buttonClass]-[buttonType]-[pane]
+    o ui-layout-button-west-open ==> ui-layout-button-open-west
+    o ui-layout-button-west-pin-up ==> ui-layout-button-pin-west-up
+* CHANGED default for hideTogglerOnSlide to false
+* CHANGED internal 'cDims' hash to alias for state.container
+* CHANGED internal aliases: s = state[pane] and o = options[pane]
+* UPDATED toggler-text to auto-show correct spans (content-open/closed)
+* FIXED toggler-text - now centers text span correctly
+* FIXED bug affecting IE6 when layout has no north or south pane
+* ADDED new layout property 'state' - eg: myLayout.state.west.size
+* REMOVED layout.containerDimensions property - USE: layout.state.container
+* CHANGED data returned to callbacks - added pane-state as 3rd param
+
+1.1.0
+* RENAMED raisePaneZindexOnHover ==> showOverflowOnHover
+* REMOVED "overflow: auto" from base-styles. Overflow must now be set by 
+    CSS - unless applyDefaultStyles==true. No longer need "!important" to 
+	set pane overflow in your stylesheet.
+* CHANGED minSize default from 50 to 0 (still auto-limited to 'css size')
+* FIXED bug in allowOverflow - now works with 'custom paneClass'
+* EXPOSED two CSS utility methods
+    o myLayout.cssWidth( elem )
+    o myLayout.cssHeight( elem )
+* NEW auto-resize for ALL layouts on windows.resize 
+* UPDATED auto-resizing of panes after a container-resize
+* NEW flow-code to prevent simultaneous pane animations
+* NEW options to add text inside toggler-buttons
+* NEW options for hotkeys - standard (cursors) and user-defined 
+
+1.0
+* Initial release
+ static/layout/example.html view
@@ -0,0 +1,23 @@+<HTML>
+<HEAD>
+<TITLE>Layout Example</TITLE>
+<SCRIPT type="text/javascript" src="jquery.js"></SCRIPT>
+<SCRIPT type="text/javascript" src="jquery.layout.js"></SCRIPT>
+<SCRIPT type="text/javascript">
+$(document).ready(function () {
+	$('body').layout({ applyDefaultStyles: true });
+});
+</SCRIPT>
+</HEAD>
+<BODY>
+<DIV class="ui-layout-center">Center
+	<P><A href="http://layout.jquery-dev.net/demos.html">Go to the Demos page</A></P>
+	<P>* Pane-resizing is disabled because ui.draggable.js is not linked</P>
+	<P>* Pane-animation is disabled because ui.effects.js is not linked</P>
+</DIV>
+<DIV class="ui-layout-north">North</DIV>
+<DIV class="ui-layout-south">South</DIV>
+<DIV class="ui-layout-east">East</DIV>
+<DIV class="ui-layout-west">West</DIV>
+</BODY>
+</HTML>
+ static/layout/jquery.js view
@@ -0,0 +1,3549 @@+(function(){+/*+ * jQuery 1.2.6 - New Wave Javascript+ *+ * Copyright (c) 2008 John Resig (jquery.com)+ * Dual licensed under the MIT (MIT-LICENSE.txt)+ * and GPL (GPL-LICENSE.txt) licenses.+ *+ * $Date: 2008-05-24 14:22:17 -0400 (Sat, 24 May 2008) $+ * $Rev: 5685 $+ */++// Map over jQuery in case of overwrite+var _jQuery = window.jQuery,+// Map over the $ in case of overwrite+	_$ = window.$;++var jQuery = window.jQuery = window.$ = function( selector, context ) {+	// The jQuery object is actually just the init constructor 'enhanced'+	return new jQuery.fn.init( selector, context );+};++// A simple way to check for HTML strings or ID strings+// (both of which we optimize for)+var quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/,++// Is it a simple selector+	isSimple = /^.[^:#\[\.]*$/,++// Will speed up references to undefined, and allows munging its name.+	undefined;++jQuery.fn = jQuery.prototype = {+	init: function( selector, context ) {+		// Make sure that a selection was provided+		selector = selector || document;++		// Handle $(DOMElement)+		if ( selector.nodeType ) {+			this[0] = selector;+			this.length = 1;+			return this;+		}+		// Handle HTML strings+		if ( typeof selector == "string" ) {+			// Are we dealing with HTML string or an ID?+			var match = quickExpr.exec( selector );++			// Verify a match, and that no context was specified for #id+			if ( match && (match[1] || !context) ) {++				// HANDLE: $(html) -> $(array)+				if ( match[1] )+					selector = jQuery.clean( [ match[1] ], context );++				// HANDLE: $("#id")+				else {+					var elem = document.getElementById( match[3] );++					// Make sure an element was located+					if ( elem ){+						// Handle the case where IE and Opera return items+						// by name instead of ID+						if ( elem.id != match[3] )+							return jQuery().find( selector );++						// Otherwise, we inject the element directly into the jQuery object+						return jQuery( elem );+					}+					selector = [];+				}++			// HANDLE: $(expr, [context])+			// (which is just equivalent to: $(content).find(expr)+			} else+				return jQuery( context ).find( selector );++		// HANDLE: $(function)+		// Shortcut for document ready+		} else if ( jQuery.isFunction( selector ) )+			return jQuery( document )[ jQuery.fn.ready ? "ready" : "load" ]( selector );++		return this.setArray(jQuery.makeArray(selector));+	},++	// The current version of jQuery being used+	jquery: "1.2.6",++	// The number of elements contained in the matched element set+	size: function() {+		return this.length;+	},++	// The number of elements contained in the matched element set+	length: 0,++	// Get the Nth element in the matched element set OR+	// Get the whole matched element set as a clean array+	get: function( num ) {+		return num == undefined ?++			// Return a 'clean' array+			jQuery.makeArray( this ) :++			// Return just the object+			this[ num ];+	},++	// Take an array of elements and push it onto the stack+	// (returning the new matched element set)+	pushStack: function( elems ) {+		// Build a new jQuery matched element set+		var ret = jQuery( elems );++		// Add the old object onto the stack (as a reference)+		ret.prevObject = this;++		// Return the newly-formed element set+		return ret;+	},++	// Force the current matched set of elements to become+	// the specified array of elements (destroying the stack in the process)+	// You should use pushStack() in order to do this, but maintain the stack+	setArray: function( elems ) {+		// Resetting the length to 0, then using the native Array push+		// is a super-fast way to populate an object with array-like properties+		this.length = 0;+		Array.prototype.push.apply( this, elems );++		return this;+	},++	// Execute a callback for every element in the matched set.+	// (You can seed the arguments with an array of args, but this is+	// only used internally.)+	each: function( callback, args ) {+		return jQuery.each( this, callback, args );+	},++	// Determine the position of an element within+	// the matched set of elements+	index: function( elem ) {+		var ret = -1;++		// Locate the position of the desired element+		return jQuery.inArray(+			// If it receives a jQuery object, the first element is used+			elem && elem.jquery ? elem[0] : elem+		, this );+	},++	attr: function( name, value, type ) {+		var options = name;++		// Look for the case where we're accessing a style value+		if ( name.constructor == String )+			if ( value === undefined )+				return this[0] && jQuery[ type || "attr" ]( this[0], name );++			else {+				options = {};+				options[ name ] = value;+			}++		// Check to see if we're setting style values+		return this.each(function(i){+			// Set all the styles+			for ( name in options )+				jQuery.attr(+					type ?+						this.style :+						this,+					name, jQuery.prop( this, options[ name ], type, i, name )+				);+		});+	},++	css: function( key, value ) {+		// ignore negative width and height values+		if ( (key == 'width' || key == 'height') && parseFloat(value) < 0 )+			value = undefined;+		return this.attr( key, value, "curCSS" );+	},++	text: function( text ) {+		if ( typeof text != "object" && text != null )+			return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) );++		var ret = "";++		jQuery.each( text || this, function(){+			jQuery.each( this.childNodes, function(){+				if ( this.nodeType != 8 )+					ret += this.nodeType != 1 ?+						this.nodeValue :+						jQuery.fn.text( [ this ] );+			});+		});++		return ret;+	},++	wrapAll: function( html ) {+		if ( this[0] )+			// The elements to wrap the target around+			jQuery( html, this[0].ownerDocument )+				.clone()+				.insertBefore( this[0] )+				.map(function(){+					var elem = this;++					while ( elem.firstChild )+						elem = elem.firstChild;++					return elem;+				})+				.append(this);++		return this;+	},++	wrapInner: function( html ) {+		return this.each(function(){+			jQuery( this ).contents().wrapAll( html );+		});+	},++	wrap: function( html ) {+		return this.each(function(){+			jQuery( this ).wrapAll( html );+		});+	},++	append: function() {+		return this.domManip(arguments, true, false, function(elem){+			if (this.nodeType == 1)+				this.appendChild( elem );+		});+	},++	prepend: function() {+		return this.domManip(arguments, true, true, function(elem){+			if (this.nodeType == 1)+				this.insertBefore( elem, this.firstChild );+		});+	},++	before: function() {+		return this.domManip(arguments, false, false, function(elem){+			this.parentNode.insertBefore( elem, this );+		});+	},++	after: function() {+		return this.domManip(arguments, false, true, function(elem){+			this.parentNode.insertBefore( elem, this.nextSibling );+		});+	},++	end: function() {+		return this.prevObject || jQuery( [] );+	},++	find: function( selector ) {+		var elems = jQuery.map(this, function(elem){+			return jQuery.find( selector, elem );+		});++		return this.pushStack( /[^+>] [^+>]/.test( selector ) || selector.indexOf("..") > -1 ?+			jQuery.unique( elems ) :+			elems );+	},++	clone: function( events ) {+		// Do the clone+		var ret = this.map(function(){+			if ( jQuery.browser.msie && !jQuery.isXMLDoc(this) ) {+				// IE copies events bound via attachEvent when+				// using cloneNode. Calling detachEvent on the+				// clone will also remove the events from the orignal+				// In order to get around this, we use innerHTML.+				// Unfortunately, this means some modifications to+				// attributes in IE that are actually only stored+				// as properties will not be copied (such as the+				// the name attribute on an input).+				var clone = this.cloneNode(true),+					container = document.createElement("div");+				container.appendChild(clone);+				return jQuery.clean([container.innerHTML])[0];+			} else+				return this.cloneNode(true);+		});++		// Need to set the expando to null on the cloned set if it exists+		// removeData doesn't work here, IE removes it from the original as well+		// this is primarily for IE but the data expando shouldn't be copied over in any browser+		var clone = ret.find("*").andSelf().each(function(){+			if ( this[ expando ] != undefined )+				this[ expando ] = null;+		});++		// Copy the events from the original to the clone+		if ( events === true )+			this.find("*").andSelf().each(function(i){+				if (this.nodeType == 3)+					return;+				var events = jQuery.data( this, "events" );++				for ( var type in events )+					for ( var handler in events[ type ] )+						jQuery.event.add( clone[ i ], type, events[ type ][ handler ], events[ type ][ handler ].data );+			});++		// Return the cloned set+		return ret;+	},++	filter: function( selector ) {+		return this.pushStack(+			jQuery.isFunction( selector ) &&+			jQuery.grep(this, function(elem, i){+				return selector.call( elem, i );+			}) ||++			jQuery.multiFilter( selector, this ) );+	},++	not: function( selector ) {+		if ( selector.constructor == String )+			// test special case where just one selector is passed in+			if ( isSimple.test( selector ) )+				return this.pushStack( jQuery.multiFilter( selector, this, true ) );+			else+				selector = jQuery.multiFilter( selector, this );++		var isArrayLike = selector.length && selector[selector.length - 1] !== undefined && !selector.nodeType;+		return this.filter(function() {+			return isArrayLike ? jQuery.inArray( this, selector ) < 0 : this != selector;+		});+	},++	add: function( selector ) {+		return this.pushStack( jQuery.unique( jQuery.merge(+			this.get(),+			typeof selector == 'string' ?+				jQuery( selector ) :+				jQuery.makeArray( selector )+		)));+	},++	is: function( selector ) {+		return !!selector && jQuery.multiFilter( selector, this ).length > 0;+	},++	hasClass: function( selector ) {+		return this.is( "." + selector );+	},++	val: function( value ) {+		if ( value == undefined ) {++			if ( this.length ) {+				var elem = this[0];++				// We need to handle select boxes special+				if ( jQuery.nodeName( elem, "select" ) ) {+					var index = elem.selectedIndex,+						values = [],+						options = elem.options,+						one = elem.type == "select-one";++					// Nothing was selected+					if ( index < 0 )+						return null;++					// Loop through all the selected options+					for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) {+						var option = options[ i ];++						if ( option.selected ) {+							// Get the specifc value for the option+							value = jQuery.browser.msie && !option.attributes.value.specified ? option.text : option.value;++							// We don't need an array for one selects+							if ( one )+								return value;++							// Multi-Selects return an array+							values.push( value );+						}+					}++					return values;++				// Everything else, we just grab the value+				} else+					return (this[0].value || "").replace(/\r/g, "");++			}++			return undefined;+		}++		if( value.constructor == Number )+			value += '';++		return this.each(function(){+			if ( this.nodeType != 1 )+				return;++			if ( value.constructor == Array && /radio|checkbox/.test( this.type ) )+				this.checked = (jQuery.inArray(this.value, value) >= 0 ||+					jQuery.inArray(this.name, value) >= 0);++			else if ( jQuery.nodeName( this, "select" ) ) {+				var values = jQuery.makeArray(value);++				jQuery( "option", this ).each(function(){+					this.selected = (jQuery.inArray( this.value, values ) >= 0 ||+						jQuery.inArray( this.text, values ) >= 0);+				});++				if ( !values.length )+					this.selectedIndex = -1;++			} else+				this.value = value;+		});+	},++	html: function( value ) {+		return value == undefined ?+			(this[0] ?+				this[0].innerHTML :+				null) :+			this.empty().append( value );+	},++	replaceWith: function( value ) {+		return this.after( value ).remove();+	},++	eq: function( i ) {+		return this.slice( i, i + 1 );+	},++	slice: function() {+		return this.pushStack( Array.prototype.slice.apply( this, arguments ) );+	},++	map: function( callback ) {+		return this.pushStack( jQuery.map(this, function(elem, i){+			return callback.call( elem, i, elem );+		}));+	},++	andSelf: function() {+		return this.add( this.prevObject );+	},++	data: function( key, value ){+		var parts = key.split(".");+		parts[1] = parts[1] ? "." + parts[1] : "";++		if ( value === undefined ) {+			var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);++			if ( data === undefined && this.length )+				data = jQuery.data( this[0], key );++			return data === undefined && parts[1] ?+				this.data( parts[0] ) :+				data;+		} else+			return this.trigger("setData" + parts[1] + "!", [parts[0], value]).each(function(){+				jQuery.data( this, key, value );+			});+	},++	removeData: function( key ){+		return this.each(function(){+			jQuery.removeData( this, key );+		});+	},++	domManip: function( args, table, reverse, callback ) {+		var clone = this.length > 1, elems;++		return this.each(function(){+			if ( !elems ) {+				elems = jQuery.clean( args, this.ownerDocument );++				if ( reverse )+					elems.reverse();+			}++			var obj = this;++			if ( table && jQuery.nodeName( this, "table" ) && jQuery.nodeName( elems[0], "tr" ) )+				obj = this.getElementsByTagName("tbody")[0] || this.appendChild( this.ownerDocument.createElement("tbody") );++			var scripts = jQuery( [] );++			jQuery.each(elems, function(){+				var elem = clone ?+					jQuery( this ).clone( true )[0] :+					this;++				// execute all scripts after the elements have been injected+				if ( jQuery.nodeName( elem, "script" ) )+					scripts = scripts.add( elem );+				else {+					// Remove any inner scripts for later evaluation+					if ( elem.nodeType == 1 )+						scripts = scripts.add( jQuery( "script", elem ).remove() );++					// Inject the elements into the document+					callback.call( obj, elem );+				}+			});++			scripts.each( evalScript );+		});+	}+};++// Give the init function the jQuery prototype for later instantiation+jQuery.fn.init.prototype = jQuery.fn;++function evalScript( i, elem ) {+	if ( elem.src )+		jQuery.ajax({+			url: elem.src,+			async: false,+			dataType: "script"+		});++	else+		jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" );++	if ( elem.parentNode )+		elem.parentNode.removeChild( elem );+}++function now(){+	return +new Date;+}++jQuery.extend = jQuery.fn.extend = function() {+	// copy reference to target object+	var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options;++	// Handle a deep copy situation+	if ( target.constructor == Boolean ) {+		deep = target;+		target = arguments[1] || {};+		// skip the boolean and the target+		i = 2;+	}++	// Handle case when target is a string or something (possible in deep copy)+	if ( typeof target != "object" && typeof target != "function" )+		target = {};++	// extend jQuery itself if only one argument is passed+	if ( length == i ) {+		target = this;+		--i;+	}++	for ( ; i < length; i++ )+		// Only deal with non-null/undefined values+		if ( (options = arguments[ i ]) != null )+			// Extend the base object+			for ( var name in options ) {+				var src = target[ name ], copy = options[ name ];++				// Prevent never-ending loop+				if ( target === copy )+					continue;++				// Recurse if we're merging object values+				if ( deep && copy && typeof copy == "object" && !copy.nodeType )+					target[ name ] = jQuery.extend( deep, +						// Never move original objects, clone them+						src || ( copy.length != null ? [ ] : { } )+					, copy );++				// Don't bring in undefined values+				else if ( copy !== undefined )+					target[ name ] = copy;++			}++	// Return the modified object+	return target;+};++var expando = "jQuery" + now(), uuid = 0, windowData = {},+	// exclude the following css properties to add px+	exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i,+	// cache defaultView+	defaultView = document.defaultView || {};++jQuery.extend({+	noConflict: function( deep ) {+		window.$ = _$;++		if ( deep )+			window.jQuery = _jQuery;++		return jQuery;+	},++	// See test/unit/core.js for details concerning this function.+	isFunction: function( fn ) {+		return !!fn && typeof fn != "string" && !fn.nodeName &&+			fn.constructor != Array && /^[\s[]?function/.test( fn + "" );+	},++	// check if an element is in a (or is an) XML document+	isXMLDoc: function( elem ) {+		return elem.documentElement && !elem.body ||+			elem.tagName && elem.ownerDocument && !elem.ownerDocument.body;+	},++	// Evalulates a script in a global context+	globalEval: function( data ) {+		data = jQuery.trim( data );++		if ( data ) {+			// Inspired by code by Andrea Giammarchi+			// http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html+			var head = document.getElementsByTagName("head")[0] || document.documentElement,+				script = document.createElement("script");++			script.type = "text/javascript";+			if ( jQuery.browser.msie )+				script.text = data;+			else+				script.appendChild( document.createTextNode( data ) );++			// Use insertBefore instead of appendChild  to circumvent an IE6 bug.+			// This arises when a base node is used (#2709).+			head.insertBefore( script, head.firstChild );+			head.removeChild( script );+		}+	},++	nodeName: function( elem, name ) {+		return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase();+	},++	cache: {},++	data: function( elem, name, data ) {+		elem = elem == window ?+			windowData :+			elem;++		var id = elem[ expando ];++		// Compute a unique ID for the element+		if ( !id )+			id = elem[ expando ] = ++uuid;++		// Only generate the data cache if we're+		// trying to access or manipulate it+		if ( name && !jQuery.cache[ id ] )+			jQuery.cache[ id ] = {};++		// Prevent overriding the named cache with undefined values+		if ( data !== undefined )+			jQuery.cache[ id ][ name ] = data;++		// Return the named cache data, or the ID for the element+		return name ?+			jQuery.cache[ id ][ name ] :+			id;+	},++	removeData: function( elem, name ) {+		elem = elem == window ?+			windowData :+			elem;++		var id = elem[ expando ];++		// If we want to remove a specific section of the element's data+		if ( name ) {+			if ( jQuery.cache[ id ] ) {+				// Remove the section of cache data+				delete jQuery.cache[ id ][ name ];++				// If we've removed all the data, remove the element's cache+				name = "";++				for ( name in jQuery.cache[ id ] )+					break;++				if ( !name )+					jQuery.removeData( elem );+			}++		// Otherwise, we want to remove all of the element's data+		} else {+			// Clean up the element expando+			try {+				delete elem[ expando ];+			} catch(e){+				// IE has trouble directly removing the expando+				// but it's ok with using removeAttribute+				if ( elem.removeAttribute )+					elem.removeAttribute( expando );+			}++			// Completely remove the data cache+			delete jQuery.cache[ id ];+		}+	},++	// args is for internal usage only+	each: function( object, callback, args ) {+		var name, i = 0, length = object.length;++		if ( args ) {+			if ( length == undefined ) {+				for ( name in object )+					if ( callback.apply( object[ name ], args ) === false )+						break;+			} else+				for ( ; i < length; )+					if ( callback.apply( object[ i++ ], args ) === false )+						break;++		// A special, fast, case for the most common use of each+		} else {+			if ( length == undefined ) {+				for ( name in object )+					if ( callback.call( object[ name ], name, object[ name ] ) === false )+						break;+			} else+				for ( var value = object[0];+					i < length && callback.call( value, i, value ) !== false; value = object[++i] ){}+		}++		return object;+	},++	prop: function( elem, value, type, i, name ) {+		// Handle executable functions+		if ( jQuery.isFunction( value ) )+			value = value.call( elem, i );++		// Handle passing in a number to a CSS property+		return value && value.constructor == Number && type == "curCSS" && !exclude.test( name ) ?+			value + "px" :+			value;+	},++	className: {+		// internal only, use addClass("class")+		add: function( elem, classNames ) {+			jQuery.each((classNames || "").split(/\s+/), function(i, className){+				if ( elem.nodeType == 1 && !jQuery.className.has( elem.className, className ) )+					elem.className += (elem.className ? " " : "") + className;+			});+		},++		// internal only, use removeClass("class")+		remove: function( elem, classNames ) {+			if (elem.nodeType == 1)+				elem.className = classNames != undefined ?+					jQuery.grep(elem.className.split(/\s+/), function(className){+						return !jQuery.className.has( classNames, className );+					}).join(" ") :+					"";+		},++		// internal only, use hasClass("class")+		has: function( elem, className ) {+			return jQuery.inArray( className, (elem.className || elem).toString().split(/\s+/) ) > -1;+		}+	},++	// A method for quickly swapping in/out CSS properties to get correct calculations+	swap: function( elem, options, callback ) {+		var old = {};+		// Remember the old values, and insert the new ones+		for ( var name in options ) {+			old[ name ] = elem.style[ name ];+			elem.style[ name ] = options[ name ];+		}++		callback.call( elem );++		// Revert the old values+		for ( var name in options )+			elem.style[ name ] = old[ name ];+	},++	css: function( elem, name, force ) {+		if ( name == "width" || name == "height" ) {+			var val, props = { position: "absolute", visibility: "hidden", display:"block" }, which = name == "width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ];++			function getWH() {+				val = name == "width" ? elem.offsetWidth : elem.offsetHeight;+				var padding = 0, border = 0;+				jQuery.each( which, function() {+					padding += parseFloat(jQuery.curCSS( elem, "padding" + this, true)) || 0;+					border += parseFloat(jQuery.curCSS( elem, "border" + this + "Width", true)) || 0;+				});+				val -= Math.round(padding + border);+			}++			if ( jQuery(elem).is(":visible") )+				getWH();+			else+				jQuery.swap( elem, props, getWH );++			return Math.max(0, val);+		}++		return jQuery.curCSS( elem, name, force );+	},++	curCSS: function( elem, name, force ) {+		var ret, style = elem.style;++		// A helper method for determining if an element's values are broken+		function color( elem ) {+			if ( !jQuery.browser.safari )+				return false;++			// defaultView is cached+			var ret = defaultView.getComputedStyle( elem, null );+			return !ret || ret.getPropertyValue("color") == "";+		}++		// We need to handle opacity special in IE+		if ( name == "opacity" && jQuery.browser.msie ) {+			ret = jQuery.attr( style, "opacity" );++			return ret == "" ?+				"1" :+				ret;+		}+		// Opera sometimes will give the wrong display answer, this fixes it, see #2037+		if ( jQuery.browser.opera && name == "display" ) {+			var save = style.outline;+			style.outline = "0 solid black";+			style.outline = save;+		}++		// Make sure we're using the right name for getting the float value+		if ( name.match( /float/i ) )+			name = styleFloat;++		if ( !force && style && style[ name ] )+			ret = style[ name ];++		else if ( defaultView.getComputedStyle ) {++			// Only "float" is needed here+			if ( name.match( /float/i ) )+				name = "float";++			name = name.replace( /([A-Z])/g, "-$1" ).toLowerCase();++			var computedStyle = defaultView.getComputedStyle( elem, null );++			if ( computedStyle && !color( elem ) )+				ret = computedStyle.getPropertyValue( name );++			// If the element isn't reporting its values properly in Safari+			// then some display: none elements are involved+			else {+				var swap = [], stack = [], a = elem, i = 0;++				// Locate all of the parent display: none elements+				for ( ; a && color(a); a = a.parentNode )+					stack.unshift(a);++				// Go through and make them visible, but in reverse+				// (It would be better if we knew the exact display type that they had)+				for ( ; i < stack.length; i++ )+					if ( color( stack[ i ] ) ) {+						swap[ i ] = stack[ i ].style.display;+						stack[ i ].style.display = "block";+					}++				// Since we flip the display style, we have to handle that+				// one special, otherwise get the value+				ret = name == "display" && swap[ stack.length - 1 ] != null ?+					"none" :+					( computedStyle && computedStyle.getPropertyValue( name ) ) || "";++				// Finally, revert the display styles back+				for ( i = 0; i < swap.length; i++ )+					if ( swap[ i ] != null )+						stack[ i ].style.display = swap[ i ];+			}++			// We should always get a number back from opacity+			if ( name == "opacity" && ret == "" )+				ret = "1";++		} else if ( elem.currentStyle ) {+			var camelCase = name.replace(/\-(\w)/g, function(all, letter){+				return letter.toUpperCase();+			});++			ret = elem.currentStyle[ name ] || elem.currentStyle[ camelCase ];++			// From the awesome hack by Dean Edwards+			// http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291++			// If we're not dealing with a regular pixel number+			// but a number that has a weird ending, we need to convert it to pixels+			if ( !/^\d+(px)?$/i.test( ret ) && /^\d/.test( ret ) ) {+				// Remember the original values+				var left = style.left, rsLeft = elem.runtimeStyle.left;++				// Put in the new values to get a computed value out+				elem.runtimeStyle.left = elem.currentStyle.left;+				style.left = ret || 0;+				ret = style.pixelLeft + "px";++				// Revert the changed values+				style.left = left;+				elem.runtimeStyle.left = rsLeft;+			}+		}++		return ret;+	},++	clean: function( elems, context ) {+		var ret = [];+		context = context || document;+		// !context.createElement fails in IE with an error but returns typeof 'object'+		if (typeof context.createElement == 'undefined')+			context = context.ownerDocument || context[0] && context[0].ownerDocument || document;++		jQuery.each(elems, function(i, elem){+			if ( !elem )+				return;++			if ( elem.constructor == Number )+				elem += '';++			// Convert html string into DOM nodes+			if ( typeof elem == "string" ) {+				// Fix "XHTML"-style tags in all browsers+				elem = elem.replace(/(<(\w+)[^>]*?)\/>/g, function(all, front, tag){+					return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i) ?+						all :+						front + "></" + tag + ">";+				});++				// Trim whitespace, otherwise indexOf won't work as expected+				var tags = jQuery.trim( elem ).toLowerCase(), div = context.createElement("div");++				var wrap =+					// option or optgroup+					!tags.indexOf("<opt") &&+					[ 1, "<select multiple='multiple'>", "</select>" ] ||++					!tags.indexOf("<leg") &&+					[ 1, "<fieldset>", "</fieldset>" ] ||++					tags.match(/^<(thead|tbody|tfoot|colg|cap)/) &&+					[ 1, "<table>", "</table>" ] ||++					!tags.indexOf("<tr") &&+					[ 2, "<table><tbody>", "</tbody></table>" ] ||++				 	// <thead> matched above+					(!tags.indexOf("<td") || !tags.indexOf("<th")) &&+					[ 3, "<table><tbody><tr>", "</tr></tbody></table>" ] ||++					!tags.indexOf("<col") &&+					[ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ] ||++					// IE can't serialize <link> and <script> tags normally+					jQuery.browser.msie &&+					[ 1, "div<div>", "</div>" ] ||++					[ 0, "", "" ];++				// Go to html and back, then peel off extra wrappers+				div.innerHTML = wrap[1] + elem + wrap[2];++				// Move to the right depth+				while ( wrap[0]-- )+					div = div.lastChild;++				// Remove IE's autoinserted <tbody> from table fragments+				if ( jQuery.browser.msie ) {++					// String was a <table>, *may* have spurious <tbody>+					var tbody = !tags.indexOf("<table") && tags.indexOf("<tbody") < 0 ?+						div.firstChild && div.firstChild.childNodes :++						// String was a bare <thead> or <tfoot>+						wrap[1] == "<table>" && tags.indexOf("<tbody") < 0 ?+							div.childNodes :+							[];++					for ( var j = tbody.length - 1; j >= 0 ; --j )+						if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length )+							tbody[ j ].parentNode.removeChild( tbody[ j ] );++					// IE completely kills leading whitespace when innerHTML is used+					if ( /^\s/.test( elem ) )+						div.insertBefore( context.createTextNode( elem.match(/^\s*/)[0] ), div.firstChild );++				}++				elem = jQuery.makeArray( div.childNodes );+			}++			if ( elem.length === 0 && (!jQuery.nodeName( elem, "form" ) && !jQuery.nodeName( elem, "select" )) )+				return;++			if ( elem[0] == undefined || jQuery.nodeName( elem, "form" ) || elem.options )+				ret.push( elem );++			else+				ret = jQuery.merge( ret, elem );++		});++		return ret;+	},++	attr: function( elem, name, value ) {+		// don't set attributes on text and comment nodes+		if (!elem || elem.nodeType == 3 || elem.nodeType == 8)+			return undefined;++		var notxml = !jQuery.isXMLDoc( elem ),+			// Whether we are setting (or getting)+			set = value !== undefined,+			msie = jQuery.browser.msie;++		// Try to normalize/fix the name+		name = notxml && jQuery.props[ name ] || name;++		// Only do all the following if this is a node (faster for style)+		// IE elem.getAttribute passes even for style+		if ( elem.tagName ) {++			// These attributes require special treatment+			var special = /href|src|style/.test( name );++			// Safari mis-reports the default selected property of a hidden option+			// Accessing the parent's selectedIndex property fixes it+			if ( name == "selected" && jQuery.browser.safari )+				elem.parentNode.selectedIndex;++			// If applicable, access the attribute via the DOM 0 way+			if ( name in elem && notxml && !special ) {+				if ( set ){+					// We can't allow the type property to be changed (since it causes problems in IE)+					if ( name == "type" && jQuery.nodeName( elem, "input" ) && elem.parentNode )+						throw "type property can't be changed";++					elem[ name ] = value;+				}++				// browsers index elements by id/name on forms, give priority to attributes.+				if( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) )+					return elem.getAttributeNode( name ).nodeValue;++				return elem[ name ];+			}++			if ( msie && notxml &&  name == "style" )+				return jQuery.attr( elem.style, "cssText", value );++			if ( set )+				// convert the value to a string (all browsers do this but IE) see #1070+				elem.setAttribute( name, "" + value );++			var attr = msie && notxml && special+					// Some attributes require a special call on IE+					? elem.getAttribute( name, 2 )+					: elem.getAttribute( name );++			// Non-existent attributes return null, we normalize to undefined+			return attr === null ? undefined : attr;+		}++		// elem is actually elem.style ... set the style++		// IE uses filters for opacity+		if ( msie && name == "opacity" ) {+			if ( set ) {+				// IE has trouble with opacity if it does not have layout+				// Force it by setting the zoom level+				elem.zoom = 1;++				// Set the alpha filter to set the opacity+				elem.filter = (elem.filter || "").replace( /alpha\([^)]*\)/, "" ) ++					(parseInt( value ) + '' == "NaN" ? "" : "alpha(opacity=" + value * 100 + ")");+			}++			return elem.filter && elem.filter.indexOf("opacity=") >= 0 ?+				(parseFloat( elem.filter.match(/opacity=([^)]*)/)[1] ) / 100) + '':+				"";+		}++		name = name.replace(/-([a-z])/ig, function(all, letter){+			return letter.toUpperCase();+		});++		if ( set )+			elem[ name ] = value;++		return elem[ name ];+	},++	trim: function( text ) {+		return (text || "").replace( /^\s+|\s+$/g, "" );+	},++	makeArray: function( array ) {+		var ret = [];++		if( array != null ){+			var i = array.length;+			//the window, strings and functions also have 'length'+			if( i == null || array.split || array.setInterval || array.call )+				ret[0] = array;+			else+				while( i )+					ret[--i] = array[i];+		}++		return ret;+	},++	inArray: function( elem, array ) {+		for ( var i = 0, length = array.length; i < length; i++ )+		// Use === because on IE, window == document+			if ( array[ i ] === elem )+				return i;++		return -1;+	},++	merge: function( first, second ) {+		// We have to loop this way because IE & Opera overwrite the length+		// expando of getElementsByTagName+		var i = 0, elem, pos = first.length;+		// Also, we need to make sure that the correct elements are being returned+		// (IE returns comment nodes in a '*' query)+		if ( jQuery.browser.msie ) {+			while ( elem = second[ i++ ] )+				if ( elem.nodeType != 8 )+					first[ pos++ ] = elem;++		} else+			while ( elem = second[ i++ ] )+				first[ pos++ ] = elem;++		return first;+	},++	unique: function( array ) {+		var ret = [], done = {};++		try {++			for ( var i = 0, length = array.length; i < length; i++ ) {+				var id = jQuery.data( array[ i ] );++				if ( !done[ id ] ) {+					done[ id ] = true;+					ret.push( array[ i ] );+				}+			}++		} catch( e ) {+			ret = array;+		}++		return ret;+	},++	grep: function( elems, callback, inv ) {+		var ret = [];++		// Go through the array, only saving the items+		// that pass the validator function+		for ( var i = 0, length = elems.length; i < length; i++ )+			if ( !inv != !callback( elems[ i ], i ) )+				ret.push( elems[ i ] );++		return ret;+	},++	map: function( elems, callback ) {+		var ret = [];++		// Go through the array, translating each of the items to their+		// new value (or values).+		for ( var i = 0, length = elems.length; i < length; i++ ) {+			var value = callback( elems[ i ], i );++			if ( value != null )+				ret[ ret.length ] = value;+		}++		return ret.concat.apply( [], ret );+	}+});++var userAgent = navigator.userAgent.toLowerCase();++// Figure out what browser is being used+jQuery.browser = {+	version: (userAgent.match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [])[1],+	safari: /webkit/.test( userAgent ),+	opera: /opera/.test( userAgent ),+	msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ),+	mozilla: /mozilla/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent )+};++var styleFloat = jQuery.browser.msie ?+	"styleFloat" :+	"cssFloat";++jQuery.extend({+	// Check to see if the W3C box model is being used+	boxModel: !jQuery.browser.msie || document.compatMode == "CSS1Compat",++	props: {+		"for": "htmlFor",+		"class": "className",+		"float": styleFloat,+		cssFloat: styleFloat,+		styleFloat: styleFloat,+		readonly: "readOnly",+		maxlength: "maxLength",+		cellspacing: "cellSpacing"+	}+});++jQuery.each({+	parent: function(elem){return elem.parentNode;},+	parents: function(elem){return jQuery.dir(elem,"parentNode");},+	next: function(elem){return jQuery.nth(elem,2,"nextSibling");},+	prev: function(elem){return jQuery.nth(elem,2,"previousSibling");},+	nextAll: function(elem){return jQuery.dir(elem,"nextSibling");},+	prevAll: function(elem){return jQuery.dir(elem,"previousSibling");},+	siblings: function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);},+	children: function(elem){return jQuery.sibling(elem.firstChild);},+	contents: function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);}+}, function(name, fn){+	jQuery.fn[ name ] = function( selector ) {+		var ret = jQuery.map( this, fn );++		if ( selector && typeof selector == "string" )+			ret = jQuery.multiFilter( selector, ret );++		return this.pushStack( jQuery.unique( ret ) );+	};+});++jQuery.each({+	appendTo: "append",+	prependTo: "prepend",+	insertBefore: "before",+	insertAfter: "after",+	replaceAll: "replaceWith"+}, function(name, original){+	jQuery.fn[ name ] = function() {+		var args = arguments;++		return this.each(function(){+			for ( var i = 0, length = args.length; i < length; i++ )+				jQuery( args[ i ] )[ original ]( this );+		});+	};+});++jQuery.each({+	removeAttr: function( name ) {+		jQuery.attr( this, name, "" );+		if (this.nodeType == 1)+			this.removeAttribute( name );+	},++	addClass: function( classNames ) {+		jQuery.className.add( this, classNames );+	},++	removeClass: function( classNames ) {+		jQuery.className.remove( this, classNames );+	},++	toggleClass: function( classNames ) {+		jQuery.className[ jQuery.className.has( this, classNames ) ? "remove" : "add" ]( this, classNames );+	},++	remove: function( selector ) {+		if ( !selector || jQuery.filter( selector, [ this ] ).r.length ) {+			// Prevent memory leaks+			jQuery( "*", this ).add(this).each(function(){+				jQuery.event.remove(this);+				jQuery.removeData(this);+			});+			if (this.parentNode)+				this.parentNode.removeChild( this );+		}+	},++	empty: function() {+		// Remove element nodes and prevent memory leaks+		jQuery( ">*", this ).remove();++		// Remove any remaining nodes+		while ( this.firstChild )+			this.removeChild( this.firstChild );+	}+}, function(name, fn){+	jQuery.fn[ name ] = function(){+		return this.each( fn, arguments );+	};+});++jQuery.each([ "Height", "Width" ], function(i, name){+	var type = name.toLowerCase();++	jQuery.fn[ type ] = function( size ) {+		// Get window width or height+		return this[0] == window ?+			// Opera reports document.body.client[Width/Height] properly in both quirks and standards+			jQuery.browser.opera && document.body[ "client" + name ] ||++			// Safari reports inner[Width/Height] just fine (Mozilla and Opera include scroll bar widths)+			jQuery.browser.safari && window[ "inner" + name ] ||++			// Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode+			document.compatMode == "CSS1Compat" && document.documentElement[ "client" + name ] || document.body[ "client" + name ] :++			// Get document width or height+			this[0] == document ?+				// Either scroll[Width/Height] or offset[Width/Height], whichever is greater+				Math.max(+					Math.max(document.body["scroll" + name], document.documentElement["scroll" + name]),+					Math.max(document.body["offset" + name], document.documentElement["offset" + name])+				) :++				// Get or set width or height on the element+				size == undefined ?+					// Get width or height on the element+					(this.length ? jQuery.css( this[0], type ) : null) :++					// Set the width or height on the element (default to pixels if value is unitless)+					this.css( type, size.constructor == String ? size : size + "px" );+	};+});++// Helper function used by the dimensions and offset modules+function num(elem, prop) {+	return elem[0] && parseInt( jQuery.curCSS(elem[0], prop, true), 10 ) || 0;+}var chars = jQuery.browser.safari && parseInt(jQuery.browser.version) < 417 ?+		"(?:[\\w*_-]|\\\\.)" :+		"(?:[\\w\u0128-\uFFFF*_-]|\\\\.)",+	quickChild = new RegExp("^>\\s*(" + chars + "+)"),+	quickID = new RegExp("^(" + chars + "+)(#)(" + chars + "+)"),+	quickClass = new RegExp("^([#.]?)(" + chars + "*)");++jQuery.extend({+	expr: {+		"": function(a,i,m){return m[2]=="*"||jQuery.nodeName(a,m[2]);},+		"#": function(a,i,m){return a.getAttribute("id")==m[2];},+		":": {+			// Position Checks+			lt: function(a,i,m){return i<m[3]-0;},+			gt: function(a,i,m){return i>m[3]-0;},+			nth: function(a,i,m){return m[3]-0==i;},+			eq: function(a,i,m){return m[3]-0==i;},+			first: function(a,i){return i==0;},+			last: function(a,i,m,r){return i==r.length-1;},+			even: function(a,i){return i%2==0;},+			odd: function(a,i){return i%2;},++			// Child Checks+			"first-child": function(a){return a.parentNode.getElementsByTagName("*")[0]==a;},+			"last-child": function(a){return jQuery.nth(a.parentNode.lastChild,1,"previousSibling")==a;},+			"only-child": function(a){return !jQuery.nth(a.parentNode.lastChild,2,"previousSibling");},++			// Parent Checks+			parent: function(a){return a.firstChild;},+			empty: function(a){return !a.firstChild;},++			// Text Check+			contains: function(a,i,m){return (a.textContent||a.innerText||jQuery(a).text()||"").indexOf(m[3])>=0;},++			// Visibility+			visible: function(a){return "hidden"!=a.type&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden";},+			hidden: function(a){return "hidden"==a.type||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden";},++			// Form attributes+			enabled: function(a){return !a.disabled;},+			disabled: function(a){return a.disabled;},+			checked: function(a){return a.checked;},+			selected: function(a){return a.selected||jQuery.attr(a,"selected");},++			// Form elements+			text: function(a){return "text"==a.type;},+			radio: function(a){return "radio"==a.type;},+			checkbox: function(a){return "checkbox"==a.type;},+			file: function(a){return "file"==a.type;},+			password: function(a){return "password"==a.type;},+			submit: function(a){return "submit"==a.type;},+			image: function(a){return "image"==a.type;},+			reset: function(a){return "reset"==a.type;},+			button: function(a){return "button"==a.type||jQuery.nodeName(a,"button");},+			input: function(a){return /input|select|textarea|button/i.test(a.nodeName);},++			// :has()+			has: function(a,i,m){return jQuery.find(m[3],a).length;},++			// :header+			header: function(a){return /h\d/i.test(a.nodeName);},++			// :animated+			animated: function(a){return jQuery.grep(jQuery.timers,function(fn){return a==fn.elem;}).length;}+		}+	},++	// The regular expressions that power the parsing engine+	parse: [+		// Match: [@value='test'], [@foo]+		/^(\[) *@?([\w-]+) *([!*$^~=]*) *('?"?)(.*?)\4 *\]/,++		// Match: :contains('foo')+		/^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/,++		// Match: :even, :last-child, #id, .class+		new RegExp("^([:.#]*)(" + chars + "+)")+	],++	multiFilter: function( expr, elems, not ) {+		var old, cur = [];++		while ( expr && expr != old ) {+			old = expr;+			var f = jQuery.filter( expr, elems, not );+			expr = f.t.replace(/^\s*,\s*/, "" );+			cur = not ? elems = f.r : jQuery.merge( cur, f.r );+		}++		return cur;+	},++	find: function( t, context ) {+		// Quickly handle non-string expressions+		if ( typeof t != "string" )+			return [ t ];++		// check to make sure context is a DOM element or a document+		if ( context && context.nodeType != 1 && context.nodeType != 9)+			return [ ];++		// Set the correct context (if none is provided)+		context = context || document;++		// Initialize the search+		var ret = [context], done = [], last, nodeName;++		// Continue while a selector expression exists, and while+		// we're no longer looping upon ourselves+		while ( t && last != t ) {+			var r = [];+			last = t;++			t = jQuery.trim(t);++			var foundToken = false,++			// An attempt at speeding up child selectors that+			// point to a specific element tag+				re = quickChild,++				m = re.exec(t);++			if ( m ) {+				nodeName = m[1].toUpperCase();++				// Perform our own iteration and filter+				for ( var i = 0; ret[i]; i++ )+					for ( var c = ret[i].firstChild; c; c = c.nextSibling )+						if ( c.nodeType == 1 && (nodeName == "*" || c.nodeName.toUpperCase() == nodeName) )+							r.push( c );++				ret = r;+				t = t.replace( re, "" );+				if ( t.indexOf(" ") == 0 ) continue;+				foundToken = true;+			} else {+				re = /^([>+~])\s*(\w*)/i;++				if ( (m = re.exec(t)) != null ) {+					r = [];++					var merge = {};+					nodeName = m[2].toUpperCase();+					m = m[1];++					for ( var j = 0, rl = ret.length; j < rl; j++ ) {+						var n = m == "~" || m == "+" ? ret[j].nextSibling : ret[j].firstChild;+						for ( ; n; n = n.nextSibling )+							if ( n.nodeType == 1 ) {+								var id = jQuery.data(n);++								if ( m == "~" && merge[id] ) break;++								if (!nodeName || n.nodeName.toUpperCase() == nodeName ) {+									if ( m == "~" ) merge[id] = true;+									r.push( n );+								}++								if ( m == "+" ) break;+							}+					}++					ret = r;++					// And remove the token+					t = jQuery.trim( t.replace( re, "" ) );+					foundToken = true;+				}+			}++			// See if there's still an expression, and that we haven't already+			// matched a token+			if ( t && !foundToken ) {+				// Handle multiple expressions+				if ( !t.indexOf(",") ) {+					// Clean the result set+					if ( context == ret[0] ) ret.shift();++					// Merge the result sets+					done = jQuery.merge( done, ret );++					// Reset the context+					r = ret = [context];++					// Touch up the selector string+					t = " " + t.substr(1,t.length);++				} else {+					// Optimize for the case nodeName#idName+					var re2 = quickID;+					var m = re2.exec(t);++					// Re-organize the results, so that they're consistent+					if ( m ) {+						m = [ 0, m[2], m[3], m[1] ];++					} else {+						// Otherwise, do a traditional filter check for+						// ID, class, and element selectors+						re2 = quickClass;+						m = re2.exec(t);+					}++					m[2] = m[2].replace(/\\/g, "");++					var elem = ret[ret.length-1];++					// Try to do a global search by ID, where we can+					if ( m[1] == "#" && elem && elem.getElementById && !jQuery.isXMLDoc(elem) ) {+						// Optimization for HTML document case+						var oid = elem.getElementById(m[2]);++						// Do a quick check for the existence of the actual ID attribute+						// to avoid selecting by the name attribute in IE+						// also check to insure id is a string to avoid selecting an element with the name of 'id' inside a form+						if ( (jQuery.browser.msie||jQuery.browser.opera) && oid && typeof oid.id == "string" && oid.id != m[2] )+							oid = jQuery('[@id="'+m[2]+'"]', elem)[0];++						// Do a quick check for node name (where applicable) so+						// that div#foo searches will be really fast+						ret = r = oid && (!m[3] || jQuery.nodeName(oid, m[3])) ? [oid] : [];+					} else {+						// We need to find all descendant elements+						for ( var i = 0; ret[i]; i++ ) {+							// Grab the tag name being searched for+							var tag = m[1] == "#" && m[3] ? m[3] : m[1] != "" || m[0] == "" ? "*" : m[2];++							// Handle IE7 being really dumb about <object>s+							if ( tag == "*" && ret[i].nodeName.toLowerCase() == "object" )+								tag = "param";++							r = jQuery.merge( r, ret[i].getElementsByTagName( tag ));+						}++						// It's faster to filter by class and be done with it+						if ( m[1] == "." )+							r = jQuery.classFilter( r, m[2] );++						// Same with ID filtering+						if ( m[1] == "#" ) {+							var tmp = [];++							// Try to find the element with the ID+							for ( var i = 0; r[i]; i++ )+								if ( r[i].getAttribute("id") == m[2] ) {+									tmp = [ r[i] ];+									break;+								}++							r = tmp;+						}++						ret = r;+					}++					t = t.replace( re2, "" );+				}++			}++			// If a selector string still exists+			if ( t ) {+				// Attempt to filter it+				var val = jQuery.filter(t,r);+				ret = r = val.r;+				t = jQuery.trim(val.t);+			}+		}++		// An error occurred with the selector;+		// just return an empty set instead+		if ( t )+			ret = [];++		// Remove the root context+		if ( ret && context == ret[0] )+			ret.shift();++		// And combine the results+		done = jQuery.merge( done, ret );++		return done;+	},++	classFilter: function(r,m,not){+		m = " " + m + " ";+		var tmp = [];+		for ( var i = 0; r[i]; i++ ) {+			var pass = (" " + r[i].className + " ").indexOf( m ) >= 0;+			if ( !not && pass || not && !pass )+				tmp.push( r[i] );+		}+		return tmp;+	},++	filter: function(t,r,not) {+		var last;++		// Look for common filter expressions+		while ( t && t != last ) {+			last = t;++			var p = jQuery.parse, m;++			for ( var i = 0; p[i]; i++ ) {+				m = p[i].exec( t );++				if ( m ) {+					// Remove what we just matched+					t = t.substring( m[0].length );++					m[2] = m[2].replace(/\\/g, "");+					break;+				}+			}++			if ( !m )+				break;++			// :not() is a special case that can be optimized by+			// keeping it out of the expression list+			if ( m[1] == ":" && m[2] == "not" )+				// optimize if only one selector found (most common case)+				r = isSimple.test( m[3] ) ?+					jQuery.filter(m[3], r, true).r :+					jQuery( r ).not( m[3] );++			// We can get a big speed boost by filtering by class here+			else if ( m[1] == "." )+				r = jQuery.classFilter(r, m[2], not);++			else if ( m[1] == "[" ) {+				var tmp = [], type = m[3];++				for ( var i = 0, rl = r.length; i < rl; i++ ) {+					var a = r[i], z = a[ jQuery.props[m[2]] || m[2] ];++					if ( z == null || /href|src|selected/.test(m[2]) )+						z = jQuery.attr(a,m[2]) || '';++					if ( (type == "" && !!z ||+						 type == "=" && z == m[5] ||+						 type == "!=" && z != m[5] ||+						 type == "^=" && z && !z.indexOf(m[5]) ||+						 type == "$=" && z.substr(z.length - m[5].length) == m[5] ||+						 (type == "*=" || type == "~=") && z.indexOf(m[5]) >= 0) ^ not )+							tmp.push( a );+				}++				r = tmp;++			// We can get a speed boost by handling nth-child here+			} else if ( m[1] == ":" && m[2] == "nth-child" ) {+				var merge = {}, tmp = [],+					// parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'+					test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec(+						m[3] == "even" && "2n" || m[3] == "odd" && "2n+1" ||+						!/\D/.test(m[3]) && "0n+" + m[3] || m[3]),+					// calculate the numbers (first)n+(last) including if they are negative+					first = (test[1] + (test[2] || 1)) - 0, last = test[3] - 0;++				// loop through all the elements left in the jQuery object+				for ( var i = 0, rl = r.length; i < rl; i++ ) {+					var node = r[i], parentNode = node.parentNode, id = jQuery.data(parentNode);++					if ( !merge[id] ) {+						var c = 1;++						for ( var n = parentNode.firstChild; n; n = n.nextSibling )+							if ( n.nodeType == 1 )+								n.nodeIndex = c++;++						merge[id] = true;+					}++					var add = false;++					if ( first == 0 ) {+						if ( node.nodeIndex == last )+							add = true;+					} else if ( (node.nodeIndex - last) % first == 0 && (node.nodeIndex - last) / first >= 0 )+						add = true;++					if ( add ^ not )+						tmp.push( node );+				}++				r = tmp;++			// Otherwise, find the expression to execute+			} else {+				var fn = jQuery.expr[ m[1] ];+				if ( typeof fn == "object" )+					fn = fn[ m[2] ];++				if ( typeof fn == "string" )+					fn = eval("false||function(a,i){return " + fn + ";}");++				// Execute it against the current filter+				r = jQuery.grep( r, function(elem, i){+					return fn(elem, i, m, r);+				}, not );+			}+		}++		// Return an array of filtered elements (r)+		// and the modified expression string (t)+		return { r: r, t: t };+	},++	dir: function( elem, dir ){+		var matched = [],+			cur = elem[dir];+		while ( cur && cur != document ) {+			if ( cur.nodeType == 1 )+				matched.push( cur );+			cur = cur[dir];+		}+		return matched;+	},++	nth: function(cur,result,dir,elem){+		result = result || 1;+		var num = 0;++		for ( ; cur; cur = cur[dir] )+			if ( cur.nodeType == 1 && ++num == result )+				break;++		return cur;+	},++	sibling: function( n, elem ) {+		var r = [];++		for ( ; n; n = n.nextSibling ) {+			if ( n.nodeType == 1 && n != elem )+				r.push( n );+		}++		return r;+	}+});+/*+ * A number of helper functions used for managing events.+ * Many of the ideas behind this code orignated from+ * Dean Edwards' addEvent library.+ */+jQuery.event = {++	// Bind an event to an element+	// Original by Dean Edwards+	add: function(elem, types, handler, data) {+		if ( elem.nodeType == 3 || elem.nodeType == 8 )+			return;++		// For whatever reason, IE has trouble passing the window object+		// around, causing it to be cloned in the process+		if ( jQuery.browser.msie && elem.setInterval )+			elem = window;++		// Make sure that the function being executed has a unique ID+		if ( !handler.guid )+			handler.guid = this.guid++;++		// if data is passed, bind to handler+		if( data != undefined ) {+			// Create temporary function pointer to original handler+			var fn = handler;++			// Create unique handler function, wrapped around original handler+			handler = this.proxy( fn, function() {+				// Pass arguments and context to original handler+				return fn.apply(this, arguments);+			});++			// Store data in unique handler+			handler.data = data;+		}++		// Init the element's event structure+		var events = jQuery.data(elem, "events") || jQuery.data(elem, "events", {}),+			handle = jQuery.data(elem, "handle") || jQuery.data(elem, "handle", function(){+				// Handle the second event of a trigger and when+				// an event is called after a page has unloaded+				if ( typeof jQuery != "undefined" && !jQuery.event.triggered )+					return jQuery.event.handle.apply(arguments.callee.elem, arguments);+			});+		// Add elem as a property of the handle function+		// This is to prevent a memory leak with non-native+		// event in IE.+		handle.elem = elem;++		// Handle multiple events separated by a space+		// jQuery(...).bind("mouseover mouseout", fn);+		jQuery.each(types.split(/\s+/), function(index, type) {+			// Namespaced event handlers+			var parts = type.split(".");+			type = parts[0];+			handler.type = parts[1];++			// Get the current list of functions bound to this event+			var handlers = events[type];++			// Init the event handler queue+			if (!handlers) {+				handlers = events[type] = {};++				// Check for a special event handler+				// Only use addEventListener/attachEvent if the special+				// events handler returns false+				if ( !jQuery.event.special[type] || jQuery.event.special[type].setup.call(elem) === false ) {+					// Bind the global event handler to the element+					if (elem.addEventListener)+						elem.addEventListener(type, handle, false);+					else if (elem.attachEvent)+						elem.attachEvent("on" + type, handle);+				}+			}++			// Add the function to the element's handler list+			handlers[handler.guid] = handler;++			// Keep track of which events have been used, for global triggering+			jQuery.event.global[type] = true;+		});++		// Nullify elem to prevent memory leaks in IE+		elem = null;+	},++	guid: 1,+	global: {},++	// Detach an event or set of events from an element+	remove: function(elem, types, handler) {+		// don't do events on text and comment nodes+		if ( elem.nodeType == 3 || elem.nodeType == 8 )+			return;++		var events = jQuery.data(elem, "events"), ret, index;++		if ( events ) {+			// Unbind all events for the element+			if ( types == undefined || (typeof types == "string" && types.charAt(0) == ".") )+				for ( var type in events )+					this.remove( elem, type + (types || "") );+			else {+				// types is actually an event object here+				if ( types.type ) {+					handler = types.handler;+					types = types.type;+				}++				// Handle multiple events seperated by a space+				// jQuery(...).unbind("mouseover mouseout", fn);+				jQuery.each(types.split(/\s+/), function(index, type){+					// Namespaced event handlers+					var parts = type.split(".");+					type = parts[0];++					if ( events[type] ) {+						// remove the given handler for the given type+						if ( handler )+							delete events[type][handler.guid];++						// remove all handlers for the given type+						else+							for ( handler in events[type] )+								// Handle the removal of namespaced events+								if ( !parts[1] || events[type][handler].type == parts[1] )+									delete events[type][handler];++						// remove generic event handler if no more handlers exist+						for ( ret in events[type] ) break;+						if ( !ret ) {+							if ( !jQuery.event.special[type] || jQuery.event.special[type].teardown.call(elem) === false ) {+								if (elem.removeEventListener)+									elem.removeEventListener(type, jQuery.data(elem, "handle"), false);+								else if (elem.detachEvent)+									elem.detachEvent("on" + type, jQuery.data(elem, "handle"));+							}+							ret = null;+							delete events[type];+						}+					}+				});+			}++			// Remove the expando if it's no longer used+			for ( ret in events ) break;+			if ( !ret ) {+				var handle = jQuery.data( elem, "handle" );+				if ( handle ) handle.elem = null;+				jQuery.removeData( elem, "events" );+				jQuery.removeData( elem, "handle" );+			}+		}+	},++	trigger: function(type, data, elem, donative, extra) {+		// Clone the incoming data, if any+		data = jQuery.makeArray(data);++		if ( type.indexOf("!") >= 0 ) {+			type = type.slice(0, -1);+			var exclusive = true;+		}++		// Handle a global trigger+		if ( !elem ) {+			// Only trigger if we've ever bound an event for it+			if ( this.global[type] )+				jQuery("*").add([window, document]).trigger(type, data);++		// Handle triggering a single element+		} else {+			// don't do events on text and comment nodes+			if ( elem.nodeType == 3 || elem.nodeType == 8 )+				return undefined;++			var val, ret, fn = jQuery.isFunction( elem[ type ] || null ),+				// Check to see if we need to provide a fake event, or not+				event = !data[0] || !data[0].preventDefault;++			// Pass along a fake event+			if ( event ) {+				data.unshift({+					type: type,+					target: elem,+					preventDefault: function(){},+					stopPropagation: function(){},+					timeStamp: now()+				});+				data[0][expando] = true; // no need to fix fake event+			}++			// Enforce the right trigger type+			data[0].type = type;+			if ( exclusive )+				data[0].exclusive = true;++			// Trigger the event, it is assumed that "handle" is a function+			var handle = jQuery.data(elem, "handle");+			if ( handle )+				val = handle.apply( elem, data );++			// Handle triggering native .onfoo handlers (and on links since we don't call .click() for links)+			if ( (!fn || (jQuery.nodeName(elem, 'a') && type == "click")) && elem["on"+type] && elem["on"+type].apply( elem, data ) === false )+				val = false;++			// Extra functions don't get the custom event object+			if ( event )+				data.shift();++			// Handle triggering of extra function+			if ( extra && jQuery.isFunction( extra ) ) {+				// call the extra function and tack the current return value on the end for possible inspection+				ret = extra.apply( elem, val == null ? data : data.concat( val ) );+				// if anything is returned, give it precedence and have it overwrite the previous value+				if (ret !== undefined)+					val = ret;+			}++			// Trigger the native events (except for clicks on links)+			if ( fn && donative !== false && val !== false && !(jQuery.nodeName(elem, 'a') && type == "click") ) {+				this.triggered = true;+				try {+					elem[ type ]();+				// prevent IE from throwing an error for some hidden elements+				} catch (e) {}+			}++			this.triggered = false;+		}++		return val;+	},++	handle: function(event) {+		// returned undefined or false+		var val, ret, namespace, all, handlers;++		event = arguments[0] = jQuery.event.fix( event || window.event );++		// Namespaced event handlers+		namespace = event.type.split(".");+		event.type = namespace[0];+		namespace = namespace[1];+		// Cache this now, all = true means, any handler+		all = !namespace && !event.exclusive;++		handlers = ( jQuery.data(this, "events") || {} )[event.type];++		for ( var j in handlers ) {+			var handler = handlers[j];++			// Filter the functions by class+			if ( all || handler.type == namespace ) {+				// Pass in a reference to the handler function itself+				// So that we can later remove it+				event.handler = handler;+				event.data = handler.data;++				ret = handler.apply( this, arguments );++				if ( val !== false )+					val = ret;++				if ( ret === false ) {+					event.preventDefault();+					event.stopPropagation();+				}+			}+		}++		return val;+	},++	fix: function(event) {+		if ( event[expando] == true )+			return event;++		// store a copy of the original event object+		// and "clone" to set read-only properties+		var originalEvent = event;+		event = { originalEvent: originalEvent };+		var props = "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target timeStamp toElement type view wheelDelta which".split(" ");+		for ( var i=props.length; i; i-- )+			event[ props[i] ] = originalEvent[ props[i] ];++		// Mark it as fixed+		event[expando] = true;++		// add preventDefault and stopPropagation since+		// they will not work on the clone+		event.preventDefault = function() {+			// if preventDefault exists run it on the original event+			if (originalEvent.preventDefault)+				originalEvent.preventDefault();+			// otherwise set the returnValue property of the original event to false (IE)+			originalEvent.returnValue = false;+		};+		event.stopPropagation = function() {+			// if stopPropagation exists run it on the original event+			if (originalEvent.stopPropagation)+				originalEvent.stopPropagation();+			// otherwise set the cancelBubble property of the original event to true (IE)+			originalEvent.cancelBubble = true;+		};++		// Fix timeStamp+		event.timeStamp = event.timeStamp || now();++		// Fix target property, if necessary+		if ( !event.target )+			event.target = event.srcElement || document; // Fixes #1925 where srcElement might not be defined either++		// check if target is a textnode (safari)+		if ( event.target.nodeType == 3 )+			event.target = event.target.parentNode;++		// Add relatedTarget, if necessary+		if ( !event.relatedTarget && event.fromElement )+			event.relatedTarget = event.fromElement == event.target ? event.toElement : event.fromElement;++		// Calculate pageX/Y if missing and clientX/Y available+		if ( event.pageX == null && event.clientX != null ) {+			var doc = document.documentElement, body = document.body;+			event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc.clientLeft || 0);+			event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc.clientTop || 0);+		}++		// Add which for key events+		if ( !event.which && ((event.charCode || event.charCode === 0) ? event.charCode : event.keyCode) )+			event.which = event.charCode || event.keyCode;++		// Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs)+		if ( !event.metaKey && event.ctrlKey )+			event.metaKey = event.ctrlKey;++		// Add which for click: 1 == left; 2 == middle; 3 == right+		// Note: button is not normalized, so don't use it+		if ( !event.which && event.button )+			event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) ));++		return event;+	},++	proxy: function( fn, proxy ){+		// Set the guid of unique handler to the same of original handler, so it can be removed+		proxy.guid = fn.guid = fn.guid || proxy.guid || this.guid++;+		// So proxy can be declared as an argument+		return proxy;+	},++	special: {+		ready: {+			setup: function() {+				// Make sure the ready event is setup+				bindReady();+				return;+			},++			teardown: function() { return; }+		},++		mouseenter: {+			setup: function() {+				if ( jQuery.browser.msie ) return false;+				jQuery(this).bind("mouseover", jQuery.event.special.mouseenter.handler);+				return true;+			},++			teardown: function() {+				if ( jQuery.browser.msie ) return false;+				jQuery(this).unbind("mouseover", jQuery.event.special.mouseenter.handler);+				return true;+			},++			handler: function(event) {+				// If we actually just moused on to a sub-element, ignore it+				if ( withinElement(event, this) ) return true;+				// Execute the right handlers by setting the event type to mouseenter+				event.type = "mouseenter";+				return jQuery.event.handle.apply(this, arguments);+			}+		},++		mouseleave: {+			setup: function() {+				if ( jQuery.browser.msie ) return false;+				jQuery(this).bind("mouseout", jQuery.event.special.mouseleave.handler);+				return true;+			},++			teardown: function() {+				if ( jQuery.browser.msie ) return false;+				jQuery(this).unbind("mouseout", jQuery.event.special.mouseleave.handler);+				return true;+			},++			handler: function(event) {+				// If we actually just moused on to a sub-element, ignore it+				if ( withinElement(event, this) ) return true;+				// Execute the right handlers by setting the event type to mouseleave+				event.type = "mouseleave";+				return jQuery.event.handle.apply(this, arguments);+			}+		}+	}+};++jQuery.fn.extend({+	bind: function( type, data, fn ) {+		return type == "unload" ? this.one(type, data, fn) : this.each(function(){+			jQuery.event.add( this, type, fn || data, fn && data );+		});+	},++	one: function( type, data, fn ) {+		var one = jQuery.event.proxy( fn || data, function(event) {+			jQuery(this).unbind(event, one);+			return (fn || data).apply( this, arguments );+		});+		return this.each(function(){+			jQuery.event.add( this, type, one, fn && data);+		});+	},++	unbind: function( type, fn ) {+		return this.each(function(){+			jQuery.event.remove( this, type, fn );+		});+	},++	trigger: function( type, data, fn ) {+		return this.each(function(){+			jQuery.event.trigger( type, data, this, true, fn );+		});+	},++	triggerHandler: function( type, data, fn ) {+		return this[0] && jQuery.event.trigger( type, data, this[0], false, fn );+	},++	toggle: function( fn ) {+		// Save reference to arguments for access in closure+		var args = arguments, i = 1;++		// link all the functions, so any of them can unbind this click handler+		while( i < args.length )+			jQuery.event.proxy( fn, args[i++] );++		return this.click( jQuery.event.proxy( fn, function(event) {+			// Figure out which function to execute+			this.lastToggle = ( this.lastToggle || 0 ) % i;++			// Make sure that clicks stop+			event.preventDefault();++			// and execute the function+			return args[ this.lastToggle++ ].apply( this, arguments ) || false;+		}));+	},++	hover: function(fnOver, fnOut) {+		return this.bind('mouseenter', fnOver).bind('mouseleave', fnOut);+	},++	ready: function(fn) {+		// Attach the listeners+		bindReady();++		// If the DOM is already ready+		if ( jQuery.isReady )+			// Execute the function immediately+			fn.call( document, jQuery );++		// Otherwise, remember the function for later+		else+			// Add the function to the wait list+			jQuery.readyList.push( function() { return fn.call(this, jQuery); } );++		return this;+	}+});++jQuery.extend({+	isReady: false,+	readyList: [],+	// Handle when the DOM is ready+	ready: function() {+		// Make sure that the DOM is not already loaded+		if ( !jQuery.isReady ) {+			// Remember that the DOM is ready+			jQuery.isReady = true;++			// If there are functions bound, to execute+			if ( jQuery.readyList ) {+				// Execute all of them+				jQuery.each( jQuery.readyList, function(){+					this.call( document );+				});++				// Reset the list of functions+				jQuery.readyList = null;+			}++			// Trigger any bound ready events+			jQuery(document).triggerHandler("ready");+		}+	}+});++var readyBound = false;++function bindReady(){+	if ( readyBound ) return;+	readyBound = true;++	// Mozilla, Opera (see further below for it) and webkit nightlies currently support this event+	if ( document.addEventListener && !jQuery.browser.opera)+		// Use the handy event callback+		document.addEventListener( "DOMContentLoaded", jQuery.ready, false );++	// If IE is used and is not in a frame+	// Continually check to see if the document is ready+	if ( jQuery.browser.msie && window == top ) (function(){+		if (jQuery.isReady) return;+		try {+			// If IE is used, use the trick by Diego Perini+			// http://javascript.nwbox.com/IEContentLoaded/+			document.documentElement.doScroll("left");+		} catch( error ) {+			setTimeout( arguments.callee, 0 );+			return;+		}+		// and execute any waiting functions+		jQuery.ready();+	})();++	if ( jQuery.browser.opera )+		document.addEventListener( "DOMContentLoaded", function () {+			if (jQuery.isReady) return;+			for (var i = 0; i < document.styleSheets.length; i++)+				if (document.styleSheets[i].disabled) {+					setTimeout( arguments.callee, 0 );+					return;+				}+			// and execute any waiting functions+			jQuery.ready();+		}, false);++	if ( jQuery.browser.safari ) {+		var numStyles;+		(function(){+			if (jQuery.isReady) return;+			if ( document.readyState != "loaded" && document.readyState != "complete" ) {+				setTimeout( arguments.callee, 0 );+				return;+			}+			if ( numStyles === undefined )+				numStyles = jQuery("style, link[rel=stylesheet]").length;+			if ( document.styleSheets.length != numStyles ) {+				setTimeout( arguments.callee, 0 );+				return;+			}+			// and execute any waiting functions+			jQuery.ready();+		})();+	}++	// A fallback to window.onload, that will always work+	jQuery.event.add( window, "load", jQuery.ready );+}++jQuery.each( ("blur,focus,load,resize,scroll,unload,click,dblclick," ++	"mousedown,mouseup,mousemove,mouseover,mouseout,change,select," ++	"submit,keydown,keypress,keyup,error").split(","), function(i, name){++	// Handle event binding+	jQuery.fn[name] = function(fn){+		return fn ? this.bind(name, fn) : this.trigger(name);+	};+});++// Checks if an event happened on an element within another element+// Used in jQuery.event.special.mouseenter and mouseleave handlers+var withinElement = function(event, elem) {+	// Check if mouse(over|out) are still within the same parent element+	var parent = event.relatedTarget;+	// Traverse up the tree+	while ( parent && parent != elem ) try { parent = parent.parentNode; } catch(error) { parent = elem; }+	// Return true if we actually just moused on to a sub-element+	return parent == elem;+};++// Prevent memory leaks in IE+// And prevent errors on refresh with events like mouseover in other browsers+// Window isn't included so as not to unbind existing unload events+jQuery(window).bind("unload", function() {+	jQuery("*").add(document).unbind();+});+jQuery.fn.extend({+	// Keep a copy of the old load+	_load: jQuery.fn.load,++	load: function( url, params, callback ) {+		if ( typeof url != 'string' )+			return this._load( url );++		var off = url.indexOf(" ");+		if ( off >= 0 ) {+			var selector = url.slice(off, url.length);+			url = url.slice(0, off);+		}++		callback = callback || function(){};++		// Default to a GET request+		var type = "GET";++		// If the second parameter was provided+		if ( params )+			// If it's a function+			if ( jQuery.isFunction( params ) ) {+				// We assume that it's the callback+				callback = params;+				params = null;++			// Otherwise, build a param string+			} else {+				params = jQuery.param( params );+				type = "POST";+			}++		var self = this;++		// Request the remote document+		jQuery.ajax({+			url: url,+			type: type,+			dataType: "html",+			data: params,+			complete: function(res, status){+				// If successful, inject the HTML into all the matched elements+				if ( status == "success" || status == "notmodified" )+					// See if a selector was specified+					self.html( selector ?+						// Create a dummy div to hold the results+						jQuery("<div/>")+							// inject the contents of the document in, removing the scripts+							// to avoid any 'Permission Denied' errors in IE+							.append(res.responseText.replace(/<script(.|\s)*?\/script>/g, ""))++							// Locate the specified elements+							.find(selector) :++						// If not, just inject the full result+						res.responseText );++				self.each( callback, [res.responseText, status, res] );+			}+		});+		return this;+	},++	serialize: function() {+		return jQuery.param(this.serializeArray());+	},+	serializeArray: function() {+		return this.map(function(){+			return jQuery.nodeName(this, "form") ?+				jQuery.makeArray(this.elements) : this;+		})+		.filter(function(){+			return this.name && !this.disabled &&+				(this.checked || /select|textarea/i.test(this.nodeName) ||+					/text|hidden|password/i.test(this.type));+		})+		.map(function(i, elem){+			var val = jQuery(this).val();+			return val == null ? null :+				val.constructor == Array ?+					jQuery.map( val, function(val, i){+						return {name: elem.name, value: val};+					}) :+					{name: elem.name, value: val};+		}).get();+	}+});++// Attach a bunch of functions for handling common AJAX events+jQuery.each( "ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","), function(i,o){+	jQuery.fn[o] = function(f){+		return this.bind(o, f);+	};+});++var jsc = now();++jQuery.extend({+	get: function( url, data, callback, type ) {+		// shift arguments if data argument was ommited+		if ( jQuery.isFunction( data ) ) {+			callback = data;+			data = null;+		}++		return jQuery.ajax({+			type: "GET",+			url: url,+			data: data,+			success: callback,+			dataType: type+		});+	},++	getScript: function( url, callback ) {+		return jQuery.get(url, null, callback, "script");+	},++	getJSON: function( url, data, callback ) {+		return jQuery.get(url, data, callback, "json");+	},++	post: function( url, data, callback, type ) {+		if ( jQuery.isFunction( data ) ) {+			callback = data;+			data = {};+		}++		return jQuery.ajax({+			type: "POST",+			url: url,+			data: data,+			success: callback,+			dataType: type+		});+	},++	ajaxSetup: function( settings ) {+		jQuery.extend( jQuery.ajaxSettings, settings );+	},++	ajaxSettings: {+		url: location.href,+		global: true,+		type: "GET",+		timeout: 0,+		contentType: "application/x-www-form-urlencoded",+		processData: true,+		async: true,+		data: null,+		username: null,+		password: null,+		accepts: {+			xml: "application/xml, text/xml",+			html: "text/html",+			script: "text/javascript, application/javascript",+			json: "application/json, text/javascript",+			text: "text/plain",+			_default: "*/*"+		}+	},++	// Last-Modified header cache for next request+	lastModified: {},++	ajax: function( s ) {+		// Extend the settings, but re-extend 's' so that it can be+		// checked again later (in the test suite, specifically)+		s = jQuery.extend(true, s, jQuery.extend(true, {}, jQuery.ajaxSettings, s));++		var jsonp, jsre = /=\?(&|$)/g, status, data,+			type = s.type.toUpperCase();++		// convert data if not already a string+		if ( s.data && s.processData && typeof s.data != "string" )+			s.data = jQuery.param(s.data);++		// Handle JSONP Parameter Callbacks+		if ( s.dataType == "jsonp" ) {+			if ( type == "GET" ) {+				if ( !s.url.match(jsre) )+					s.url += (s.url.match(/\?/) ? "&" : "?") + (s.jsonp || "callback") + "=?";+			} else if ( !s.data || !s.data.match(jsre) )+				s.data = (s.data ? s.data + "&" : "") + (s.jsonp || "callback") + "=?";+			s.dataType = "json";+		}++		// Build temporary JSONP function+		if ( s.dataType == "json" && (s.data && s.data.match(jsre) || s.url.match(jsre)) ) {+			jsonp = "jsonp" + jsc++;++			// Replace the =? sequence both in the query string and the data+			if ( s.data )+				s.data = (s.data + "").replace(jsre, "=" + jsonp + "$1");+			s.url = s.url.replace(jsre, "=" + jsonp + "$1");++			// We need to make sure+			// that a JSONP style response is executed properly+			s.dataType = "script";++			// Handle JSONP-style loading+			window[ jsonp ] = function(tmp){+				data = tmp;+				success();+				complete();+				// Garbage collect+				window[ jsonp ] = undefined;+				try{ delete window[ jsonp ]; } catch(e){}+				if ( head )+					head.removeChild( script );+			};+		}++		if ( s.dataType == "script" && s.cache == null )+			s.cache = false;++		if ( s.cache === false && type == "GET" ) {+			var ts = now();+			// try replacing _= if it is there+			var ret = s.url.replace(/(\?|&)_=.*?(&|$)/, "$1_=" + ts + "$2");+			// if nothing was replaced, add timestamp to the end+			s.url = ret + ((ret == s.url) ? (s.url.match(/\?/) ? "&" : "?") + "_=" + ts : "");+		}++		// If data is available, append data to url for get requests+		if ( s.data && type == "GET" ) {+			s.url += (s.url.match(/\?/) ? "&" : "?") + s.data;++			// IE likes to send both get and post data, prevent this+			s.data = null;+		}++		// Watch for a new set of requests+		if ( s.global && ! jQuery.active++ )+			jQuery.event.trigger( "ajaxStart" );++		// Matches an absolute URL, and saves the domain+		var remote = /^(?:\w+:)?\/\/([^\/?#]+)/;++		// If we're requesting a remote document+		// and trying to load JSON or Script with a GET+		if ( s.dataType == "script" && type == "GET"+				&& remote.test(s.url) && remote.exec(s.url)[1] != location.host ){+			var head = document.getElementsByTagName("head")[0];+			var script = document.createElement("script");+			script.src = s.url;+			if (s.scriptCharset)+				script.charset = s.scriptCharset;++			// Handle Script loading+			if ( !jsonp ) {+				var done = false;++				// Attach handlers for all browsers+				script.onload = script.onreadystatechange = function(){+					if ( !done && (!this.readyState ||+							this.readyState == "loaded" || this.readyState == "complete") ) {+						done = true;+						success();+						complete();+						head.removeChild( script );+					}+				};+			}++			head.appendChild(script);++			// We handle everything using the script element injection+			return undefined;+		}++		var requestDone = false;++		// Create the request object; Microsoft failed to properly+		// implement the XMLHttpRequest in IE7, so we use the ActiveXObject when it is available+		var xhr = window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();++		// Open the socket+		// Passing null username, generates a login popup on Opera (#2865)+		if( s.username )+			xhr.open(type, s.url, s.async, s.username, s.password);+		else+			xhr.open(type, s.url, s.async);++		// Need an extra try/catch for cross domain requests in Firefox 3+		try {+			// Set the correct header, if data is being sent+			if ( s.data )+				xhr.setRequestHeader("Content-Type", s.contentType);++			// Set the If-Modified-Since header, if ifModified mode.+			if ( s.ifModified )+				xhr.setRequestHeader("If-Modified-Since",+					jQuery.lastModified[s.url] || "Thu, 01 Jan 1970 00:00:00 GMT" );++			// Set header so the called script knows that it's an XMLHttpRequest+			xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");++			// Set the Accepts header for the server, depending on the dataType+			xhr.setRequestHeader("Accept", s.dataType && s.accepts[ s.dataType ] ?+				s.accepts[ s.dataType ] + ", */*" :+				s.accepts._default );+		} catch(e){}++		// Allow custom headers/mimetypes+		if ( s.beforeSend && s.beforeSend(xhr, s) === false ) {+			// cleanup active request counter+			s.global && jQuery.active--;+			// close opended socket+			xhr.abort();+			return false;+		}++		if ( s.global )+			jQuery.event.trigger("ajaxSend", [xhr, s]);++		// Wait for a response to come back+		var onreadystatechange = function(isTimeout){+			// The transfer is complete and the data is available, or the request timed out+			if ( !requestDone && xhr && (xhr.readyState == 4 || isTimeout == "timeout") ) {+				requestDone = true;++				// clear poll interval+				if (ival) {+					clearInterval(ival);+					ival = null;+				}++				status = isTimeout == "timeout" && "timeout" ||+					!jQuery.httpSuccess( xhr ) && "error" ||+					s.ifModified && jQuery.httpNotModified( xhr, s.url ) && "notmodified" ||+					"success";++				if ( status == "success" ) {+					// Watch for, and catch, XML document parse errors+					try {+						// process the data (runs the xml through httpData regardless of callback)+						data = jQuery.httpData( xhr, s.dataType, s.dataFilter );+					} catch(e) {+						status = "parsererror";+					}+				}++				// Make sure that the request was successful or notmodified+				if ( status == "success" ) {+					// Cache Last-Modified header, if ifModified mode.+					var modRes;+					try {+						modRes = xhr.getResponseHeader("Last-Modified");+					} catch(e) {} // swallow exception thrown by FF if header is not available++					if ( s.ifModified && modRes )+						jQuery.lastModified[s.url] = modRes;++					// JSONP handles its own success callback+					if ( !jsonp )+						success();+				} else+					jQuery.handleError(s, xhr, status);++				// Fire the complete handlers+				complete();++				// Stop memory leaks+				if ( s.async )+					xhr = null;+			}+		};++		if ( s.async ) {+			// don't attach the handler to the request, just poll it instead+			var ival = setInterval(onreadystatechange, 13);++			// Timeout checker+			if ( s.timeout > 0 )+				setTimeout(function(){+					// Check to see if the request is still happening+					if ( xhr ) {+						// Cancel the request+						xhr.abort();++						if( !requestDone )+							onreadystatechange( "timeout" );+					}+				}, s.timeout);+		}++		// Send the data+		try {+			xhr.send(s.data);+		} catch(e) {+			jQuery.handleError(s, xhr, null, e);+		}++		// firefox 1.5 doesn't fire statechange for sync requests+		if ( !s.async )+			onreadystatechange();++		function success(){+			// If a local callback was specified, fire it and pass it the data+			if ( s.success )+				s.success( data, status );++			// Fire the global callback+			if ( s.global )+				jQuery.event.trigger( "ajaxSuccess", [xhr, s] );+		}++		function complete(){+			// Process result+			if ( s.complete )+				s.complete(xhr, status);++			// The request was completed+			if ( s.global )+				jQuery.event.trigger( "ajaxComplete", [xhr, s] );++			// Handle the global AJAX counter+			if ( s.global && ! --jQuery.active )+				jQuery.event.trigger( "ajaxStop" );+		}++		// return XMLHttpRequest to allow aborting the request etc.+		return xhr;+	},++	handleError: function( s, xhr, status, e ) {+		// If a local callback was specified, fire it+		if ( s.error ) s.error( xhr, status, e );++		// Fire the global callback+		if ( s.global )+			jQuery.event.trigger( "ajaxError", [xhr, s, e] );+	},++	// Counter for holding the number of active queries+	active: 0,++	// Determines if an XMLHttpRequest was successful or not+	httpSuccess: function( xhr ) {+		try {+			// IE error sometimes returns 1223 when it should be 204 so treat it as success, see #1450+			return !xhr.status && location.protocol == "file:" ||+				( xhr.status >= 200 && xhr.status < 300 ) || xhr.status == 304 || xhr.status == 1223 ||+				jQuery.browser.safari && xhr.status == undefined;+		} catch(e){}+		return false;+	},++	// Determines if an XMLHttpRequest returns NotModified+	httpNotModified: function( xhr, url ) {+		try {+			var xhrRes = xhr.getResponseHeader("Last-Modified");++			// Firefox always returns 200. check Last-Modified date+			return xhr.status == 304 || xhrRes == jQuery.lastModified[url] ||+				jQuery.browser.safari && xhr.status == undefined;+		} catch(e){}+		return false;+	},++	httpData: function( xhr, type, filter ) {+		var ct = xhr.getResponseHeader("content-type"),+			xml = type == "xml" || !type && ct && ct.indexOf("xml") >= 0,+			data = xml ? xhr.responseXML : xhr.responseText;++		if ( xml && data.documentElement.tagName == "parsererror" )+			throw "parsererror";+			+		// Allow a pre-filtering function to sanitize the response+		if( filter )+			data = filter( data, type );++		// If the type is "script", eval it in global context+		if ( type == "script" )+			jQuery.globalEval( data );++		// Get the JavaScript object, if JSON is used.+		if ( type == "json" )+			data = eval("(" + data + ")");++		return data;+	},++	// Serialize an array of form elements or a set of+	// key/values into a query string+	param: function( a ) {+		var s = [];++		// If an array was passed in, assume that it is an array+		// of form elements+		if ( a.constructor == Array || a.jquery )+			// Serialize the form elements+			jQuery.each( a, function(){+				s.push( encodeURIComponent(this.name) + "=" + encodeURIComponent( this.value ) );+			});++		// Otherwise, assume that it's an object of key/value pairs+		else+			// Serialize the key/values+			for ( var j in a )+				// If the value is an array then the key names need to be repeated+				if ( a[j] && a[j].constructor == Array )+					jQuery.each( a[j], function(){+						s.push( encodeURIComponent(j) + "=" + encodeURIComponent( this ) );+					});+				else+					s.push( encodeURIComponent(j) + "=" + encodeURIComponent( jQuery.isFunction(a[j]) ? a[j]() : a[j] ) );++		// Return the resulting serialization+		return s.join("&").replace(/%20/g, "+");+	}++});+jQuery.fn.extend({+	show: function(speed,callback){+		return speed ?+			this.animate({+				height: "show", width: "show", opacity: "show"+			}, speed, callback) :++			this.filter(":hidden").each(function(){+				this.style.display = this.oldblock || "";+				if ( jQuery.css(this,"display") == "none" ) {+					var elem = jQuery("<" + this.tagName + " />").appendTo("body");+					this.style.display = elem.css("display");+					// handle an edge condition where css is - div { display:none; } or similar+					if (this.style.display == "none")+						this.style.display = "block";+					elem.remove();+				}+			}).end();+	},++	hide: function(speed,callback){+		return speed ?+			this.animate({+				height: "hide", width: "hide", opacity: "hide"+			}, speed, callback) :++			this.filter(":visible").each(function(){+				this.oldblock = this.oldblock || jQuery.css(this,"display");+				this.style.display = "none";+			}).end();+	},++	// Save the old toggle function+	_toggle: jQuery.fn.toggle,++	toggle: function( fn, fn2 ){+		return jQuery.isFunction(fn) && jQuery.isFunction(fn2) ?+			this._toggle.apply( this, arguments ) :+			fn ?+				this.animate({+					height: "toggle", width: "toggle", opacity: "toggle"+				}, fn, fn2) :+				this.each(function(){+					jQuery(this)[ jQuery(this).is(":hidden") ? "show" : "hide" ]();+				});+	},++	slideDown: function(speed,callback){+		return this.animate({height: "show"}, speed, callback);+	},++	slideUp: function(speed,callback){+		return this.animate({height: "hide"}, speed, callback);+	},++	slideToggle: function(speed, callback){+		return this.animate({height: "toggle"}, speed, callback);+	},++	fadeIn: function(speed, callback){+		return this.animate({opacity: "show"}, speed, callback);+	},++	fadeOut: function(speed, callback){+		return this.animate({opacity: "hide"}, speed, callback);+	},++	fadeTo: function(speed,to,callback){+		return this.animate({opacity: to}, speed, callback);+	},++	animate: function( prop, speed, easing, callback ) {+		var optall = jQuery.speed(speed, easing, callback);++		return this[ optall.queue === false ? "each" : "queue" ](function(){+			if ( this.nodeType != 1)+				return false;++			var opt = jQuery.extend({}, optall), p,+				hidden = jQuery(this).is(":hidden"), self = this;++			for ( p in prop ) {+				if ( prop[p] == "hide" && hidden || prop[p] == "show" && !hidden )+					return opt.complete.call(this);++				if ( p == "height" || p == "width" ) {+					// Store display property+					opt.display = jQuery.css(this, "display");++					// Make sure that nothing sneaks out+					opt.overflow = this.style.overflow;+				}+			}++			if ( opt.overflow != null )+				this.style.overflow = "hidden";++			opt.curAnim = jQuery.extend({}, prop);++			jQuery.each( prop, function(name, val){+				var e = new jQuery.fx( self, opt, name );++				if ( /toggle|show|hide/.test(val) )+					e[ val == "toggle" ? hidden ? "show" : "hide" : val ]( prop );+				else {+					var parts = val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),+						start = e.cur(true) || 0;++					if ( parts ) {+						var end = parseFloat(parts[2]),+							unit = parts[3] || "px";++						// We need to compute starting value+						if ( unit != "px" ) {+							self.style[ name ] = (end || 1) + unit;+							start = ((end || 1) / e.cur(true)) * start;+							self.style[ name ] = start + unit;+						}++						// If a +=/-= token was provided, we're doing a relative animation+						if ( parts[1] )+							end = ((parts[1] == "-=" ? -1 : 1) * end) + start;++						e.custom( start, end, unit );+					} else+						e.custom( start, val, "" );+				}+			});++			// For JS strict compliance+			return true;+		});+	},++	queue: function(type, fn){+		if ( jQuery.isFunction(type) || ( type && type.constructor == Array )) {+			fn = type;+			type = "fx";+		}++		if ( !type || (typeof type == "string" && !fn) )+			return queue( this[0], type );++		return this.each(function(){+			if ( fn.constructor == Array )+				queue(this, type, fn);+			else {+				queue(this, type).push( fn );++				if ( queue(this, type).length == 1 )+					fn.call(this);+			}+		});+	},++	stop: function(clearQueue, gotoEnd){+		var timers = jQuery.timers;++		if (clearQueue)+			this.queue([]);++		this.each(function(){+			// go in reverse order so anything added to the queue during the loop is ignored+			for ( var i = timers.length - 1; i >= 0; i-- )+				if ( timers[i].elem == this ) {+					if (gotoEnd)+						// force the next step to be the last+						timers[i](true);+					timers.splice(i, 1);+				}+		});++		// start the next in the queue if the last step wasn't forced+		if (!gotoEnd)+			this.dequeue();++		return this;+	}++});++var queue = function( elem, type, array ) {+	if ( elem ){++		type = type || "fx";++		var q = jQuery.data( elem, type + "queue" );++		if ( !q || array )+			q = jQuery.data( elem, type + "queue", jQuery.makeArray(array) );++	}+	return q;+};++jQuery.fn.dequeue = function(type){+	type = type || "fx";++	return this.each(function(){+		var q = queue(this, type);++		q.shift();++		if ( q.length )+			q[0].call( this );+	});+};++jQuery.extend({++	speed: function(speed, easing, fn) {+		var opt = speed && speed.constructor == Object ? speed : {+			complete: fn || !fn && easing ||+				jQuery.isFunction( speed ) && speed,+			duration: speed,+			easing: fn && easing || easing && easing.constructor != Function && easing+		};++		opt.duration = (opt.duration && opt.duration.constructor == Number ?+			opt.duration :+			jQuery.fx.speeds[opt.duration]) || jQuery.fx.speeds.def;++		// Queueing+		opt.old = opt.complete;+		opt.complete = function(){+			if ( opt.queue !== false )+				jQuery(this).dequeue();+			if ( jQuery.isFunction( opt.old ) )+				opt.old.call( this );+		};++		return opt;+	},++	easing: {+		linear: function( p, n, firstNum, diff ) {+			return firstNum + diff * p;+		},+		swing: function( p, n, firstNum, diff ) {+			return ((-Math.cos(p*Math.PI)/2) + 0.5) * diff + firstNum;+		}+	},++	timers: [],+	timerId: null,++	fx: function( elem, options, prop ){+		this.options = options;+		this.elem = elem;+		this.prop = prop;++		if ( !options.orig )+			options.orig = {};+	}++});++jQuery.fx.prototype = {++	// Simple function for setting a style value+	update: function(){+		if ( this.options.step )+			this.options.step.call( this.elem, this.now, this );++		(jQuery.fx.step[this.prop] || jQuery.fx.step._default)( this );++		// Set display property to block for height/width animations+		if ( this.prop == "height" || this.prop == "width" )+			this.elem.style.display = "block";+	},++	// Get the current size+	cur: function(force){+		if ( this.elem[this.prop] != null && this.elem.style[this.prop] == null )+			return this.elem[ this.prop ];++		var r = parseFloat(jQuery.css(this.elem, this.prop, force));+		return r && r > -10000 ? r : parseFloat(jQuery.curCSS(this.elem, this.prop)) || 0;+	},++	// Start an animation from one number to another+	custom: function(from, to, unit){+		this.startTime = now();+		this.start = from;+		this.end = to;+		this.unit = unit || this.unit || "px";+		this.now = this.start;+		this.pos = this.state = 0;+		this.update();++		var self = this;+		function t(gotoEnd){+			return self.step(gotoEnd);+		}++		t.elem = this.elem;++		jQuery.timers.push(t);++		if ( jQuery.timerId == null ) {+			jQuery.timerId = setInterval(function(){+				var timers = jQuery.timers;++				for ( var i = 0; i < timers.length; i++ )+					if ( !timers[i]() )+						timers.splice(i--, 1);++				if ( !timers.length ) {+					clearInterval( jQuery.timerId );+					jQuery.timerId = null;+				}+			}, 13);+		}+	},++	// Simple 'show' function+	show: function(){+		// Remember where we started, so that we can go back to it later+		this.options.orig[this.prop] = jQuery.attr( this.elem.style, this.prop );+		this.options.show = true;++		// Begin the animation+		this.custom(0, this.cur());++		// Make sure that we start at a small width/height to avoid any+		// flash of content+		if ( this.prop == "width" || this.prop == "height" )+			this.elem.style[this.prop] = "1px";++		// Start by showing the element+		jQuery(this.elem).show();+	},++	// Simple 'hide' function+	hide: function(){+		// Remember where we started, so that we can go back to it later+		this.options.orig[this.prop] = jQuery.attr( this.elem.style, this.prop );+		this.options.hide = true;++		// Begin the animation+		this.custom(this.cur(), 0);+	},++	// Each step of an animation+	step: function(gotoEnd){+		var t = now();++		if ( gotoEnd || t > this.options.duration + this.startTime ) {+			this.now = this.end;+			this.pos = this.state = 1;+			this.update();++			this.options.curAnim[ this.prop ] = true;++			var done = true;+			for ( var i in this.options.curAnim )+				if ( this.options.curAnim[i] !== true )+					done = false;++			if ( done ) {+				if ( this.options.display != null ) {+					// Reset the overflow+					this.elem.style.overflow = this.options.overflow;++					// Reset the display+					this.elem.style.display = this.options.display;+					if ( jQuery.css(this.elem, "display") == "none" )+						this.elem.style.display = "block";+				}++				// Hide the element if the "hide" operation was done+				if ( this.options.hide )+					this.elem.style.display = "none";++				// Reset the properties, if the item has been hidden or shown+				if ( this.options.hide || this.options.show )+					for ( var p in this.options.curAnim )+						jQuery.attr(this.elem.style, p, this.options.orig[p]);+			}++			if ( done )+				// Execute the complete function+				this.options.complete.call( this.elem );++			return false;+		} else {+			var n = t - this.startTime;+			this.state = n / this.options.duration;++			// Perform the easing function, defaults to swing+			this.pos = jQuery.easing[this.options.easing || (jQuery.easing.swing ? "swing" : "linear")](this.state, n, 0, 1, this.options.duration);+			this.now = this.start + ((this.end - this.start) * this.pos);++			// Perform the next step of the animation+			this.update();+		}++		return true;+	}++};++jQuery.extend( jQuery.fx, {+	speeds:{+		slow: 600,+ 		fast: 200,+ 		// Default speed+ 		def: 400+	},+	step: {+		scrollLeft: function(fx){+			fx.elem.scrollLeft = fx.now;+		},++		scrollTop: function(fx){+			fx.elem.scrollTop = fx.now;+		},++		opacity: function(fx){+			jQuery.attr(fx.elem.style, "opacity", fx.now);+		},++		_default: function(fx){+			fx.elem.style[ fx.prop ] = fx.now + fx.unit;+		}+	}+});+// The Offset Method+// Originally By Brandon Aaron, part of the Dimension Plugin+// http://jquery.com/plugins/project/dimensions+jQuery.fn.offset = function() {+	var left = 0, top = 0, elem = this[0], results;++	if ( elem ) with ( jQuery.browser ) {+		var parent       = elem.parentNode,+		    offsetChild  = elem,+		    offsetParent = elem.offsetParent,+		    doc          = elem.ownerDocument,+		    safari2      = safari && parseInt(version) < 522 && !/adobeair/i.test(userAgent),+		    css          = jQuery.curCSS,+		    fixed        = css(elem, "position") == "fixed";++		// Use getBoundingClientRect if available+		if ( elem.getBoundingClientRect ) {+			var box = elem.getBoundingClientRect();++			// Add the document scroll offsets+			add(box.left + Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft),+				box.top  + Math.max(doc.documentElement.scrollTop,  doc.body.scrollTop));++			// IE adds the HTML element's border, by default it is medium which is 2px+			// IE 6 and 7 quirks mode the border width is overwritable by the following css html { border: 0; }+			// IE 7 standards mode, the border is always 2px+			// This border/offset is typically represented by the clientLeft and clientTop properties+			// However, in IE6 and 7 quirks mode the clientLeft and clientTop properties are not updated when overwriting it via CSS+			// Therefore this method will be off by 2px in IE while in quirksmode+			add( -doc.documentElement.clientLeft, -doc.documentElement.clientTop );++		// Otherwise loop through the offsetParents and parentNodes+		} else {++			// Initial element offsets+			add( elem.offsetLeft, elem.offsetTop );++			// Get parent offsets+			while ( offsetParent ) {+				// Add offsetParent offsets+				add( offsetParent.offsetLeft, offsetParent.offsetTop );++				// Mozilla and Safari > 2 does not include the border on offset parents+				// However Mozilla adds the border for table or table cells+				if ( mozilla && !/^t(able|d|h)$/i.test(offsetParent.tagName) || safari && !safari2 )+					border( offsetParent );++				// Add the document scroll offsets if position is fixed on any offsetParent+				if ( !fixed && css(offsetParent, "position") == "fixed" )+					fixed = true;++				// Set offsetChild to previous offsetParent unless it is the body element+				offsetChild  = /^body$/i.test(offsetParent.tagName) ? offsetChild : offsetParent;+				// Get next offsetParent+				offsetParent = offsetParent.offsetParent;+			}++			// Get parent scroll offsets+			while ( parent && parent.tagName && !/^body|html$/i.test(parent.tagName) ) {+				// Remove parent scroll UNLESS that parent is inline or a table to work around Opera inline/table scrollLeft/Top bug+				if ( !/^inline|table.*$/i.test(css(parent, "display")) )+					// Subtract parent scroll offsets+					add( -parent.scrollLeft, -parent.scrollTop );++				// Mozilla does not add the border for a parent that has overflow != visible+				if ( mozilla && css(parent, "overflow") != "visible" )+					border( parent );++				// Get next parent+				parent = parent.parentNode;+			}++			// Safari <= 2 doubles body offsets with a fixed position element/offsetParent or absolutely positioned offsetChild+			// Mozilla doubles body offsets with a non-absolutely positioned offsetChild+			if ( (safari2 && (fixed || css(offsetChild, "position") == "absolute")) ||+				(mozilla && css(offsetChild, "position") != "absolute") )+					add( -doc.body.offsetLeft, -doc.body.offsetTop );++			// Add the document scroll offsets if position is fixed+			if ( fixed )+				add(Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft),+					Math.max(doc.documentElement.scrollTop,  doc.body.scrollTop));+		}++		// Return an object with top and left properties+		results = { top: top, left: left };+	}++	function border(elem) {+		add( jQuery.curCSS(elem, "borderLeftWidth", true), jQuery.curCSS(elem, "borderTopWidth", true) );+	}++	function add(l, t) {+		left += parseInt(l, 10) || 0;+		top += parseInt(t, 10) || 0;+	}++	return results;+};+++jQuery.fn.extend({+	position: function() {+		var left = 0, top = 0, results;++		if ( this[0] ) {+			// Get *real* offsetParent+			var offsetParent = this.offsetParent(),++			// Get correct offsets+			offset       = this.offset(),+			parentOffset = /^body|html$/i.test(offsetParent[0].tagName) ? { top: 0, left: 0 } : offsetParent.offset();++			// Subtract element margins+			// note: when an element has margin: auto the offsetLeft and marginLeft +			// are the same in Safari causing offset.left to incorrectly be 0+			offset.top  -= num( this, 'marginTop' );+			offset.left -= num( this, 'marginLeft' );++			// Add offsetParent borders+			parentOffset.top  += num( offsetParent, 'borderTopWidth' );+			parentOffset.left += num( offsetParent, 'borderLeftWidth' );++			// Subtract the two offsets+			results = {+				top:  offset.top  - parentOffset.top,+				left: offset.left - parentOffset.left+			};+		}++		return results;+	},++	offsetParent: function() {+		var offsetParent = this[0].offsetParent;+		while ( offsetParent && (!/^body|html$/i.test(offsetParent.tagName) && jQuery.css(offsetParent, 'position') == 'static') )+			offsetParent = offsetParent.offsetParent;+		return jQuery(offsetParent);+	}+});+++// Create scrollLeft and scrollTop methods+jQuery.each( ['Left', 'Top'], function(i, name) {+	var method = 'scroll' + name;+	+	jQuery.fn[ method ] = function(val) {+		if (!this[0]) return;++		return val != undefined ?++			// Set the scroll offset+			this.each(function() {+				this == window || this == document ?+					window.scrollTo(+						!i ? val : jQuery(window).scrollLeft(),+						 i ? val : jQuery(window).scrollTop()+					) :+					this[ method ] = val;+			}) :++			// Return the scroll offset+			this[0] == window || this[0] == document ?+				self[ i ? 'pageYOffset' : 'pageXOffset' ] ||+					jQuery.boxModel && document.documentElement[ method ] ||+					document.body[ method ] :+				this[0][ method ];+	};+});+// Create innerHeight, innerWidth, outerHeight and outerWidth methods+jQuery.each([ "Height", "Width" ], function(i, name){++	var tl = i ? "Left"  : "Top",  // top or left+		br = i ? "Right" : "Bottom"; // bottom or right++	// innerHeight and innerWidth+	jQuery.fn["inner" + name] = function(){+		return this[ name.toLowerCase() ]() ++			num(this, "padding" + tl) ++			num(this, "padding" + br);+	};++	// outerHeight and outerWidth+	jQuery.fn["outer" + name] = function(margin) {+		return this["inner" + name]() ++			num(this, "border" + tl + "Width") ++			num(this, "border" + br + "Width") ++			(margin ?+				num(this, "margin" + tl) + num(this, "margin" + br) : 0);+	};++});})();
+ static/layout/jquery.layout.js view
@@ -0,0 +1,2507 @@+/*
+ * jquery.layout 1.2.0
+ *
+ * Copyright (c) 2008 
+ *   Fabrizio Balliano (http://www.fabrizioballiano.net)
+ *   Kevin Dalman (http://allpro.net)
+ *
+ * Dual licensed under the GPL (http://www.gnu.org/licenses/gpl.html)
+ * and MIT (http://www.opensource.org/licenses/mit-license.php) licenses.
+ *
+ * $Date: 2008-12-27 02:17:22 +0100 (sab, 27 dic 2008) $
+ * $Rev: 203 $
+ * 
+ * NOTE: For best code readability, view this with a fixed-space font and tabs equal to 4-chars
+ */
+(function($) {
+
+$.fn.layout = function (opts) {
+
+/*
+ * ###########################
+ *   WIDGET CONFIG & OPTIONS
+ * ###########################
+ */
+
+	// DEFAULTS for options
+	var 
+		prefix = "ui-layout-" // prefix for ALL selectors and classNames
+	,	defaults = { //	misc default values
+			paneClass:				prefix+"pane"		// ui-layout-pane
+		,	resizerClass:			prefix+"resizer"	// ui-layout-resizer
+		,	togglerClass:			prefix+"toggler"	// ui-layout-toggler
+		,	togglerInnerClass:		prefix+""			// ui-layout-open / ui-layout-closed
+		,	buttonClass:			prefix+"button"		// ui-layout-button
+		,	contentSelector:		"."+prefix+"content"// ui-layout-content
+		,	contentIgnoreSelector:	"."+prefix+"ignore"	// ui-layout-mask 
+		}
+	;
+
+	// DEFAULT PANEL OPTIONS - CHANGE IF DESIRED
+	var options = {
+		name:						""			// FUTURE REFERENCE - not used right now
+	,	scrollToBookmarkOnLoad:		true		// after creating a layout, scroll to bookmark in URL (.../page.htm#myBookmark)
+	,	defaults: { // default options for 'all panes' - will be overridden by 'per-pane settings'
+			applyDefaultStyles: 	false		// apply basic styles directly to resizers & buttons? If not, then stylesheet must handle it
+		,	closable:				true		// pane can open & close
+		,	resizable:				true		// when open, pane can be resized 
+		,	slidable:				true		// when closed, pane can 'slide' open over other panes - closes on mouse-out
+		//,	paneSelector:			[ ]			// MUST be pane-specific!
+		,	contentSelector:		defaults.contentSelector	// INNER div/element to auto-size so only it scrolls, not the entire pane!
+		,	contentIgnoreSelector:	defaults.contentIgnoreSelector	// elem(s) to 'ignore' when measuring 'content'
+		,	paneClass:				defaults.paneClass		// border-Pane - default: 'ui-layout-pane'
+		,	resizerClass:			defaults.resizerClass	// Resizer Bar		- default: 'ui-layout-resizer'
+		,	togglerClass:			defaults.togglerClass	// Toggler Button	- default: 'ui-layout-toggler'
+		,	buttonClass:			defaults.buttonClass	// CUSTOM Buttons	- default: 'ui-layout-button-toggle/-open/-close/-pin'
+		,	resizerDragOpacity:		1			// option for ui.draggable
+		//,	resizerCursor:			""			// MUST be pane-specific - cursor when over resizer-bar
+		,	maskIframesOnResize:	true		// true = all iframes OR = iframe-selector(s) - adds masking-div during resizing/dragging
+		//,	size:					100			// inital size of pane - defaults are set 'per pane'
+		,	minSize:				0			// when manually resizing a pane
+		,	maxSize:				0			// ditto, 0 = no limit
+		,	spacing_open:			6			// space between pane and adjacent panes - when pane is 'open'
+		,	spacing_closed:			6			// ditto - when pane is 'closed'
+		,	togglerLength_open:		50			// Length = WIDTH of toggler button on north/south edges - HEIGHT on east/west edges
+		,	togglerLength_closed: 	50			// 100% OR -1 means 'full height/width of resizer bar' - 0 means 'hidden'
+		,	togglerAlign_open:		"center"	// top/left, bottom/right, center, OR...
+		,	togglerAlign_closed:	"center"	// 1 => nn = offset from top/left, -1 => -nn == offset from bottom/right
+		,	togglerTip_open:		"Close"		// Toggler tool-tip (title)
+		,	togglerTip_closed:		"Open"		// ditto
+		,	resizerTip:				"Resize"	// Resizer tool-tip (title)
+		,	sliderTip:				"Slide Open" // resizer-bar triggers 'sliding' when pane is closed
+		,	sliderCursor:			"pointer"	// cursor when resizer-bar will trigger 'sliding'
+		,	slideTrigger_open:		"click"		// click, dblclick, mouseover
+		,	slideTrigger_close:		"mouseout"	// click, mouseout
+		,	hideTogglerOnSlide:		false		// when pane is slid-open, should the toggler show?
+		,	togglerContent_open:	""			// text or HTML to put INSIDE the toggler
+		,	togglerContent_closed:	""			// ditto
+		,	showOverflowOnHover:	false		// will bind allowOverflow() utility to pane.onMouseOver
+		,	enableCursorHotkey:		true		// enabled 'cursor' hotkeys
+		//,	customHotkey:			""			// MUST be pane-specific - EITHER a charCode OR a character
+		,	customHotkeyModifier:	"SHIFT"		// either 'SHIFT', 'CTRL' or 'CTRL+SHIFT' - NOT 'ALT'
+		//	NOTE: fxSss_open & fxSss_close options (eg: fxName_open) are auto-generated if not passed
+		,	fxName:					"slide" 	// ('none' or blank), slide, drop, scale
+		,	fxSpeed:				null		// slow, normal, fast, 200, nnn - if passed, will OVERRIDE fxSettings.duration
+		,	fxSettings:				{}			// can be passed, eg: { easing: "easeOutBounce", duration: 1500 }
+		,	initClosed:				false		// true = init pane as 'closed'
+		,	initHidden: 			false 		// true = init pane as 'hidden' - no resizer or spacing
+		
+		/*	callback options do not have to be set - listed here for reference only
+		,	onshow_start:			""			// CALLBACK when pane STARTS to Show	- BEFORE onopen/onhide_start
+		,	onshow_end:				""			// CALLBACK when pane ENDS being Shown	- AFTER  onopen/onhide_end
+		,	onhide_start:			""			// CALLBACK when pane STARTS to Close	- BEFORE onclose_start
+		,	onhide_end:				""			// CALLBACK when pane ENDS being Closed	- AFTER  onclose_end
+		,	onopen_start:			""			// CALLBACK when pane STARTS to Open
+		,	onopen_end:				""			// CALLBACK when pane ENDS being Opened
+		,	onclose_start:			""			// CALLBACK when pane STARTS to Close
+		,	onclose_end:			""			// CALLBACK when pane ENDS being Closed
+		,	onresize_start:			""			// CALLBACK when pane STARTS to be ***MANUALLY*** Resized
+		,	onresize_end:			""			// CALLBACK when pane ENDS being Resized ***FOR ANY REASON***
+		*/
+		}
+	,	north: {
+			paneSelector:			"."+prefix+"north" // default = .ui-layout-north
+		,	size:					"auto"
+		,	resizerCursor:			"n-resize"
+		}
+	,	south: {
+			paneSelector:			"."+prefix+"south" // default = .ui-layout-south
+		,	size:					"auto"
+		,	resizerCursor:			"s-resize"
+		}
+	,	east: {
+			paneSelector:			"."+prefix+"east" // default = .ui-layout-east
+		,	size:					200
+		,	resizerCursor:			"e-resize"
+		}
+	,	west: {
+			paneSelector:			"."+prefix+"west" // default = .ui-layout-west
+		,	size:					200
+		,	resizerCursor:			"w-resize"
+		}
+	,	center: {
+			paneSelector:			"."+prefix+"center" // default = .ui-layout-center
+		}
+
+	};
+
+
+	var effects = { // LIST *PREDEFINED EFFECTS* HERE, even if effect has no settings
+		slide:	{
+			all:	{ duration:  "fast"	} // eg: duration: 1000, easing: "easeOutBounce"
+		,	north:	{ direction: "up"	}
+		,	south:	{ direction: "down"	}
+		,	east:	{ direction: "right"}
+		,	west:	{ direction: "left"	}
+		}
+	,	drop:	{
+			all:	{ duration:  "slow"	} // eg: duration: 1000, easing: "easeOutQuint"
+		,	north:	{ direction: "up"	}
+		,	south:	{ direction: "down"	}
+		,	east:	{ direction: "right"}
+		,	west:	{ direction: "left"	}
+		}
+	,	scale:	{
+			all:	{ duration:  "fast"	}
+		}
+	};
+
+
+	// STATIC, INTERNAL CONFIG - DO NOT CHANGE THIS!
+	var config = {
+		allPanes:		"north,south,east,west,center"
+	,	borderPanes:	"north,south,east,west"
+	,	zIndex: { // set z-index values here
+			resizer_normal:	1		// normal z-index for resizer-bars
+		,	pane_normal:	2		// normal z-index for panes
+		,	mask:			4		// overlay div used to mask pane(s) during resizing
+		,	sliding:		100		// applied to both the pane and its resizer when a pane is 'slid open'
+		,	resizing:		10000	// applied to the CLONED resizer-bar when being 'dragged'
+		,	animation:		10000	// applied to the pane when being animated - not applied to the resizer
+		}
+	,	resizers: {
+			cssReq: {
+				position: 	"absolute"
+			,	padding: 	0
+			,	margin: 	0
+			,	fontSize:	"1px"
+			,	textAlign:	"left" // to counter-act "center" alignment!
+			,	overflow: 	"hidden" // keep toggler button from overflowing
+			,	zIndex: 	1
+			}
+		,	cssDef: { // DEFAULT CSS - applied if: options.PANE.applyDefaultStyles=true
+				background: "#DDD"
+			,	border:		"none"
+			}
+		}
+	,	togglers: {
+			cssReq: {
+				position: 	"absolute"
+			,	display: 	"block"
+			,	padding: 	0
+			,	margin: 	0
+			,	overflow:	"hidden"
+			,	textAlign:	"center"
+			,	fontSize:	"1px"
+			,	cursor: 	"pointer"
+			,	zIndex: 	1
+			}
+		,	cssDef: { // DEFAULT CSS - applied if: options.PANE.applyDefaultStyles=true
+				background: "#AAA"
+			}
+		}
+	,	content: {
+			cssReq: {
+				overflow:	"auto"
+			}
+		,	cssDef: {}
+		}
+	,	defaults: { // defaults for ALL panes - overridden by 'per-pane settings' below
+			cssReq: {
+				position: 	"absolute"
+			,	margin:		0
+			,	zIndex: 	2
+			}
+		,	cssDef: {
+				padding:	"10px"
+			,	background:	"#FFF"
+			,	border:		"1px solid #BBB"
+			,	overflow:	"auto"
+			}
+		}
+	,	north: {
+			edge:			"top"
+		,	sizeType:		"height"
+		,	dir:			"horz"
+		,	cssReq: {
+				top: 		0
+			,	bottom: 	"auto"
+			,	left: 		0
+			,	right: 		0
+			,	width: 		"auto"
+			//	height: 	DYNAMIC
+			}
+		}
+	,	south: {
+			edge:			"bottom"
+		,	sizeType:		"height"
+		,	dir:			"horz"
+		,	cssReq: {
+				top: 		"auto"
+			,	bottom: 	0
+			,	left: 		0
+			,	right: 		0
+			,	width: 		"auto"
+			//	height: 	DYNAMIC
+			}
+		}
+	,	east: {
+			edge:			"right"
+		,	sizeType:		"width"
+		,	dir:			"vert"
+		,	cssReq: {
+				left: 		"auto"
+			,	right: 		0
+			,	top: 		"auto" // DYNAMIC
+			,	bottom: 	"auto" // DYNAMIC
+			,	height: 	"auto"
+			//	width: 		DYNAMIC
+			}
+		}
+	,	west: {
+			edge:			"left"
+		,	sizeType:		"width"
+		,	dir:			"vert"
+		,	cssReq: {
+				left: 		0
+			,	right: 		"auto"
+			,	top: 		"auto" // DYNAMIC
+			,	bottom: 	"auto" // DYNAMIC
+			,	height: 	"auto"
+			//	width: 		DYNAMIC
+			}
+		}
+	,	center: {
+			dir:			"center"
+		,	cssReq: {
+				left: 		"auto" // DYNAMIC
+			,	right: 		"auto" // DYNAMIC
+			,	top: 		"auto" // DYNAMIC
+			,	bottom: 	"auto" // DYNAMIC
+			,	height: 	"auto"
+			,	width: 		"auto"
+			}
+		}
+	};
+
+
+	// DYNAMIC DATA
+	var state = {
+		// generate random 'ID#' to identify layout - used to create global namespace for timers
+		id:			Math.floor(Math.random() * 10000)
+	,	container:	{}
+	,	north:		{}
+	,	south:		{}
+	,	east:		{}
+	,	west:		{}
+	,	center:		{}
+	};
+
+
+	var 
+		altEdge = {
+			top:	"bottom"
+		,	bottom: "top"
+		,	left:	"right"
+		,	right:	"left"
+		}
+	,	altSide = {
+			north:	"south"
+		,	south:	"north"
+		,	east: 	"west"
+		,	west: 	"east"
+		}
+	;
+
+
+/*
+ * ###########################
+ *  INTERNAL HELPER FUNCTIONS
+ * ###########################
+ */
+
+	/**
+	 * isStr
+	 *
+	 * Returns true if passed param is EITHER a simple string OR a 'string object' - otherwise returns false
+	 */
+	var isStr = function (o) {
+		if (typeof o == "string")
+			return true;
+		else if (typeof o == "object") {
+			try {
+				var match = o.constructor.toString().match(/string/i); 
+				return (match !== null);
+			} catch (e) {} 
+		}
+		return false;
+	};
+
+	/**
+	 * str
+	 *
+	 * Returns a simple string if the passed param is EITHER a simple string OR a 'string object',
+	 *  else returns the original object
+	 */
+	var str = function (o) {
+		if (typeof o == "string" || isStr(o)) return $.trim(o); // trim converts 'String object' to a simple string
+		else return o;
+	};
+
+	/**
+	 * min / max
+	 *
+	 * Alias for Math.min/.max to simplify coding
+	 */
+	var min = function (x,y) { return Math.min(x,y); };
+	var max = function (x,y) { return Math.max(x,y); };
+
+	/**
+	 * transformData
+	 *
+	 * Processes the options passed in and transforms them into the format used by layout()
+	 * Missing keys are added, and converts the data if passed in 'flat-format' (no sub-keys)
+	 * In flat-format, pane-specific-settings are prefixed like: north__optName  (2-underscores)
+	 * To update effects, options MUST use nested-keys format, with an effects key
+	 *
+	 * @callers  initOptions()
+	 * @params  JSON  d  Data/options passed by user - may be a single level or nested levels
+	 * @returns JSON  Creates a data struture that perfectly matches 'options', ready to be imported
+	 */
+	var transformData = function (d) {
+		var json = { defaults:{fxSettings:{}}, north:{fxSettings:{}}, south:{fxSettings:{}}, east:{fxSettings:{}}, west:{fxSettings:{}}, center:{fxSettings:{}} };
+		d = d || {};
+		if (d.effects || d.defaults || d.north || d.south || d.west || d.east || d.center)
+			json = $.extend( json, d ); // already in json format - add to base keys
+		else
+			// convert 'flat' to 'nest-keys' format - also handles 'empty' user-options
+			$.each( d, function (key,val) {
+				a = key.split("__");
+				json[ a[1] ? a[0] : "defaults" ][ a[1] ? a[1] : a[0] ] = val;
+			});
+		return json;
+	};
+
+	/**
+	 * setFlowCallback
+	 *
+	 * Set an INTERNAL callback to avoid simultaneous animation
+	 * Runs only if needed and only if all callbacks are not 'already set'!
+	 *
+	 * @param String   action  Either 'open' or 'close'
+	 * @pane  String   pane    A valid border-pane name, eg 'west'
+	 * @pane  Boolean  param   Extra param for callback (optional)
+	 */
+	var setFlowCallback = function (action, pane, param) {
+		var
+			cb = action +","+ pane +","+ (param ? 1 : 0)
+		,	cP, cbPane
+		;
+		$.each(c.borderPanes.split(","), function (i,p) {
+			if (c[p].isMoving) {
+				bindCallback(p); // TRY to bind a callback
+				return false; // BREAK
+			}
+		});
+
+		function bindCallback (p, test) {
+			cP = c[p];
+			if (!cP.doCallback) {
+				cP.doCallback = true;
+				cP.callback = cb;
+			}
+			else { // try to 'chain' this callback
+				cpPane = cP.callback.split(",")[1]; // 2nd param is 'pane'
+				if (cpPane != p && cpPane != pane) // callback target NOT 'itself' and NOT 'this pane'
+					bindCallback (cpPane, true); // RECURSE
+			}
+		}
+	};
+
+	/**
+	 * execFlowCallback
+	 *
+	 * RUN the INTERNAL callback for this pane - if one exists
+	 *
+	 * @param String   action  Either 'open' or 'close'
+	 * @pane  String   pane    A valid border-pane name, eg 'west'
+	 * @pane  Boolean  param   Extra param for callback (optional)
+	 */
+	var execFlowCallback = function (pane) {
+		var cP = c[pane];
+
+		// RESET flow-control flaGs
+		c.isLayoutBusy = false;
+		delete cP.isMoving;
+		if (!cP.doCallback || !cP.callback) return;
+
+		cP.doCallback = false; // RESET logic flag
+
+		// EXECUTE the callback
+		var
+			cb = cP.callback.split(",")
+		,	param = (cb[2] > 0 ? true : false)
+		;
+		if (cb[0] == "open")
+			open( cb[1], param  );
+		else if (cb[0] == "close")
+			close( cb[1], param );
+
+		if (!cP.doCallback) cP.callback = null; // RESET - unless callback above enabled it again!
+	};
+
+	/**
+	 * execUserCallback
+	 *
+	 * Executes a Callback function after a trigger event, like resize, open or close
+	 *
+	 * @param String  pane   This is passed only so we can pass the 'pane object' to the callback
+	 * @param String  v_fn  Accepts a function name, OR a comma-delimited array: [0]=function name, [1]=argument
+	 */
+	var execUserCallback = function (pane, v_fn) {
+		if (!v_fn) return;
+		var fn;
+		try {
+			if (typeof v_fn == "function")
+				fn = v_fn;	
+			else if (typeof v_fn != "string")
+				return;
+			else if (v_fn.indexOf(",") > 0) {
+				// function name cannot contain a comma, so must be a function name AND a 'name' parameter
+				var
+					args = v_fn.split(",")
+				,	fn = eval(args[0])
+				;
+				if (typeof fn=="function" && args.length > 1)
+					return fn(args[1]); // pass the argument parsed from 'list'
+			}
+			else // just the name of an external function?
+				fn = eval(v_fn);
+
+			if (typeof fn=="function")
+				// pass data: pane-name, pane-element, pane-state, pane-options, and layout-name
+				return fn( pane, $Ps[pane], $.extend({},state[pane]), $.extend({},options[pane]), options.name );
+		}
+		catch (ex) {}
+	};
+
+	/**
+	 * cssNum
+	 *
+	 * Returns the 'current CSS value' for an element - returns 0 if property does not exist
+	 *
+	 * @callers  Called by many methods
+	 * @param jQuery  $Elem  Must pass a jQuery object - first element is processed
+	 * @param String  property  The name of the CSS property, eg: top, width, etc.
+	 * @returns Variant  Usually is used to get an integer value for position (top, left) or size (height, width)
+	 */
+	var cssNum = function ($E, prop) {
+		var
+			val = 0
+		,	hidden = false
+		,	visibility = ""
+		;
+		if (!$.browser.msie) { // IE CAN read dimensions of 'hidden' elements - FF CANNOT
+			if ($.curCSS($E[0], "display", true) == "none") {
+				hidden = true;
+				visibility = $.curCSS($E[0], "visibility", true); // SAVE current setting
+				$E.css({ display: "block", visibility: "hidden" }); // show element 'invisibly' so we can measure it
+			}
+		}
+
+		val = parseInt($.curCSS($E[0], prop, true), 10) || 0;
+
+		if (hidden) { // WAS hidden, so put back the way it was
+			$E.css({ display: "none" });
+			if (visibility && visibility != "hidden")
+				$E.css({ visibility: visibility }); // reset 'visibility'
+		}
+
+		return val;
+	};
+
+	/**
+	 * cssW / cssH / cssSize
+	 *
+	 * Contains logic to check boxModel & browser, and return the correct width/height for the current browser/doctype
+	 *
+	 * @callers  initPanes(), sizeMidPanes(), initHandles(), sizeHandles()
+	 * @param Variant  elem  Can accept a 'pane' (east, west, etc) OR a DOM object OR a jQuery object
+	 * @param Integer  outerWidth/outerHeight  (optional) Can pass a width, allowing calculations BEFORE element is resized
+	 * @returns Integer  Returns the innerHeight of the elem by subtracting padding and borders
+	 *
+	 * @TODO  May need to add additional logic to handle more browser/doctype variations?
+	 */
+	var cssW = function (e, outerWidth) {
+		var $E;
+		if (isStr(e)) {
+			e = str(e);
+			$E = $Ps[e];
+		}
+		else
+			$E = $(e);
+
+		// a 'calculated' outerHeight can be passed so borders and/or padding are removed if needed
+		if (outerWidth <= 0)
+			return 0;
+		else if (!(outerWidth>0))
+			outerWidth = isStr(e) ? getPaneSize(e) : $E.outerWidth();
+
+		if (!$.boxModel)
+			return outerWidth;
+
+		else // strip border and padding size from outerWidth to get CSS Width
+			return outerWidth
+				- cssNum($E, "paddingLeft")		
+				- cssNum($E, "paddingRight")
+				- ($.curCSS($E[0], "borderLeftStyle", true) == "none" ? 0 : cssNum($E, "borderLeftWidth"))
+				- ($.curCSS($E[0], "borderRightStyle", true) == "none" ? 0 : cssNum($E, "borderRightWidth"))
+			;
+	};
+	var cssH = function (e, outerHeight) {
+		var $E;
+		if (isStr(e)) {
+			e = str(e);
+			$E = $Ps[e];
+		}
+		else
+			$E = $(e);
+
+		// a 'calculated' outerHeight can be passed so borders and/or padding are removed if needed
+		if (outerHeight <= 0)
+			return 0;
+		else if (!(outerHeight>0))
+			outerHeight = (isStr(e)) ? getPaneSize(e) : $E.outerHeight();
+
+		if (!$.boxModel)
+			return outerHeight;
+
+		else // strip border and padding size from outerHeight to get CSS Height
+			return outerHeight
+				- cssNum($E, "paddingTop")
+				- cssNum($E, "paddingBottom")
+				- ($.curCSS($E[0], "borderTopStyle", true) == "none" ? 0 : cssNum($E, "borderTopWidth"))
+				- ($.curCSS($E[0], "borderBottomStyle", true) == "none" ? 0 : cssNum($E, "borderBottomWidth"))
+			;
+	};
+	var cssSize = function (pane, outerSize) {
+		if (c[pane].dir=="horz") // pane = north or south
+			return cssH(pane, outerSize);
+		else // pane = east or west
+			return cssW(pane, outerSize);
+	};
+
+	/**
+	 * getPaneSize
+	 *
+	 * Calculates the current 'size' (width or height) of a border-pane - optionally with 'pane spacing' added
+	 *
+	 * @returns Integer  Returns EITHER Width for east/west panes OR Height for north/south panes - adjusted for boxModel & browser
+	 */
+	var getPaneSize = function (pane, inclSpace) {
+		var 
+			$P	= $Ps[pane]
+		,	o	= options[pane]
+		,	s	= state[pane]
+		,	oSp	= (inclSpace ? o.spacing_open : 0)
+		,	cSp	= (inclSpace ? o.spacing_closed : 0)
+		;
+		if (!$P || s.isHidden)
+			return 0;
+		else if (s.isClosed || (s.isSliding && inclSpace))
+			return cSp;
+		else if (c[pane].dir == "horz")
+			return $P.outerHeight() + oSp;
+		else // dir == "vert"
+			return $P.outerWidth() + oSp;
+	};
+
+	var setPaneMinMaxSizes = function (pane) {
+		var 
+			d				= cDims
+		,	edge			= c[pane].edge
+		,	dir				= c[pane].dir
+		,	o				= options[pane]
+		,	s				= state[pane]
+		,	$P				= $Ps[pane]
+		,	$altPane		= $Ps[ altSide[pane] ]
+		,	paneSpacing		= o.spacing_open
+		,	altPaneSpacing	= options[ altSide[pane] ].spacing_open
+		,	altPaneSize		= (!$altPane ? 0 : (dir=="horz" ? $altPane.outerHeight() : $altPane.outerWidth()))
+		,	containerSize	= (dir=="horz" ? d.innerHeight : d.innerWidth)
+		//	limitSize prevents this pane from 'overlapping' opposite pane - even if opposite pane is currently closed
+		,	limitSize		= containerSize - paneSpacing - altPaneSize - altPaneSpacing
+		,	minSize			= s.minSize || 0
+		,	maxSize			= Math.min(s.maxSize || 9999, limitSize)
+		,	minPos, maxPos	// used to set resizing limits
+		;
+		switch (pane) {
+			case "north":	minPos = d.offsetTop + minSize;
+							maxPos = d.offsetTop + maxSize;
+							break;
+			case "west":	minPos = d.offsetLeft + minSize;
+							maxPos = d.offsetLeft + maxSize;
+							break;
+			case "south":	minPos = d.offsetTop + d.innerHeight - maxSize;
+							maxPos = d.offsetTop + d.innerHeight - minSize;
+							break;
+			case "east":	minPos = d.offsetLeft + d.innerWidth - maxSize;
+							maxPos = d.offsetLeft + d.innerWidth - minSize;
+							break;
+		}
+		// save data to pane-state
+		$.extend(s, { minSize: minSize, maxSize: maxSize, minPosition: minPos, maxPosition: maxPos });
+	};
+
+	/**
+	 * getPaneDims
+	 *
+	 * Returns data for setting the size/position of center pane. Date is also used to set Height for east/west panes
+	 *
+	 * @returns JSON  Returns a hash of all dimensions: top, bottom, left, right, (outer) width and (outer) height
+	 */
+	var getPaneDims = function () {
+		var d = {
+			top:	getPaneSize("north", true) // true = include 'spacing' value for p
+		,	bottom:	getPaneSize("south", true)
+		,	left:	getPaneSize("west", true)
+		,	right:	getPaneSize("east", true)
+		,	width:	0
+		,	height:	0
+		};
+
+		with (d) {
+			width 	= cDims.innerWidth - left - right;
+			height 	= cDims.innerHeight - bottom - top;
+			// now add the 'container border/padding' to get final positions - relative to the container
+			top		+= cDims.top;
+			bottom	+= cDims.bottom;
+			left	+= cDims.left;
+			right	+= cDims.right;
+		}
+
+		return d;
+	};
+
+
+	/**
+	 * getElemDims
+	 *
+	 * Returns data for setting size of an element (container or a pane).
+	 *
+	 * @callers  create(), onWindowResize() for container, plus others for pane
+	 * @returns JSON  Returns a hash of all dimensions: top, bottom, left, right, outerWidth, innerHeight, etc
+	 */
+	var getElemDims = function ($E) {
+		var
+			d = {} // dimensions hash
+		,	e, b, p // edge, border, padding
+		;
+
+		$.each("Left,Right,Top,Bottom".split(","), function () {
+			e = str(this);
+			b = d["border" +e] = cssNum($E, "border"+e+"Width");
+			p = d["padding"+e] = cssNum($E, "padding"+e);
+			d["offset" +e] = b + p; // total offset of content from outer edge
+			// if BOX MODEL, then 'position' = PADDING (ignore borderWidth)
+			if ($E == $Container)
+				d[e.toLowerCase()] = ($.boxModel ? p : 0); 
+		});
+
+		d.innerWidth  = d.outerWidth  = $E.outerWidth();
+		d.innerHeight = d.outerHeight = $E.outerHeight();
+		if ($.boxModel) {
+			d.innerWidth  -= (d.offsetLeft + d.offsetRight);
+			d.innerHeight -= (d.offsetTop  + d.offsetBottom);
+		}
+
+		return d;
+	};
+
+
+	var setTimer = function (pane, action, fn, ms) {
+		var
+			Layout = window.layout = window.layout || {}
+		,	Timers = Layout.timers = Layout.timers || {}
+		,	name = "layout_"+ state.id +"_"+ pane +"_"+ action // UNIQUE NAME for every layout-pane-action
+		;
+		if (Timers[name]) return; // timer already set!
+		else Timers[name] = setTimeout(fn, ms);
+	};
+
+	var clearTimer = function (pane, action) {
+		var
+			Layout = window.layout = window.layout || {}
+		,	Timers = Layout.timers = Layout.timers || {}
+		,	name = "layout_"+ state.id +"_"+ pane +"_"+ action // UNIQUE NAME for every layout-pane-action
+		;
+		if (Timers[name]) {
+			clearTimeout( Timers[name] );
+			delete Timers[name];
+			return true;
+		}
+		else
+			return false;
+	};
+
+
+/*
+ * ###########################
+ *   INITIALIZATION METHODS
+ * ###########################
+ */
+
+	/**
+	 * create
+	 *
+	 * Initialize the layout - called automatically whenever an instance of layout is created
+	 *
+	 * @callers  NEVER explicity called
+	 * @returns  An object pointer to the instance created
+	 */
+	var create = function () {
+		// initialize config/options
+		initOptions();
+
+		// initialize all objects
+		initContainer();	// set CSS as needed and init state.container dimensions
+		initPanes();		// size & position all panes
+		initHandles();		// create and position all resize bars & togglers buttons
+		initResizable();	// activate resizing on all panes where resizable=true
+		sizeContent("all");	// AFTER panes & handles have been initialized, size 'content' divs
+
+		if (options.scrollToBookmarkOnLoad)
+			with (self.location) if (hash) replace( hash ); // scrollTo Bookmark
+
+		// bind hotkey function - keyDown - if required
+		initHotkeys();
+
+		// bind resizeAll() for 'this layout instance' to window.resize event
+		$(window).resize(function () {
+			var timerID = "timerLayout_"+state.id;
+			if (window[timerID]) clearTimeout(window[timerID]);
+			window[timerID] = null;
+			if (true || $.browser.msie) // use a delay for IE because the resize event fires repeatly
+				window[timerID] = setTimeout(resizeAll, 100);
+			else // most other browsers have a built-in delay before firing the resize event
+				resizeAll(); // resize all layout elements NOW!
+		});
+	};
+
+	/**
+	 * initContainer
+	 *
+	 * Validate and initialize container CSS and events
+	 *
+	 * @callers  create()
+	 */
+	var initContainer = function () {
+		try { // format html/body if this is a full page layout
+			if ($Container[0].tagName == "BODY") {
+				$("html").css({
+					height:		"100%"
+				,	overflow:	"hidden"
+				});
+				$("body").css({
+					position:	"relative"
+				,	height:		"100%"
+				,	overflow:	"hidden"
+				,	margin:		0
+				,	padding:	0		// TODO: test whether body-padding could be handled?
+				,	border:		"none"	// a body-border creates problems because it cannot be measured!
+				});
+			}
+			else { // set required CSS - overflow and position
+				var
+					CSS	= { overflow: "hidden" } // make sure container will not 'scroll'
+				,	p	= $Container.css("position")
+				,	h	= $Container.css("height")
+				;
+				// if this is a NESTED layout, then outer-pane ALREADY has position and height
+				if (!$Container.hasClass("ui-layout-pane")) {
+					if (!p || "fixed,absolute,relative".indexOf(p) < 0)
+						CSS.position = "relative"; // container MUST have a 'position'
+					if (!h || h=="auto")
+						CSS.height = "100%"; // container MUST have a 'height'
+				}
+				$Container.css( CSS );
+			}
+		} catch (ex) {}
+
+		// get layout-container dimensions (updated when necessary)
+		cDims = state.container = getElemDims( $Container ); // update data-pointer too
+	};
+
+	/**
+	 * initHotkeys
+	 *
+	 * Bind layout hotkeys - if options enabled
+	 *
+	 * @callers  create()
+	 */
+	var initHotkeys = function () {
+		// bind keyDown to capture hotkeys, if option enabled for ANY pane
+		$.each(c.borderPanes.split(","), function (i,pane) {
+			var o = options[pane];
+			if (o.enableCursorHotkey || o.customHotkey) {
+				$(document).keydown( keyDown ); // only need to bind this ONCE
+				return false; // BREAK - binding was done
+			}
+		});
+	};
+
+	/**
+	 * initOptions
+	 *
+	 * Build final CONFIG and OPTIONS data
+	 *
+	 * @callers  create()
+	 */
+	var initOptions = function () {
+		// simplify logic by making sure passed 'opts' var has basic keys
+		opts = transformData( opts );
+
+		// update default effects, if case user passed key
+		if (opts.effects) {
+			$.extend( effects, opts.effects );
+			delete opts.effects;
+		}
+
+		// see if any 'global options' were specified
+		$.each("name,scrollToBookmarkOnLoad".split(","), function (idx,key) {
+			if (opts[key] !== undefined)
+				options[key] = opts[key];
+			else if (opts.defaults[key] !== undefined) {
+				options[key] = opts.defaults[key];
+				delete opts.defaults[key];
+			}
+		});
+
+		// remove any 'defaults' that MUST be set 'per-pane'
+		$.each("paneSelector,resizerCursor,customHotkey".split(","),
+			function (idx,key) { delete opts.defaults[key]; } // is OK if key does not exist
+		);
+
+		// now update options.defaults
+		$.extend( options.defaults, opts.defaults );
+		// make sure required sub-keys exist
+		//if (typeof options.defaults.fxSettings != "object") options.defaults.fxSettings = {};
+
+		// merge all config & options for the 'center' pane
+		c.center = $.extend( true, {}, c.defaults, c.center );
+		$.extend( options.center, opts.center );
+		// Most 'default options' do not apply to 'center', so add only those that DO
+		var o_Center = $.extend( true, {}, options.defaults, opts.defaults, options.center ); // TEMP data
+		$.each("paneClass,contentSelector,contentIgnoreSelector,applyDefaultStyles,showOverflowOnHover".split(","),
+			function (idx,key) { options.center[key] = o_Center[key]; }
+		);
+
+		var defs = options.defaults;
+
+		// create a COMPLETE set of options for EACH border-pane
+		$.each(c.borderPanes.split(","), function(i,pane) {
+			// apply 'pane-defaults' to CONFIG.PANE
+			c[pane] = $.extend( true, {}, c.defaults, c[pane] );
+			// apply 'pane-defaults' +  user-options to OPTIONS.PANE
+			o = options[pane] = $.extend( true, {}, options.defaults, options[pane], opts.defaults, opts[pane] );
+
+			// make sure we have base-classes
+			if (!o.paneClass)		o.paneClass		= defaults.paneClass;
+			if (!o.resizerClass)	o.resizerClass	= defaults.resizerClass;
+			if (!o.togglerClass)	o.togglerClass	= defaults.togglerClass;
+
+			// create FINAL fx options for each pane, ie: options.PANE.fxName/fxSpeed/fxSettings[_open|_close]
+			$.each(["_open","_close",""], function (i,n) { 
+				var
+					sName		= "fxName"+n
+				,	sSpeed		= "fxSpeed"+n
+				,	sSettings	= "fxSettings"+n
+				;
+				// recalculate fxName according to specificity rules
+				o[sName] =
+					opts[pane][sName]		// opts.west.fxName_open
+				||	opts[pane].fxName		// opts.west.fxName
+				||	opts.defaults[sName]	// opts.defaults.fxName_open
+				||	opts.defaults.fxName	// opts.defaults.fxName
+				||	o[sName]				// options.west.fxName_open
+				||	o.fxName				// options.west.fxName
+				||	defs[sName]				// options.defaults.fxName_open
+				||	defs.fxName				// options.defaults.fxName
+				||	"none"
+				;
+				// validate fxName to be sure is a valid effect
+				var fxName = o[sName];
+				if (fxName == "none" || !$.effects || !$.effects[fxName] || (!effects[fxName] && !o[sSettings] && !o.fxSettings))
+					fxName = o[sName] = "none"; // effect not loaded, OR undefined FX AND fxSettings not passed
+				// set vars for effects subkeys to simplify logic
+				var
+					fx = effects[fxName]	|| {} // effects.slide
+				,	fx_all	= fx.all		|| {} // effects.slide.all
+				,	fx_pane	= fx[pane]		|| {} // effects.slide.west
+				;
+				// RECREATE the fxSettings[_open|_close] keys using specificity rules
+				o[sSettings] = $.extend(
+					{}
+				,	fx_all						// effects.slide.all
+				,	fx_pane						// effects.slide.west
+				,	defs.fxSettings || {}		// options.defaults.fxSettings
+				,	defs[sSettings] || {}		// options.defaults.fxSettings_open
+				,	o.fxSettings				// options.west.fxSettings
+				,	o[sSettings]				// options.west.fxSettings_open
+				,	opts.defaults.fxSettings	// opts.defaults.fxSettings
+				,	opts.defaults[sSettings] || {} // opts.defaults.fxSettings_open
+				,	opts[pane].fxSettings		// opts.west.fxSettings
+				,	opts[pane][sSettings] || {}	// opts.west.fxSettings_open
+				);
+				// recalculate fxSpeed according to specificity rules
+				o[sSpeed] =
+					opts[pane][sSpeed]		// opts.west.fxSpeed_open
+				||	opts[pane].fxSpeed		// opts.west.fxSpeed (pane-default)
+				||	opts.defaults[sSpeed]	// opts.defaults.fxSpeed_open
+				||	opts.defaults.fxSpeed	// opts.defaults.fxSpeed
+				||	o[sSpeed]				// options.west.fxSpeed_open
+				||	o[sSettings].duration	// options.west.fxSettings_open.duration
+				||	o.fxSpeed				// options.west.fxSpeed
+				||	o.fxSettings.duration	// options.west.fxSettings.duration
+				||	defs.fxSpeed			// options.defaults.fxSpeed
+				||	defs.fxSettings.duration// options.defaults.fxSettings.duration
+				||	fx_pane.duration		// effects.slide.west.duration
+				||	fx_all.duration			// effects.slide.all.duration
+				||	"normal"				// DEFAULT
+				;
+				// DEBUG: if (pane=="east") debugData( $.extend({}, {speed: o[sSpeed], fxSettings_duration: o[sSettings].duration}, o[sSettings]), pane+"."+sName+" = "+fxName );
+			});
+		});
+	};
+
+	/**
+	 * initPanes
+	 *
+	 * Initialize module objects, styling, size and position for all panes
+	 *
+	 * @callers  create()
+	 */
+	var initPanes = function () {
+		// NOTE: do north & south FIRST so we can measure their height - do center LAST
+		$.each(c.allPanes.split(","), function() {
+			var 
+				pane	= str(this)
+			,	o		= options[pane]
+			,	s		= state[pane]
+			,	fx		= s.fx
+			,	dir		= c[pane].dir
+			//	if o.size is not > 0, then we will use MEASURE the pane and use that as it's 'size'
+			,	size	= o.size=="auto" || isNaN(o.size) ? 0 : o.size
+			,	minSize	= o.minSize || 1
+			,	maxSize	= o.maxSize || 9999
+			,	spacing	= o.spacing_open || 0
+			,	sel		= o.paneSelector
+			,	isIE6	= ($.browser.msie && $.browser.version < 7)
+			,	CSS		= {}
+			,	$P, $C
+			;
+			$Cs[pane] = false; // init
+
+			if (sel.substr(0,1)==="#") // ID selector
+				// NOTE: elements selected 'by ID' DO NOT have to be 'children'
+				$P = $Ps[pane] = $Container.find(sel+":first");
+			else { // class or other selector
+				$P = $Ps[pane] = $Container.children(sel+":first");
+				// look for the pane nested inside a 'form' element
+				if (!$P.length) $P = $Ps[pane] = $Container.children("form:first").children(sel+":first");
+			}
+
+			if (!$P.length) {
+				$Ps[pane] = false; // logic
+				return true; // SKIP to next
+			}
+
+			// add basic classes & attributes
+			$P
+				.attr("pane", pane) // add pane-identifier
+				.addClass( o.paneClass +" "+ o.paneClass+"-"+pane ) // default = "ui-layout-pane ui-layout-pane-west" - may be a dupe of 'paneSelector'
+			;
+
+			// init pane-logic vars, etc.
+			if (pane != "center") {
+				s.isClosed  = false; // true = pane is closed
+				s.isSliding = false; // true = pane is currently open by 'sliding' over adjacent panes
+				s.isResizing= false; // true = pane is in process of being resized
+				s.isHidden	= false; // true = pane is hidden - no spacing, resizer or toggler is visible!
+				s.noRoom	= false; // true = pane 'automatically' hidden due to insufficient room - will unhide automatically
+				// create special keys for internal use
+				c[pane].pins = [];   // used to track and sync 'pin-buttons' for border-panes
+			}
+
+			CSS = $.extend({ visibility: "visible", display: "block" }, c.defaults.cssReq, c[pane].cssReq );
+			if (o.applyDefaultStyles) $.extend( CSS, c.defaults.cssDef, c[pane].cssDef ); // cosmetic defaults
+			$P.css(CSS); // add base-css BEFORE 'measuring' to calc size & position
+			CSS = {};	// reset var
+
+			// set css-position to account for container borders & padding
+			switch (pane) {
+				case "north": 	CSS.top 	= cDims.top;
+								CSS.left 	= cDims.left;
+								CSS.right	= cDims.right;
+								break;
+				case "south": 	CSS.bottom	= cDims.bottom;
+								CSS.left 	= cDims.left;
+								CSS.right 	= cDims.right;
+								break;
+				case "west": 	CSS.left 	= cDims.left; // top, bottom & height set by sizeMidPanes()
+								break;
+				case "east": 	CSS.right 	= cDims.right; // ditto
+								break;
+				case "center":	// top, left, width & height set by sizeMidPanes()
+			}
+
+			if (dir == "horz") { // north or south pane
+				if (size === 0 || size == "auto") {
+					$P.css({ height: "auto" });
+					size = $P.outerHeight();
+				}
+				size = max(size, minSize);
+				size = min(size, maxSize);
+				size = min(size, cDims.innerHeight - spacing);
+				CSS.height = max(1, cssH(pane, size));
+				s.size = size; // update state
+				// make sure minSize is sufficient to avoid errors
+				s.maxSize = maxSize; // init value
+				s.minSize = max(minSize, size - CSS.height + 1); // = pane.outerHeight when css.height = 1px
+				// handle IE6
+				//if (isIE6) CSS.width = cssW($P, cDims.innerWidth);
+				$P.css(CSS); // apply size & position
+			}
+			else if (dir == "vert") { // east or west pane
+				if (size === 0 || size == "auto") {
+					$P.css({ width: "auto", float: "left" }); // float = FORCE pane to auto-size
+					size = $P.outerWidth();
+					$P.css({ float: "none" }); // RESET
+				}
+				size = max(size, minSize);
+				size = min(size, maxSize);
+				size = min(size, cDims.innerWidth - spacing);
+				CSS.width = max(1, cssW(pane, size));
+				s.size = size; // update state
+				s.maxSize = maxSize; // init value
+				// make sure minSize is sufficient to avoid errors
+				s.minSize = max(minSize, size - CSS.width + 1); // = pane.outerWidth when css.width = 1px
+				$P.css(CSS); // apply size - top, bottom & height set by sizeMidPanes
+				sizeMidPanes(pane, null, true); // true = onInit
+			}
+			else if (pane == "center") {
+				$P.css(CSS); // top, left, width & height set by sizeMidPanes...
+				sizeMidPanes("center", null, true); // true = onInit
+			}
+
+			// close or hide the pane if specified in settings
+			if (o.initClosed && o.closable) {
+				$P.hide().addClass("closed");
+				s.isClosed = true;
+			}
+			else if (o.initHidden || o.initClosed) {
+				hide(pane, true); // will be completely invisible - no resizer or spacing
+				s.isHidden = true;
+			}
+			else
+				$P.addClass("open");
+
+			// check option for auto-handling of pop-ups & drop-downs
+			if (o.showOverflowOnHover)
+				$P.hover( allowOverflow, resetOverflow );
+
+			/*
+			 *	see if this pane has a 'content element' that we need to auto-size
+			 */
+			if (o.contentSelector) {
+				$C = $Cs[pane] = $P.children(o.contentSelector+":first"); // match 1-element only
+				if (!$C.length) {
+					$Cs[pane] = false;
+					return true; // SKIP to next
+				}
+				$C.css( c.content.cssReq );
+				if (o.applyDefaultStyles) $C.css( c.content.cssDef ); // cosmetic defaults
+				// NO PANE-SCROLLING when there is a content-div
+				$P.css({ overflow: "hidden" });
+			}
+		});
+	};
+
+	/**
+	 * initHandles
+	 *
+	 * Initialize module objects, styling, size and position for all resize bars and toggler buttons
+	 *
+	 * @callers  create()
+	 */
+	var initHandles = function () {
+		// create toggler DIVs for each pane, and set object pointers for them, eg: $R.north = north toggler DIV
+		$.each(c.borderPanes.split(","), function() {
+			var 
+				pane	= str(this)
+			,	o		= options[pane]
+			,	s		= state[pane]
+			,	rClass	= o.resizerClass
+			,	tClass	= o.togglerClass
+			,	$P		= $Ps[pane]
+			;
+			$Rs[pane] = false; // INIT
+			$Ts[pane] = false;
+
+			if (!$P || (!o.closable && !o.resizable)) return; // pane does not exist - skip
+
+			var 
+				edge	= c[pane].edge
+			,	isOpen	= $P.is(":visible")
+			,	spacing	= (isOpen ? o.spacing_open : o.spacing_closed)
+			,	_pane	= "-"+ pane // used for classNames
+			,	_state	= (isOpen ? "-open" : "-closed") // used for classNames
+			,	$R, $T
+			;
+			// INIT RESIZER BAR
+			$R = $Rs[pane] = $("<span></span>");
+	
+			if (isOpen && o.resizable)
+				; // this is handled by initResizable
+			else if (!isOpen && o.slidable)
+				$R.attr("title", o.sliderTip).css("cursor", o.sliderCursor);
+	
+			$R
+				// if paneSelector is an ID, then create a matching ID for the resizer, eg: "#paneLeft" => "paneLeft-resizer"
+				.attr("id", (o.paneSelector.substr(0,1)=="#" ? o.paneSelector.substr(1) + "-resizer" : ""))
+				.attr("resizer", pane) // so we can read this from the resizer
+				.css(c.resizers.cssReq) // add base/required styles
+				// POSITION of resizer bar - allow for container border & padding
+				.css(edge, cDims[edge] + getPaneSize(pane))
+				// ADD CLASSNAMES - eg: class="resizer resizer-west resizer-open"
+				.addClass( rClass +" "+ rClass+_pane +" "+ rClass+_state +" "+ rClass+_pane+_state )
+				.appendTo($Container) // append DIV to container
+			;
+			 // ADD VISUAL STYLES
+			if (o.applyDefaultStyles)
+				$R.css(c.resizers.cssDef);
+
+			if (o.closable) {
+				// INIT COLLAPSER BUTTON
+				$T = $Ts[pane] = $("<div></div>");
+				$T
+					// if paneSelector is an ID, then create a matching ID for the resizer, eg: "#paneLeft" => "paneLeft-toggler"
+					.attr("id", (o.paneSelector.substr(0,1)=="#" ? o.paneSelector.substr(1) + "-toggler" : ""))
+					.css(c.togglers.cssReq) // add base/required styles
+					.attr("title", (isOpen ? o.togglerTip_open : o.togglerTip_closed))
+					.click(function(evt){ toggle(pane); evt.stopPropagation(); })
+					.mouseover(function(evt){ evt.stopPropagation(); }) // prevent resizer event
+					// ADD CLASSNAMES - eg: class="toggler toggler-west toggler-west-open"
+					.addClass( tClass +" "+ tClass+_pane +" "+ tClass+_state +" "+ tClass+_pane+_state )
+					.appendTo($R) // append SPAN to resizer DIV
+				;
+
+				// ADD INNER-SPANS TO TOGGLER
+				if (o.togglerContent_open) // ui-layout-open
+					$("<span>"+ o.togglerContent_open +"</span>")
+						.addClass("content content-open")
+						.css("display", s.isClosed ? "none" : "block")
+						.appendTo( $T )
+					;
+				if (o.togglerContent_closed) // ui-layout-closed
+					$("<span>"+ o.togglerContent_closed +"</span>")
+						.addClass("content content-closed")
+						.css("display", s.isClosed ? "block" : "none")
+						.appendTo( $T )
+					;
+
+				 // ADD BASIC VISUAL STYLES
+				if (o.applyDefaultStyles)
+					$T.css(c.togglers.cssDef);
+
+				if (!isOpen) bindStartSlidingEvent(pane, true); // will enable if state.PANE.isSliding = true
+			}
+
+		});
+
+		// SET ALL HANDLE SIZES & LENGTHS
+		sizeHandles("all", true); // true = onInit
+	};
+
+	/**
+	 * initResizable
+	 *
+	 * Add resize-bars to all panes that specify it in options
+	 *
+	 * @dependancies  $.fn.resizable - will abort if not found
+	 * @callers  create()
+	 */
+	var initResizable = function () {
+		var
+			draggingAvailable = (typeof $.fn.draggable == "function")
+		,	minPosition, maxPosition, edge // set in start()
+		;
+
+		$.each(c.borderPanes.split(","), function() {
+			var 
+				pane	= str(this)
+			,	o		= options[pane]
+			,	s		= state[pane]
+			;
+			if (!draggingAvailable || !$Ps[pane] || !o.resizable) {
+				o.resizable = false;
+				return true; // skip to next
+			}
+
+			var 
+				rClass				= o.resizerClass
+			//	'drag' classes are applied to the ORIGINAL resizer-bar while dragging is in process
+			,	dragClass			= rClass+"-drag"			// resizer-drag
+			,	dragPaneClass		= rClass+"-"+pane+"-drag"	// resizer-north-drag
+			//	'dragging' class is applied to the CLONED resizer-bar while it is being dragged
+			,	draggingClass		= rClass+"-dragging"		// resizer-dragging
+			,	draggingPaneClass	= rClass+"-"+pane+"-dragging" // resizer-north-dragging
+			,	draggingClassSet	= false 					// logic var
+			,	$P 					= $Ps[pane]
+			,	$R					= $Rs[pane]
+			;
+
+			if (!s.isClosed)
+				$R
+					.attr("title", o.resizerTip)
+					.css("cursor", o.resizerCursor) // n-resize, s-resize, etc
+				;
+
+			$R.draggable({
+				containment:	$Container[0] // limit resizing to layout container
+			,	axis:			(c[pane].dir=="horz" ? "y" : "x") // limit resizing to horz or vert axis
+			,	delay:			200
+			,	distance:		1
+			//	basic format for helper - style it using class: .ui-draggable-dragging
+			,	helper:			"clone"
+			,	opacity:		o.resizerDragOpacity
+			//,	iframeFix:		o.draggableIframeFix // TODO: consider using when bug is fixed
+			,	zIndex:			c.zIndex.resizing
+
+			,	start: function (e, ui) {
+					// onresize_start callback - will CANCEL hide if returns false
+					// TODO: CONFIRM that dragging can be cancelled like this???
+					if (false === execUserCallback(pane, o.onresize_start)) return false;
+
+					s.isResizing = true; // prevent pane from closing while resizing
+					clearTimer(pane, "closeSlider"); // just in case already triggered
+
+					$R.addClass( dragClass +" "+ dragPaneClass ); // add drag classes
+					draggingClassSet = false; // reset logic var - see drag()
+
+					// SET RESIZING LIMITS - used in drag()
+					var resizerWidth = (pane=="east" || pane=="south" ? o.spacing_open : 0);
+					setPaneMinMaxSizes(pane); // update pane-state
+					s.minPosition -= resizerWidth;
+					s.maxPosition -= resizerWidth;
+					edge = (c[pane].dir=="horz" ? "top" : "left");
+
+					// MASK PANES WITH IFRAMES OR OTHER TROUBLESOME ELEMENTS
+					$(o.maskIframesOnResize === true ? "iframe" : o.maskIframesOnResize).each(function() {					
+						$('<div class="ui-layout-mask"/>')
+							.css({
+								background:	"#fff"
+							,	opacity:	"0.001"
+							,	zIndex:		9
+							,	position:	"absolute"
+							,	width:		this.offsetWidth+"px"
+							,	height:		this.offsetHeight+"px"
+							})
+							.css($(this).offset()) // top & left
+							.appendTo(this.parentNode) // put div INSIDE pane to avoid zIndex issues
+						;
+					});
+				}
+
+			,	drag: function (e, ui) {
+					if (!draggingClassSet) { // can only add classes after clone has been added to the DOM
+						$(".ui-draggable-dragging")
+							.addClass( draggingClass +" "+ draggingPaneClass ) // add dragging classes
+							.children().css("visibility","hidden") // hide toggler inside dragged resizer-bar
+						;
+						draggingClassSet = true;
+						// draggable bug!? RE-SET zIndex to prevent E/W resize-bar showing through N/S pane!
+						if (s.isSliding) $Ps[pane].css("zIndex", c.zIndex.sliding);
+					}
+					// CONTAIN RESIZER-BAR TO RESIZING LIMITS
+					if		(ui.position[edge] < s.minPosition) ui.position[edge] = s.minPosition;
+					else if (ui.position[edge] > s.maxPosition) ui.position[edge] = s.maxPosition;
+				}
+
+			,	stop: function (e, ui) {
+					var 
+						dragPos	= ui.position
+					,	resizerPos
+					,	newSize
+					;
+					$R.removeClass( dragClass +" "+ dragPaneClass ); // remove drag classes
+	
+					switch (pane) {
+						case "north":	resizerPos = dragPos.top; break;
+						case "west":	resizerPos = dragPos.left; break;
+						case "south":	resizerPos = cDims.outerHeight - dragPos.top - $R.outerHeight(); break;
+						case "east":	resizerPos = cDims.outerWidth - dragPos.left - $R.outerWidth(); break;
+					}
+					// remove container margin from resizer position to get the pane size
+					newSize = resizerPos - cDims[ c[pane].edge ];
+
+					sizePane(pane, newSize);
+
+					// UN-MASK PANES MASKED IN drag.start
+					$("div.ui-layout-mask").remove(); // Remove iframe masks	
+
+					s.isResizing = false;
+				}
+
+			});
+		});
+	};
+
+
+
+/*
+ * ###########################
+ *       ACTION METHODS
+ * ###########################
+ */
+
+	/**
+	 * hide / show
+	 *
+	 * Completely 'hides' a pane, including its spacing - as if it does not exist
+	 * The pane is not actually 'removed' from the source, so can use 'show' to un-hide it
+	 *
+	 * @param String  pane   The pane being hidden, ie: north, south, east, or west
+	 */
+	var hide = function (pane, onInit) {
+		var
+			o	= options[pane]
+		,	s	= state[pane]
+		,	$P	= $Ps[pane]
+		,	$R	= $Rs[pane]
+		;
+		if (!$P || s.isHidden) return; // pane does not exist OR is already hidden
+
+		// onhide_start callback - will CANCEL hide if returns false
+		if (false === execUserCallback(pane, o.onhide_start)) return;
+
+		s.isSliding = false; // just in case
+
+		// now hide the elements
+		if ($R) $R.hide(); // hide resizer-bar
+		if (onInit || s.isClosed) {
+			s.isClosed = true; // to trigger open-animation on show()
+			s.isHidden  = true;
+			$P.hide(); // no animation when loading page
+			sizeMidPanes(c[pane].dir == "horz" ? "all" : "center");
+			execUserCallback(pane, o.onhide_end || o.onhide);
+		}
+		else {
+			s.isHiding = true; // used by onclose
+			close(pane, false); // adjust all panes to fit
+			//s.isHidden  = true; - will be set by close - if not cancelled
+		}
+	};
+
+	var show = function (pane, openPane) {
+		var
+			o	= options[pane]
+		,	s	= state[pane]
+		,	$P	= $Ps[pane]
+		,	$R	= $Rs[pane]
+		;
+		if (!$P || !s.isHidden) return; // pane does not exist OR is not hidden
+
+		// onhide_start callback - will CANCEL hide if returns false
+		if (false === execUserCallback(pane, o.onshow_start)) return;
+
+		s.isSliding = false; // just in case
+		s.isShowing = true; // used by onopen/onclose
+		//s.isHidden  = false; - will be set by open/close - if not cancelled
+
+		// now show the elements
+		if ($R && o.spacing_open > 0) $R.show();
+		if (openPane === false)
+			close(pane, true); // true = force
+		else
+			open(pane); // adjust all panes to fit
+	};
+
+
+	/**
+	 * toggle
+	 *
+	 * Toggles a pane open/closed by calling either open or close
+	 *
+	 * @param String  pane   The pane being toggled, ie: north, south, east, or west
+	 */
+	var toggle = function (pane) {
+		var s = state[pane];
+		if (s.isHidden)
+			show(pane); // will call 'open' after unhiding it
+		else if (s.isClosed)
+			open(pane);
+		else
+			close(pane);
+	};
+
+	/**
+	 * close
+	 *
+	 * Close the specified pane (animation optional), and resize all other panes as needed
+	 *
+	 * @param String  pane   The pane being closed, ie: north, south, east, or west
+	 */
+	var close = function (pane, force, noAnimation) {
+		var 
+			$P		= $Ps[pane]
+		,	$R		= $Rs[pane]
+		,	$T		= $Ts[pane]
+		,	o		= options[pane]
+		,	s		= state[pane]
+		,	doFX	= !noAnimation && !s.isClosed && (o.fxName_close != "none")
+		,	edge	= c[pane].edge
+		,	rClass	= o.resizerClass
+		,	tClass	= o.togglerClass
+		,	_pane	= "-"+ pane // used for classNames
+		,	_open	= "-open"
+		,	_sliding= "-sliding"
+		,	_closed	= "-closed"
+		// 	transfer logic vars to temp vars
+		,	isShowing = s.isShowing
+		,	isHiding = s.isHiding
+		;
+		// now clear the logic vars
+		delete s.isShowing;
+		delete s.isHiding;
+
+		if (!$P || (!o.resizable && !o.closable)) return; // invalid request
+		else if (!force && s.isClosed && !isShowing) return; // already closed
+
+		if (c.isLayoutBusy) { // layout is 'busy' - probably with an animation
+			setFlowCallback("close", pane, force); // set a callback for this action, if possible
+			return; // ABORT 
+		}
+
+		// onclose_start callback - will CANCEL hide if returns false
+		// SKIP if just 'showing' a hidden pane as 'closed'
+		if (!isShowing && false === execUserCallback(pane, o.onclose_start)) return;
+
+		// SET flow-control flags
+		c[pane].isMoving = true;
+		c.isLayoutBusy = true;
+
+		s.isClosed = true;
+		// update isHidden BEFORE sizing panes
+		if (isHiding) s.isHidden = true;
+		else if (isShowing) s.isHidden = false;
+
+		// sync any 'pin buttons'
+		syncPinBtns(pane, false);
+
+		// resize panes adjacent to this one
+		if (!s.isSliding) sizeMidPanes(c[pane].dir == "horz" ? "all" : "center");
+
+		// if this pane has a resizer bar, move it now
+		if ($R) {
+			$R
+				.css(edge, cDims[edge]) // move the resizer bar
+				.removeClass( rClass+_open +" "+ rClass+_pane+_open )
+				.removeClass( rClass+_sliding +" "+ rClass+_pane+_sliding )
+				.addClass( rClass+_closed +" "+ rClass+_pane+_closed )
+			;
+			// DISABLE 'resizing' when closed - do this BEFORE bindStartSlidingEvent
+			if (o.resizable)
+				$R
+					.draggable("disable")
+					.css("cursor", "default")
+					.attr("title","")
+				;
+			// if pane has a toggler button, adjust that too
+			if ($T) {
+				$T
+					.removeClass( tClass+_open +" "+ tClass+_pane+_open )
+					.addClass( tClass+_closed +" "+ tClass+_pane+_closed )
+					.attr("title", o.togglerTip_closed) // may be blank
+				;
+			}
+			sizeHandles(); // resize 'length' and position togglers for adjacent panes
+		}
+
+		// ANIMATE 'CLOSE' - if no animation, then was ALREADY shown above
+		if (doFX) {
+			lockPaneForFX(pane, true); // need to set left/top so animation will work
+			$P.hide( o.fxName_close, o.fxSettings_close, o.fxSpeed_close, function () {
+				lockPaneForFX(pane, false); // undo
+				if (!s.isClosed) return; // pane was opened before animation finished!
+				close_2();
+			});
+		}
+		else {
+			$P.hide(); // just hide pane NOW
+			close_2();
+		}
+
+		// SUBROUTINE
+		function close_2 () {
+			bindStartSlidingEvent(pane, true); // will enable if state.PANE.isSliding = true
+
+			// onclose callback - UNLESS just 'showing' a hidden pane as 'closed'
+			if (!isShowing)	execUserCallback(pane, o.onclose_end || o.onclose);
+			// onhide OR onshow callback
+			if (isShowing)	execUserCallback(pane, o.onshow_end || o.onshow);
+			if (isHiding)	execUserCallback(pane, o.onhide_end || o.onhide);
+
+			// internal flow-control callback
+			execFlowCallback(pane);
+		}
+	};
+
+	/**
+	 * open
+	 *
+	 * Open the specified pane (animation optional), and resize all other panes as needed
+	 *
+	 * @param String  pane   The pane being opened, ie: north, south, east, or west
+	 */
+	var open = function (pane, slide, noAnimation) {
+		var 
+			$P		= $Ps[pane]
+		,	$R		= $Rs[pane]
+		,	$T		= $Ts[pane]
+		,	o		= options[pane]
+		,	s		= state[pane]
+		,	doFX	= !noAnimation && s.isClosed && (o.fxName_open != "none")
+		,	edge	= c[pane].edge
+		,	rClass	= o.resizerClass
+		,	tClass	= o.togglerClass
+		,	_pane	= "-"+ pane // used for classNames
+		,	_open	= "-open"
+		,	_closed	= "-closed"
+		,	_sliding= "-sliding"
+		// 	transfer logic var to temp var
+		,	isShowing = s.isShowing
+		;
+		// now clear the logic var
+		delete s.isShowing;
+
+		if (!$P || (!o.resizable && !o.closable)) return; // invalid request
+		else if (!s.isClosed && !s.isSliding) return; // already open
+
+		// pane can ALSO be unhidden by just calling show(), so handle this scenario
+		if (s.isHidden && !isShowing) {
+			show(pane, true);
+			return;
+		}
+
+		if (c.isLayoutBusy) { // layout is 'busy' - probably with an animation
+			setFlowCallback("open", pane, slide); // set a callback for this action, if possible
+			return; // ABORT
+		}
+
+		// onopen_start callback - will CANCEL hide if returns false
+		if (false === execUserCallback(pane, o.onopen_start)) return;
+
+		// SET flow-control flags
+		c[pane].isMoving = true;
+		c.isLayoutBusy = true;
+
+		// 'PIN PANE' - stop sliding
+		if (s.isSliding && !slide) // !slide = 'open pane normally' - NOT sliding
+			bindStopSlidingEvents(pane, false); // will set isSliding=false
+
+		s.isClosed = false;
+		// update isHidden BEFORE sizing panes
+		if (isShowing) s.isHidden = false;
+
+		// Container size may have changed - shrink the pane if now 'too big'
+		setPaneMinMaxSizes(pane); // update pane-state
+		if (s.size > s.maxSize) // pane is too big! resize it before opening
+			$P.css( c[pane].sizeType, max(1, cssSize(pane, s.maxSize)) );
+
+		bindStartSlidingEvent(pane, false); // remove trigger event from resizer-bar
+
+		if (doFX) { // ANIMATE
+			lockPaneForFX(pane, true); // need to set left/top so animation will work
+			$P.show( o.fxName_open, o.fxSettings_open, o.fxSpeed_open, function() {
+				lockPaneForFX(pane, false); // undo
+				if (s.isClosed) return; // pane was closed before animation finished!
+				open_2(); // continue
+			});
+		}
+		else {// no animation
+			$P.show();	// just show pane and...
+			open_2();	// continue
+		}
+
+		// SUBROUTINE
+		function open_2 () {
+			// NOTE: if isSliding, then other panes are NOT 'resized'
+			if (!s.isSliding) // resize all panes adjacent to this one
+				sizeMidPanes(c[pane].dir=="vert" ? "center" : "all");
+
+			// if this pane has a toggler, move it now
+			if ($R) {
+				$R
+					.css(edge, cDims[edge] + getPaneSize(pane)) // move the toggler
+					.removeClass( rClass+_closed +" "+ rClass+_pane+_closed )
+					.addClass( rClass+_open +" "+ rClass+_pane+_open )
+					.addClass( !s.isSliding ? "" : rClass+_sliding +" "+ rClass+_pane+_sliding )
+				;
+				if (o.resizable)
+					$R
+						.draggable("enable")
+						.css("cursor", o.resizerCursor)
+						.attr("title", o.resizerTip)
+					;
+				else
+					$R.css("cursor", "default"); // n-resize, s-resize, etc
+				// if pane also has a toggler button, adjust that too
+				if ($T) {
+					$T
+						.removeClass( tClass+_closed +" "+ tClass+_pane+_closed )
+						.addClass( tClass+_open +" "+ tClass+_pane+_open )
+						.attr("title", o.togglerTip_open) // may be blank
+					;
+				}
+				sizeHandles("all"); // resize resizer & toggler sizes for all panes
+			}
+
+			// resize content every time pane opens - to be sure
+			sizeContent(pane);
+
+			// sync any 'pin buttons'
+			syncPinBtns(pane, !s.isSliding);
+
+			// onopen callback
+			execUserCallback(pane, o.onopen_end || o.onopen);
+
+			// onshow callback
+			if (isShowing) execUserCallback(pane, o.onshow_end || o.onshow);
+
+			// internal flow-control callback
+			execFlowCallback(pane);
+		}
+	};
+	
+
+	/**
+	 * lockPaneForFX
+	 *
+	 * Must set left/top on East/South panes so animation will work properly
+	 *
+	 * @param String  pane  The pane to lock, 'east' or 'south' - any other is ignored!
+	 * @param Boolean  doLock  true = set left/top, false = remove
+	 */
+	var lockPaneForFX = function (pane, doLock) {
+		var $P = $Ps[pane];
+		if (doLock) {
+			$P.css({ zIndex: c.zIndex.animation }); // overlay all elements during animation
+			if (pane=="south")
+				$P.css({ top: cDims.top + cDims.innerHeight - $P.outerHeight() });
+			else if (pane=="east")
+				$P.css({ left: cDims.left + cDims.innerWidth - $P.outerWidth() });
+		}
+		else {
+			if (!state[pane].isSliding) $P.css({ zIndex: c.zIndex.pane_normal });
+			if (pane=="south")
+				$P.css({ top: "auto" });
+			else if (pane=="east")
+				$P.css({ left: "auto" });
+		}
+	};
+
+
+	/**
+	 * bindStartSlidingEvent
+	 *
+	 * Toggle sliding functionality of a specific pane on/off by adding removing 'slide open' trigger
+	 *
+	 * @callers  open(), close()
+	 * @param String  pane  The pane to enable/disable, 'north', 'south', etc.
+	 * @param Boolean  enable  Enable or Disable sliding?
+	 */
+	var bindStartSlidingEvent = function (pane, enable) {
+		var 
+			o		= options[pane]
+		,	$R		= $Rs[pane]
+		,	trigger	= o.slideTrigger_open
+		;
+		if (!$R || !o.slidable) return;
+		// make sure we have a valid event
+		if (trigger != "click" && trigger != "dblclick" && trigger != "mouseover") trigger = "click";
+		$R
+			// add or remove trigger event
+			[enable ? "bind" : "unbind"](trigger, slideOpen)
+			// set the appropriate cursor & title/tip
+			.css("cursor", (enable ? o.sliderCursor: "default"))
+			.attr("title", (enable ? o.sliderTip : ""))
+		;
+	};
+
+	/**
+	 * bindStopSlidingEvents
+	 *
+	 * Add or remove 'mouseout' events to 'slide close' when pane is 'sliding' open or closed
+	 * Also increases zIndex when pane is sliding open
+	 * See bindStartSlidingEvent for code to control 'slide open'
+	 *
+	 * @callers  slideOpen(), slideClosed()
+	 * @param String  pane  The pane to process, 'north', 'south', etc.
+	 * @param Boolean  isOpen  Is pane open or closed?
+	 */
+	var bindStopSlidingEvents = function (pane, enable) {
+		var 
+			o		= options[pane]
+		,	s		= state[pane]
+		,	trigger	= o.slideTrigger_close
+		,	action	= (enable ? "bind" : "unbind") // can't make 'unbind' work! - see disabled code below
+		,	$P		= $Ps[pane]
+		,	$R		= $Rs[pane]
+		;
+
+		s.isSliding = enable; // logic
+		clearTimer(pane, "closeSlider"); // just in case
+
+		// raise z-index when sliding
+		$P.css({ zIndex: (enable ? c.zIndex.sliding : c.zIndex.pane_normal) });
+		$R.css({ zIndex: (enable ? c.zIndex.sliding : c.zIndex.resizer_normal) });
+
+		// make sure we have a valid event
+		if (trigger != "click" && trigger != "mouseout") trigger = "mouseout";
+
+		// when trigger is 'mouseout', must cancel timer when mouse moves between 'pane' and 'resizer'
+		if (enable) { // BIND trigger events
+			$P.bind(trigger, slideClosed );
+			$R.bind(trigger, slideClosed );
+			if (trigger = "mouseout") {
+				$P.bind("mouseover", cancelMouseOut );
+				$R.bind("mouseover", cancelMouseOut );
+			}
+		}
+		else { // UNBIND trigger events
+			// TODO: why does unbind of a 'single function' not work reliably?
+			//$P[action](trigger, slideClosed );
+			$P.unbind(trigger);
+			$R.unbind(trigger);
+			if (trigger = "mouseout") {
+				//$P[action]("mouseover", cancelMouseOut );
+				$P.unbind("mouseover");
+				$R.unbind("mouseover");
+				clearTimer(pane, "closeSlider");
+			}
+		}
+
+		// SUBROUTINE for mouseout timer clearing
+		function cancelMouseOut (evt) {
+			clearTimer(pane, "closeSlider");
+			evt.stopPropagation();
+		}
+	};
+
+	var slideOpen = function () {
+		var pane = $(this).attr("resizer"); // attr added by initHandles
+		if (state[pane].isClosed) { // skip if already open!
+			bindStopSlidingEvents(pane, true); // pane is opening, so BIND trigger events to close it
+			open(pane, true); // true = slide - ie, called from here!
+		}
+	};
+
+	var slideClosed = function () {
+		var
+			$E = $(this)
+		,	pane = $E.attr("pane") || $E.attr("resizer")
+		,	o = options[pane]
+		,	s = state[pane]
+		;
+		if (s.isClosed || s.isResizing)
+			return; // skip if already closed OR in process of resizing
+		else if (o.slideTrigger_close == "click")
+			close_NOW(); // close immediately onClick
+		else // trigger = mouseout - use a delay
+			setTimer(pane, "closeSlider", close_NOW, 300); // .3 sec delay
+
+		// SUBROUTINE for timed close
+		function close_NOW () {
+			bindStopSlidingEvents(pane, false); // pane is being closed, so UNBIND trigger events
+			if (!s.isClosed) close(pane); // skip if already closed!
+		}
+	};
+
+
+	/**
+	 * sizePane
+	 *
+	 * @callers  initResizable.stop()
+	 * @param String  pane   The pane being resized - usually west or east, but potentially north or south
+	 * @param Integer  newSize  The new size for this pane - will be validated
+	 */
+	var sizePane = function (pane, size) {
+		// TODO: accept "auto" as size, and size-to-fit pane content
+		var 
+			edge	= c[pane].edge
+		,	dir		= c[pane].dir
+		,	o		= options[pane]
+		,	s		= state[pane]
+		,	$P		= $Ps[pane]
+		,	$R		= $Rs[pane]
+		;
+		// calculate 'current' min/max sizes
+		setPaneMinMaxSizes(pane); // update pane-state
+		// compare/update calculated min/max to user-options
+		s.minSize = max(s.minSize, o.minSize);
+		if (o.maxSize > 0) s.maxSize = min(s.maxSize, o.maxSize);
+		// validate passed size
+		size = max(size, s.minSize);
+		size = min(size, s.maxSize);
+		s.size = size; // update state
+
+		// move the resizer bar and resize the pane
+		$R.css( edge, size + cDims[edge] );
+		$P.css( c[pane].sizeType, max(1, cssSize(pane, size)) );
+
+		// resize all the adjacent panes, and adjust their toggler buttons
+		if (!s.isSliding) sizeMidPanes(dir=="horz" ? "all" : "center");
+		sizeHandles();
+		sizeContent(pane);
+		execUserCallback(pane, o.onresize_end || o.onresize);
+	};
+
+	/**
+	 * sizeMidPanes
+	 *
+	 * @callers  create(), open(), close(), onWindowResize()
+	 */
+	var sizeMidPanes = function (panes, overrideDims, onInit) {
+		if (!panes || panes == "all") panes = "east,west,center";
+
+		var d = getPaneDims();
+		if (overrideDims) $.extend( d, overrideDims );
+
+		$.each(panes.split(","), function() {
+			if (!$Ps[this]) return; // NO PANE - skip
+			var 
+				pane	= str(this)
+			,	o		= options[pane]
+			,	s		= state[pane]
+			,	$P		= $Ps[pane]
+			,	$R		= $Rs[pane]
+			,	hasRoom	= true
+			,	CSS		= {}
+			;
+
+			if (pane == "center") {
+				d = getPaneDims(); // REFRESH Dims because may have just 'unhidden' East or West pane after a 'resize'
+				CSS = $.extend( {}, d ); // COPY ALL of the paneDims
+				CSS.width  = max(1, cssW(pane, CSS.width));
+				CSS.height = max(1, cssH(pane, CSS.height));
+				hasRoom = (CSS.width > 1 && CSS.height > 1);
+				/*
+				 * Extra CSS for IE6 or IE7 in Quirks-mode - add 'width' to NORTH/SOUTH panes
+				 * Normally these panes have only 'left' & 'right' positions so pane auto-sizes
+				 */
+				if ($.browser.msie && (!$.boxModel || $.browser.version < 7)) {
+					if ($Ps.north) $Ps.north.css({ width: cssW($Ps.north, cDims.innerWidth) });
+					if ($Ps.south) $Ps.south.css({ width: cssW($Ps.south, cDims.innerWidth) });
+				}
+			}
+			else { // for east and west, set only the height
+				CSS.top = d.top;
+				CSS.bottom = d.bottom;
+				CSS.height = max(1, cssH(pane, d.height));
+				hasRoom = (CSS.height > 1);
+			}
+
+			if (hasRoom) {
+				$P.css(CSS);
+				if (s.noRoom) {
+					s.noRoom = false;
+					if (s.isHidden) return;
+					else show(pane, !s.isClosed);
+					/* OLD CODE - keep until sure line above works right!
+					if (!s.isClosed) $P.show(); // in case was previously hidden due to NOT hasRoom
+					if ($R) $R.show();
+					*/
+				}
+				if (!onInit) {
+					sizeContent(pane);
+					execUserCallback(pane, o.onresize_end || o.onresize);
+				}
+			}
+			else if (!s.noRoom) { // no room for pane, so just hide it (if not already)
+				s.noRoom = true; // update state
+				if (s.isHidden) return;
+				if (onInit) { // skip onhide callback and other logic onLoad
+					$P.hide();
+					if ($R) $R.hide();
+				}
+				else hide(pane);
+			}
+		});
+	};
+
+
+	var sizeContent = function (panes) {
+		if (!panes || panes == "all") panes = c.allPanes;
+
+		$.each(panes.split(","), function() {
+			if (!$Cs[this]) return; // NO CONTENT - skip
+			var 
+				pane	= str(this)
+			,	ignore	= options[pane].contentIgnoreSelector
+			,	$P		= $Ps[pane]
+			,	$C		= $Cs[pane]
+			,	e_C		= $C[0]		// DOM element
+			,	height	= cssH($P);	// init to pane.innerHeight
+			;
+			$P.children().each(function() {
+				if (this == e_C) return; // Content elem - skip
+				var $E = $(this);
+				if (!ignore || !$E.is(ignore))
+					height -= $E.outerHeight();
+			});
+			if (height > 0)
+				height = cssH($C, height);
+			if (height < 1)
+				$C.hide(); // no room for content!
+			else
+				$C.css({ height: height }).show();
+		});
+	};
+
+
+	/**
+	 * sizeHandles
+	 *
+	 * Called every time a pane is opened, closed, or resized to slide the togglers to 'center' and adjust their length if necessary
+	 *
+	 * @callers  initHandles(), open(), close(), resizeAll()
+	 */
+	var sizeHandles = function (panes, onInit) {
+		if (!panes || panes == "all") panes = c.borderPanes;
+
+		$.each(panes.split(","), function() {
+			var 
+				pane	= str(this)
+			,	o		= options[pane]
+			,	s		= state[pane]
+			,	$P		= $Ps[pane]
+			,	$R		= $Rs[pane]
+			,	$T		= $Ts[pane]
+			;
+			if (!$P || !$R || (!o.resizable && !o.closable)) return; // skip
+
+			var 
+				dir			= c[pane].dir
+			,	_state		= (s.isClosed ? "_closed" : "_open")
+			,	spacing		= o["spacing"+ _state]
+			,	togAlign	= o["togglerAlign"+ _state]
+			,	togLen		= o["togglerLength"+ _state]
+			,	paneLen
+			,	offset
+			,	CSS = {}
+			;
+			if (spacing == 0) {
+				$R.hide();
+				return;
+			}
+			else if (!s.noRoom && !s.isHidden) // skip if resizer was hidden for any reason
+				$R.show(); // in case was previously hidden
+
+			// Resizer Bar is ALWAYS same width/height of pane it is attached to
+			if (dir == "horz") { // north/south
+				paneLen = $P.outerWidth();
+				$R.css({
+					width:	max(1, cssW($R, paneLen)) // account for borders & padding
+				,	height:	max(1, cssH($R, spacing)) // ditto
+				,	left:	cssNum($P, "left")
+				});
+			}
+			else { // east/west
+				paneLen = $P.outerHeight();
+				$R.css({
+					height:	max(1, cssH($R, paneLen)) // account for borders & padding
+				,	width:	max(1, cssW($R, spacing)) // ditto
+				,	top:	cDims.top + getPaneSize("north", true)
+				//,	top:	cssNum($Ps["center"], "top")
+				});
+				
+			}
+
+			if ($T) {
+				if (togLen == 0 || (s.isSliding && o.hideTogglerOnSlide)) {
+					$T.hide(); // always HIDE the toggler when 'sliding'
+					return;
+				}
+				else
+					$T.show(); // in case was previously hidden
+
+				if (!(togLen > 0) || togLen == "100%" || togLen > paneLen) {
+					togLen = paneLen;
+					offset = 0;
+				}
+				else { // calculate 'offset' based on options.PANE.togglerAlign_open/closed
+					if (typeof togAlign == "string") {
+						switch (togAlign) {
+							case "top":
+							case "left":	offset = 0;
+											break;
+							case "bottom":
+							case "right":	offset = paneLen - togLen;
+											break;
+							case "middle":
+							case "center":
+							default:		offset = Math.floor((paneLen - togLen) / 2); // 'default' catches typos
+						}
+					}
+					else { // togAlign = number
+						var x = parseInt(togAlign); //
+						if (togAlign >= 0) offset = x;
+						else offset = paneLen - togLen + x; // NOTE: x is negative!
+					}
+				}
+
+				var
+					$TC_o = (o.togglerContent_open   ? $T.children(".content-open") : false)
+				,	$TC_c = (o.togglerContent_closed ? $T.children(".content-closed")   : false)
+				,	$TC   = (s.isClosed ? $TC_c : $TC_o)
+				;
+				if ($TC_o) $TC_o.css("display", s.isClosed ? "none" : "block");
+				if ($TC_c) $TC_c.css("display", s.isClosed ? "block" : "none");
+
+				if (dir == "horz") { // north/south
+					var width = cssW($T, togLen);
+					$T.css({
+						width:	max(0, width)  // account for borders & padding
+					,	height:	max(1, cssH($T, spacing)) // ditto
+					,	left:	offset // TODO: VERIFY that toggler  positions correctly for ALL values
+					});
+					if ($TC) // CENTER the toggler content SPAN
+						$TC.css("marginLeft", Math.floor((width-$TC.outerWidth())/2)); // could be negative
+				}
+				else { // east/west
+					var height = cssH($T, togLen);
+					$T.css({
+						height:	max(0, height)  // account for borders & padding
+					,	width:	max(1, cssW($T, spacing)) // ditto
+					,	top:	offset // POSITION the toggler
+					});
+					if ($TC) // CENTER the toggler content SPAN
+						$TC.css("marginTop", Math.floor((height-$TC.outerHeight())/2)); // could be negative
+				}
+
+
+			}
+
+			// DONE measuring and sizing this resizer/toggler, so can be 'hidden' now
+			if (onInit && o.initHidden) {
+				$R.hide();
+				if ($T) $T.hide();
+			}
+		});
+	};
+
+
+	/**
+	 * resizeAll
+	 *
+	 * @callers  window.onresize(), callbacks or custom code
+	 */
+	var resizeAll = function () {
+		var
+			oldW	= cDims.innerWidth
+		,	oldH	= cDims.innerHeight
+		;
+		cDims = state.container = getElemDims($Container); // UPDATE container dimensions
+
+		var
+			checkH	= (cDims.innerHeight < oldH)
+		,	checkW	= (cDims.innerWidth < oldW)
+		,	s, dir
+		;
+
+		if (checkH || checkW)
+			// NOTE special order for sizing: S-N-E-W
+			$.each(["south","north","east","west"], function(i,pane) {
+				s = state[pane];
+				dir = c[pane].dir;
+				if (!s.isClosed && ((checkH && dir=="horz") || (checkW && dir=="vert"))) {
+					setPaneMinMaxSizes(pane); // update pane-state
+					// shrink pane if 'too big' to fit
+					if (s.size > s.maxSize)
+						sizePane(pane, s.maxSize);
+				}
+			});
+
+		sizeMidPanes("all");
+		sizeHandles("all"); // reposition the toggler elements
+	};
+
+
+	/**
+	 * keyDown
+	 *
+	 * Capture keys when enableCursorHotkey - toggle pane if hotkey pressed
+	 *
+	 * @callers  document.keydown()
+	 */
+	function keyDown (evt) {
+		if (!evt) return true;
+		var code = evt.keyCode;
+		if (code < 33) return true; // ignore special keys: ENTER, TAB, etc
+
+		var
+			PANE = {
+				38: "north" // Up Cursor
+			,	40: "south" // Down Cursor
+			,	37: "west"  // Left Cursor
+			,	39: "east"  // Right Cursor
+			}
+		,	isCursorKey = (code >= 37 && code <= 40)
+		,	ALT = evt.altKey // no worky!
+		,	SHIFT = evt.shiftKey
+		,	CTRL = evt.ctrlKey
+		,	pane = false
+		,	s, o, k, m, el
+		;
+
+		if (!CTRL && !SHIFT)
+			return true; // no modifier key - abort
+		else if (isCursorKey && options[PANE[code]].enableCursorHotkey) // valid cursor-hotkey
+			pane = PANE[code];
+		else // check to see if this matches a custom-hotkey
+			$.each(c.borderPanes.split(","), function(i,p) { // loop each pane to check its hotkey
+				o = options[p];
+				k = o.customHotkey;
+				m = o.customHotkeyModifier; // if missing or invalid, treated as "CTRL+SHIFT"
+				if ((SHIFT && m=="SHIFT") || (CTRL && m=="CTRL") || (CTRL && SHIFT)) { // Modifier matches
+					if (k && code == (isNaN(k) || k <= 9 ? k.toUpperCase().charCodeAt(0) : k)) { // Key matches
+						pane = p;
+						return false; // BREAK
+					}
+				}
+			});
+
+		if (!pane) return true; // no hotkey - abort
+
+		// validate pane
+		o = options[pane]; // get pane options
+		s = state[pane]; // get pane options
+		if (!o.enableCursorHotkey || s.isHidden || !$Ps[pane]) return true;
+
+		// see if user is in a 'form field' because may be 'selecting text'!
+		el = evt.target || evt.srcElement;
+		if (el && SHIFT && isCursorKey && (el.tagName=="TEXTAREA" || (el.tagName=="INPUT" && (code==37 || code==39))))
+			return true; // allow text-selection
+
+		// SYNTAX NOTES
+		// use "returnValue=false" to abort keystroke but NOT abort function - can run another command afterwards
+		// use "return false" to abort keystroke AND abort function
+		toggle(pane);
+		evt.stopPropagation();
+		evt.returnValue = false; // CANCEL key
+		return false;
+	};
+
+
+/*
+ * ###########################
+ *     UTILITY METHODS
+ *   called externally only
+ * ###########################
+ */
+
+	function allowOverflow (elem) {
+		if (this && this.tagName) elem = this; // BOUND to element
+		var $P;
+		if (typeof elem=="string")
+			$P = $Ps[elem];
+		else {
+			if ($(elem).attr("pane")) $P = $(elem);
+			else $P = $(elem).parents("div[pane]:first");
+		}
+		if (!$P.length) return; // INVALID
+
+		var
+			pane	= $P.attr("pane")
+		,	s		= state[pane]
+		;
+
+		// if pane is already raised, then reset it before doing it again!
+		// this would happen if allowOverflow is attached to BOTH the pane and an element 
+		if (s.cssSaved)
+			resetOverflow(pane); // reset previous CSS before continuing
+
+		// if pane is raised by sliding or resizing, or it's closed, then abort
+		if (s.isSliding || s.isResizing || s.isClosed) {
+			s.cssSaved = false;
+			return;
+		}
+
+		var
+			newCSS	= { zIndex: (c.zIndex.pane_normal + 1) }
+		,	curCSS	= {}
+		,	of		= $P.css("overflow")
+		,	ofX		= $P.css("overflowX")
+		,	ofY		= $P.css("overflowY")
+		;
+		// determine which, if any, overflow settings need to be changed
+		if (of != "visible") {
+			curCSS.overflow = of;
+			newCSS.overflow = "visible";
+		}
+		if (ofX && ofX != "visible" && ofX != "auto") {
+			curCSS.overflowX = ofX;
+			newCSS.overflowX = "visible";
+		}
+		if (ofY && ofY != "visible" && ofY != "auto") {
+			curCSS.overflowY = ofX;
+			newCSS.overflowY = "visible";
+		}
+
+		// save the current overflow settings - even if blank!
+		s.cssSaved = curCSS;
+
+		// apply new CSS to raise zIndex and, if necessary, make overflow 'visible'
+		$P.css( newCSS );
+
+		// make sure the zIndex of all other panes is normal
+		$.each(c.allPanes.split(","), function(i, p) {
+			if (p != pane) resetOverflow(p);
+		});
+
+	};
+
+	function resetOverflow (elem) {
+		if (this && this.tagName) elem = this; // BOUND to element
+		var $P;
+		if (typeof elem=="string")
+			$P = $Ps[elem];
+		else {
+			if ($(elem).hasClass("ui-layout-pane")) $P = $(elem);
+			else $P = $(elem).parents("div[pane]:first");
+		}
+		if (!$P.length) return; // INVALID
+
+		var
+			pane	= $P.attr("pane")
+		,	s		= state[pane]
+		,	CSS		= s.cssSaved || {}
+		;
+		// reset the zIndex
+		if (!s.isSliding && !s.isResizing)
+			$P.css("zIndex", c.zIndex.pane_normal);
+
+		// reset Overflow - if necessary
+		$P.css( CSS );
+
+		// clear var
+		s.cssSaved = false;
+	};
+
+
+	/**
+	* getBtn
+	*
+	* Helper function to validate params received by addButton utilities
+	*
+	* @param String   selector 	jQuery selector for button, eg: ".ui-layout-north .toggle-button"
+	* @param String   pane 		Name of the pane the button is for: 'north', 'south', etc.
+	* @returns  If both params valid, the element matching 'selector' in a jQuery wrapper - otherwise 'false'
+	*/
+	function getBtn(selector, pane, action) {
+		var
+			$E = $(selector)
+		,	err = "Error Adding Button \n\nInvalid "
+		;
+		if (!$E.length) // element not found
+			alert(err+"selector: "+ selector);
+		else if (c.borderPanes.indexOf(pane) == -1) // invalid 'pane' sepecified
+			alert(err+"pane: "+ pane);
+		else { // VALID
+			var btn = options[pane].buttonClass +"-"+ action;
+			$E.addClass( btn +" "+ btn +"-"+ pane );
+			return $E;
+		}
+		return false;  // INVALID
+	};
+
+
+	/**
+	* addToggleBtn
+	*
+	* Add a custom Toggler button for a pane
+	*
+	* @param String   selector 	jQuery selector for button, eg: ".ui-layout-north .toggle-button"
+	* @param String   pane 		Name of the pane the button is for: 'north', 'south', etc.
+	*/
+	function addToggleBtn (selector, pane) {
+		var $E = getBtn(selector, pane, "toggle");
+		if ($E)
+			$E
+				.attr("title", state[pane].isClosed ? "Open" : "Close")
+				.click(function (evt) {
+					toggle(pane);
+					evt.stopPropagation();
+				})
+			;
+	};
+
+	/**
+	* addOpenBtn
+	*
+	* Add a custom Open button for a pane
+	*
+	* @param String   selector 	jQuery selector for button, eg: ".ui-layout-north .open-button"
+	* @param String   pane 		Name of the pane the button is for: 'north', 'south', etc.
+	*/
+	function addOpenBtn (selector, pane) {
+		var $E = getBtn(selector, pane, "open");
+		if ($E)
+			$E
+				.attr("title", "Open")
+				.click(function (evt) {
+					open(pane);
+					evt.stopPropagation();
+				})
+			;
+	};
+
+	/**
+	* addCloseBtn
+	*
+	* Add a custom Close button for a pane
+	*
+	* @param String   selector 	jQuery selector for button, eg: ".ui-layout-north .close-button"
+	* @param String   pane 		Name of the pane the button is for: 'north', 'south', etc.
+	*/
+	function addCloseBtn (selector, pane) {
+		var $E = getBtn(selector, pane, "close");
+		if ($E)
+			$E
+				.attr("title", "Close")
+				.click(function (evt) {
+					close(pane);
+					evt.stopPropagation();
+				})
+			;
+	};
+
+	/**
+	* addPinBtn
+	*
+	* Add a custom Pin button for a pane
+	*
+	* Four classes are added to the element, based on the paneClass for the associated pane...
+	* Assuming the default paneClass and the pin is 'up', these classes are added for a west-pane pin:
+	*  - ui-layout-pane-pin
+	*  - ui-layout-pane-west-pin
+	*  - ui-layout-pane-pin-up
+	*  - ui-layout-pane-west-pin-up
+	*
+	* @param String   selector 	jQuery selector for button, eg: ".ui-layout-north .ui-layout-pin"
+	* @param String   pane 		Name of the pane the pin is for: 'north', 'south', etc.
+	*/
+	function addPinBtn (selector, pane) {
+		var $E = getBtn(selector, pane, "pin");
+		if ($E) {
+			var s = state[pane];
+			$E.click(function (evt) {
+				setPinState($(this), pane, (s.isSliding || s.isClosed));
+				if (s.isSliding || s.isClosed) open( pane ); // change from sliding to open
+				else close( pane ); // slide-closed
+				evt.stopPropagation();
+			});
+			// add up/down pin attributes and classes
+			setPinState ($E, pane, (!s.isClosed && !s.isSliding));
+			// add this pin to the pane data so we can 'sync it' automatically
+			// PANE.pins key is an array so we can store multiple pins for each pane
+			c[pane].pins.push( selector ); // just save the selector string
+		}
+	};
+
+	/**
+	* syncPinBtns
+	*
+	* INTERNAL function to sync 'pin buttons' when pane is opened or closed
+	* Unpinned means the pane is 'sliding' - ie, over-top of the adjacent panes
+	*
+	* @callers  open(), close()
+	* @params  pane   These are the params returned to callbacks by layout()
+	* @params  doPin  True means set the pin 'down', False means 'up'
+	*/
+	function syncPinBtns (pane, doPin) {
+		$.each(c[pane].pins, function (i, selector) {
+			setPinState($(selector), pane, doPin);
+		});
+	};
+
+	/**
+	* setPinState
+	*
+	* Change the class of the pin button to make it look 'up' or 'down'
+	*
+	* @callers  addPinBtn(), syncPinBtns()
+	* @param Element  $Pin		The pin-span element in a jQuery wrapper
+	* @param Boolean  doPin		True = set the pin 'down', False = set it 'up'
+	* @param String   pinClass	The root classname for pins - will add '-up' or '-down' suffix
+	*/
+	function setPinState ($Pin, pane, doPin) {
+		var updown = $Pin.attr("pin");
+		if (updown && doPin == (updown=="down")) return; // already in correct state
+		var
+			root	= options[pane].buttonClass
+		,	class1	= root +"-pin"
+		,	class2	= class1 +"-"+ pane
+		,	UP1		= class1 + "-up"
+		,	UP2		= class2 + "-up"
+		,	DN1		= class1 + "-down"
+		,	DN2		= class2 + "-down"
+		;
+		$Pin
+			.attr("pin", doPin ? "down" : "up") // logic
+			.attr("title", doPin ? "Un-Pin" : "Pin")
+			.removeClass( doPin ? UP1 : DN1 ) 
+			.removeClass( doPin ? UP2 : DN2 ) 
+			.addClass( doPin ? DN1 : UP1 ) 
+			.addClass( doPin ? DN2 : UP2 ) 
+		;
+	};
+
+
+/*
+ * ###########################
+ * CREATE/RETURN BORDER-LAYOUT
+ * ###########################
+ */
+
+	// init global vars
+	var 
+		$Container = $(this).css({ overflow: "hidden" }) // Container elem
+	,	$Ps		= {} // Panes x4	- set in initPanes()
+	,	$Cs		= {} // Content x4	- set in initPanes()
+	,	$Rs		= {} // Resizers x4	- set in initHandles()
+	,	$Ts		= {} // Togglers x4	- set in initHandles()
+	//	object aliases
+	,	c		= config // alias for config hash
+	,	cDims	= state.container // alias for easy access to 'container dimensions'
+	;
+
+	// create the border layout NOW
+	create();
+
+	// return object pointers to expose data & option Properties, and primary action Methods
+	return {
+		options:		options			// property - options hash
+	,	state:			state			// property - dimensions hash
+	,	panes:			$Ps				// property - object pointers for ALL panes: panes.north, panes.center
+	,	toggle:			toggle			// method - pass a 'pane' ("north", "west", etc)
+	,	open:			open			// method - ditto
+	,	close:			close			// method - ditto
+	,	hide:			hide			// method - ditto
+	,	show:			show			// method - ditto
+	,	resizeContent:	sizeContent		// method - ditto
+	,	sizePane:		sizePane		// method - pass a 'pane' AND a 'size' in pixels
+	,	resizeAll:		resizeAll		// method - no parameters
+	,	addToggleBtn:	addToggleBtn	// utility - pass element selector and 'pane'
+	,	addOpenBtn:		addOpenBtn		// utility - ditto
+	,	addCloseBtn:	addCloseBtn		// utility - ditto
+	,	addPinBtn:		addPinBtn		// utility - ditto
+	,	allowOverflow:	allowOverflow	// utility - pass calling element
+	,	resetOverflow:	resetOverflow	// utility - ditto
+	,	cssWidth:		cssW
+	,	cssHeight:		cssH
+	};
+
+}
+})( jQuery );
+ static/layout/jquery.layout.min.js view
@@ -0,0 +1,80 @@+/*
+ * jquery.layout 1.2.0
+ *
+ * Copyright (c) 2008 
+ *   Fabrizio Balliano (http://www.fabrizioballiano.net)
+ *   Kevin Dalman (http://allpro.net)
+ *
+ * Dual licensed under the GPL (http://www.gnu.org/licenses/gpl.html)
+ * and MIT (http://www.opensource.org/licenses/mit-license.php) licenses.
+ *
+ * $Date: 2008-12-27 02:17:22 +0100 (sab, 27 dic 2008) $
+ * $Rev: 203 $
+ * 
+ * NOTE: For best code readability, view this with a fixed-space font and tabs equal to 4-chars
+ */+(function($){$.fn.layout=function(opts){var+prefix="ui-layout-",defaults={paneClass:prefix+"pane",resizerClass:prefix+"resizer",togglerClass:prefix+"toggler",togglerInnerClass:prefix+"",buttonClass:prefix+"button",contentSelector:"."+prefix+"content",contentIgnoreSelector:"."+prefix+"ignore"};var options={name:"",scrollToBookmarkOnLoad:true,defaults:{applyDefaultStyles:false,closable:true,resizable:true,slidable:true,contentSelector:defaults.contentSelector,contentIgnoreSelector:defaults.contentIgnoreSelector,paneClass:defaults.paneClass,resizerClass:defaults.resizerClass,togglerClass:defaults.togglerClass,buttonClass:defaults.buttonClass,resizerDragOpacity:1,maskIframesOnResize:true,minSize:0,maxSize:0,spacing_open:6,spacing_closed:6,togglerLength_open:50,togglerLength_closed:50,togglerAlign_open:"center",togglerAlign_closed:"center",togglerTip_open:"Close",togglerTip_closed:"Open",resizerTip:"Resize",sliderTip:"Slide Open",sliderCursor:"pointer",slideTrigger_open:"click",slideTrigger_close:"mouseout",hideTogglerOnSlide:false,togglerContent_open:"",togglerContent_closed:"",showOverflowOnHover:false,enableCursorHotkey:true,customHotkeyModifier:"SHIFT",fxName:"slide",fxSpeed:null,fxSettings:{},initClosed:false,initHidden:false},north:{paneSelector:"."+prefix+"north",size:"auto",resizerCursor:"n-resize"},south:{paneSelector:"."+prefix+"south",size:"auto",resizerCursor:"s-resize"},east:{paneSelector:"."+prefix+"east",size:200,resizerCursor:"e-resize"},west:{paneSelector:"."+prefix+"west",size:200,resizerCursor:"w-resize"},center:{paneSelector:"."+prefix+"center"}};var effects={slide:{all:{duration:"fast"},north:{direction:"up"},south:{direction:"down"},east:{direction:"right"},west:{direction:"left"}},drop:{all:{duration:"slow"},north:{direction:"up"},south:{direction:"down"},east:{direction:"right"},west:{direction:"left"}},scale:{all:{duration:"fast"}}};var config={allPanes:"north,south,east,west,center",borderPanes:"north,south,east,west",zIndex:{resizer_normal:1,pane_normal:2,mask:4,sliding:100,resizing:10000,animation:10000},resizers:{cssReq:{position:"absolute",padding:0,margin:0,fontSize:"1px",textAlign:"left",overflow:"hidden",zIndex:1},cssDef:{background:"#DDD",border:"none"}},togglers:{cssReq:{position:"absolute",display:"block",padding:0,margin:0,overflow:"hidden",textAlign:"center",fontSize:"1px",cursor:"pointer",zIndex:1},cssDef:{background:"#AAA"}},content:{cssReq:{overflow:"auto"},cssDef:{}},defaults:{cssReq:{position:"absolute",margin:0,zIndex:2},cssDef:{padding:"10px",background:"#FFF",border:"1px solid #BBB",overflow:"auto"}},north:{edge:"top",sizeType:"height",dir:"horz",cssReq:{top:0,bottom:"auto",left:0,right:0,width:"auto"}},south:{edge:"bottom",sizeType:"height",dir:"horz",cssReq:{top:"auto",bottom:0,left:0,right:0,width:"auto"}},east:{edge:"right",sizeType:"width",dir:"vert",cssReq:{left:"auto",right:0,top:"auto",bottom:"auto",height:"auto"}},west:{edge:"left",sizeType:"width",dir:"vert",cssReq:{left:0,right:"auto",top:"auto",bottom:"auto",height:"auto"}},center:{dir:"center",cssReq:{left:"auto",right:"auto",top:"auto",bottom:"auto",height:"auto",width:"auto"}}};var state={id:Math.floor(Math.random()*10000),container:{},north:{},south:{},east:{},west:{},center:{}};var+altEdge={top:"bottom",bottom:"top",left:"right",right:"left"},altSide={north:"south",south:"north",east:"west",west:"east"};var isStr=function(o){if(typeof o=="string")return true;else if(typeof o=="object"){try{var match=o.constructor.toString().match(/string/i);return(match!==null);}catch(e){}}return false;};var str=function(o){if(typeof o=="string"||isStr(o))return $.trim(o);else return o;};var min=function(x,y){return Math.min(x,y);};var max=function(x,y){return Math.max(x,y);};var transformData=function(d){var json={defaults:{fxSettings:{}},north:{fxSettings:{}},south:{fxSettings:{}},east:{fxSettings:{}},west:{fxSettings:{}},center:{fxSettings:{}}};d=d||{};if(d.effects||d.defaults||d.north||d.south||d.west||d.east||d.center)json=$.extend(json,d);else+$.each(d,function(key,val){a=key.split("__");json[a[1]?a[0]:"defaults"][a[1]?a[1]:a[0]]=val;});return json;};var setFlowCallback=function(action,pane,param){var+cb=action+","+pane+","+(param?1:0),cP,cbPane;$.each(c.borderPanes.split(","),function(i,p){if(c[p].isMoving){bindCallback(p);return false;}});function bindCallback(p,test){cP=c[p];if(!cP.doCallback){cP.doCallback=true;cP.callback=cb;}else{cpPane=cP.callback.split(",")[1];if(cpPane!=p&&cpPane!=pane)bindCallback(cpPane,true);}}};var execFlowCallback=function(pane){var cP=c[pane];c.isLayoutBusy=false;delete cP.isMoving;if(!cP.doCallback||!cP.callback)return;cP.doCallback=false;var+cb=cP.callback.split(","),param=(cb[2]>0?true:false);if(cb[0]=="open")open(cb[1],param);else if(cb[0]=="close")close(cb[1],param);if(!cP.doCallback)cP.callback=null;};var execUserCallback=function(pane,v_fn){if(!v_fn)return;var fn;try{if(typeof v_fn=="function")fn=v_fn;else if(typeof v_fn!="string")return;else if(v_fn.indexOf(",")>0){var+args=v_fn.split(","),fn=eval(args[0]);if(typeof fn=="function"&&args.length>1)return fn(args[1]);}else+fn=eval(v_fn);if(typeof fn=="function")return fn(pane,$Ps[pane],$.extend({},state[pane]),$.extend({},options[pane]),options.name);}catch(ex){}};var cssNum=function($E,prop){var+val=0,hidden=false,visibility="";if(!$.browser.msie){if($.curCSS($E[0],"display",true)=="none"){hidden=true;visibility=$.curCSS($E[0],"visibility",true);$E.css({display:"block",visibility:"hidden"});}}val=parseInt($.curCSS($E[0],prop,true),10)||0;if(hidden){$E.css({display:"none"});if(visibility&&visibility!="hidden")$E.css({visibility:visibility});}return val;};var cssW=function(e,outerWidth){var $E;if(isStr(e)){e=str(e);$E=$Ps[e];}else+$E=$(e);if(outerWidth<=0)return 0;else if(!(outerWidth>0))outerWidth=isStr(e)?getPaneSize(e):$E.outerWidth();if(!$.boxModel)return outerWidth;else+return outerWidth+-cssNum($E,"paddingLeft")-cssNum($E,"paddingRight")-($.curCSS($E[0],"borderLeftStyle",true)=="none"?0:cssNum($E,"borderLeftWidth"))-($.curCSS($E[0],"borderRightStyle",true)=="none"?0:cssNum($E,"borderRightWidth"));};var cssH=function(e,outerHeight){var $E;if(isStr(e)){e=str(e);$E=$Ps[e];}else+$E=$(e);if(outerHeight<=0)return 0;else if(!(outerHeight>0))outerHeight=(isStr(e))?getPaneSize(e):$E.outerHeight();if(!$.boxModel)return outerHeight;else+return outerHeight+-cssNum($E,"paddingTop")-cssNum($E,"paddingBottom")-($.curCSS($E[0],"borderTopStyle",true)=="none"?0:cssNum($E,"borderTopWidth"))-($.curCSS($E[0],"borderBottomStyle",true)=="none"?0:cssNum($E,"borderBottomWidth"));};var cssSize=function(pane,outerSize){if(c[pane].dir=="horz")return cssH(pane,outerSize);else+return cssW(pane,outerSize);};var getPaneSize=function(pane,inclSpace){var+$P=$Ps[pane],o=options[pane],s=state[pane],oSp=(inclSpace?o.spacing_open:0),cSp=(inclSpace?o.spacing_closed:0);if(!$P||s.isHidden)return 0;else if(s.isClosed||(s.isSliding&&inclSpace))return cSp;else if(c[pane].dir=="horz")return $P.outerHeight()+oSp;else+return $P.outerWidth()+oSp;};var setPaneMinMaxSizes=function(pane){var+d=cDims,edge=c[pane].edge,dir=c[pane].dir,o=options[pane],s=state[pane],$P=$Ps[pane],$altPane=$Ps[altSide[pane]],paneSpacing=o.spacing_open,altPaneSpacing=options[altSide[pane]].spacing_open,altPaneSize=(!$altPane?0:(dir=="horz"?$altPane.outerHeight():$altPane.outerWidth())),containerSize=(dir=="horz"?d.innerHeight:d.innerWidth),limitSize=containerSize-paneSpacing-altPaneSize-altPaneSpacing,minSize=s.minSize||0,maxSize=Math.min(s.maxSize||9999,limitSize),minPos,maxPos;switch(pane){case"north":minPos=d.offsetTop+minSize;maxPos=d.offsetTop+maxSize;break;case"west":minPos=d.offsetLeft+minSize;maxPos=d.offsetLeft+maxSize;break;case"south":minPos=d.offsetTop+d.innerHeight-maxSize;maxPos=d.offsetTop+d.innerHeight-minSize;break;case"east":minPos=d.offsetLeft+d.innerWidth-maxSize;maxPos=d.offsetLeft+d.innerWidth-minSize;break;}$.extend(s,{minSize:minSize,maxSize:maxSize,minPosition:minPos,maxPosition:maxPos});};var getPaneDims=function(){var d={top:getPaneSize("north",true),bottom:getPaneSize("south",true),left:getPaneSize("west",true),right:getPaneSize("east",true),width:0,height:0};with(d){width=cDims.innerWidth-left-right;height=cDims.innerHeight-bottom-top;top+=cDims.top;bottom+=cDims.bottom;left+=cDims.left;right+=cDims.right;}return d;};var getElemDims=function($E){var+d={},e,b,p;$.each("Left,Right,Top,Bottom".split(","),function(){e=str(this);b=d["border"+e]=cssNum($E,"border"+e+"Width");p=d["padding"+e]=cssNum($E,"padding"+e);d["offset"+e]=b+p;if($E==$Container)d[e.toLowerCase()]=($.boxModel?p:0);});d.innerWidth=d.outerWidth=$E.outerWidth();d.innerHeight=d.outerHeight=$E.outerHeight();if($.boxModel){d.innerWidth-=(d.offsetLeft+d.offsetRight);d.innerHeight-=(d.offsetTop+d.offsetBottom);}return d;};var setTimer=function(pane,action,fn,ms){var+Layout=window.layout=window.layout||{},Timers=Layout.timers=Layout.timers||{},name="layout_"+state.id+"_"+pane+"_"+action;if(Timers[name])return;else Timers[name]=setTimeout(fn,ms);};var clearTimer=function(pane,action){var+Layout=window.layout=window.layout||{},Timers=Layout.timers=Layout.timers||{},name="layout_"+state.id+"_"+pane+"_"+action;if(Timers[name]){clearTimeout(Timers[name]);delete Timers[name];return true;}else+return false;};var create=function(){initOptions();initContainer();initPanes();initHandles();initResizable();sizeContent("all");if(options.scrollToBookmarkOnLoad)with(self.location)if(hash)replace(hash);initHotkeys();$(window).resize(function(){var timerID="timerLayout_"+state.id;if(window[timerID])clearTimeout(window[timerID]);window[timerID]=null;if(true||$.browser.msie)window[timerID]=setTimeout(resizeAll,100);else+resizeAll();});};var initContainer=function(){try{if($Container[0].tagName=="BODY"){$("html").css({height:"100%",overflow:"hidden"});$("body").css({position:"relative",height:"100%",overflow:"hidden",margin:0,padding:0,border:"none"});}else{var+CSS={overflow:"hidden"},p=$Container.css("position"),h=$Container.css("height");if(!$Container.hasClass("ui-layout-pane")){if(!p||"fixed,absolute,relative".indexOf(p)<0)CSS.position="relative";if(!h||h=="auto")CSS.height="100%";}$Container.css(CSS);}}catch(ex){}cDims=state.container=getElemDims($Container);};var initHotkeys=function(){$.each(c.borderPanes.split(","),function(i,pane){var o=options[pane];if(o.enableCursorHotkey||o.customHotkey){$(document).keydown(keyDown);return false;}});};var initOptions=function(){opts=transformData(opts);if(opts.effects){$.extend(effects,opts.effects);delete opts.effects;}$.each("name,scrollToBookmarkOnLoad".split(","),function(idx,key){if(opts[key]!==undefined)options[key]=opts[key];else if(opts.defaults[key]!==undefined){options[key]=opts.defaults[key];delete opts.defaults[key];}});$.each("paneSelector,resizerCursor,customHotkey".split(","),function(idx,key){delete opts.defaults[key];});$.extend(options.defaults,opts.defaults);c.center=$.extend(true,{},c.defaults,c.center);$.extend(options.center,opts.center);var o_Center=$.extend(true,{},options.defaults,opts.defaults,options.center);$.each("paneClass,contentSelector,contentIgnoreSelector,applyDefaultStyles,showOverflowOnHover".split(","),function(idx,key){options.center[key]=o_Center[key];});var defs=options.defaults;$.each(c.borderPanes.split(","),function(i,pane){c[pane]=$.extend(true,{},c.defaults,c[pane]);o=options[pane]=$.extend(true,{},options.defaults,options[pane],opts.defaults,opts[pane]);if(!o.paneClass)o.paneClass=defaults.paneClass;if(!o.resizerClass)o.resizerClass=defaults.resizerClass;if(!o.togglerClass)o.togglerClass=defaults.togglerClass;$.each(["_open","_close",""],function(i,n){var+sName="fxName"+n,sSpeed="fxSpeed"+n,sSettings="fxSettings"+n;o[sName]=opts[pane][sName]||opts[pane].fxName||opts.defaults[sName]||opts.defaults.fxName||o[sName]||o.fxName||defs[sName]||defs.fxName||"none";var fxName=o[sName];if(fxName=="none"||!$.effects||!$.effects[fxName]||(!effects[fxName]&&!o[sSettings]&&!o.fxSettings))fxName=o[sName]="none";var+fx=effects[fxName]||{},fx_all=fx.all||{},fx_pane=fx[pane]||{};o[sSettings]=$.extend({},fx_all,fx_pane,defs.fxSettings||{},defs[sSettings]||{},o.fxSettings,o[sSettings],opts.defaults.fxSettings,opts.defaults[sSettings]||{},opts[pane].fxSettings,opts[pane][sSettings]||{});o[sSpeed]=opts[pane][sSpeed]||opts[pane].fxSpeed||opts.defaults[sSpeed]||opts.defaults.fxSpeed||o[sSpeed]||o[sSettings].duration||o.fxSpeed||o.fxSettings.duration||defs.fxSpeed||defs.fxSettings.duration||fx_pane.duration||fx_all.duration||"normal";});});};var initPanes=function(){$.each(c.allPanes.split(","),function(){var+pane=str(this),o=options[pane],s=state[pane],fx=s.fx,dir=c[pane].dir,size=o.size=="auto"||isNaN(o.size)?0:o.size,minSize=o.minSize||1,maxSize=o.maxSize||9999,spacing=o.spacing_open||0,sel=o.paneSelector,isIE6=($.browser.msie&&$.browser.version<7),CSS={},$P,$C;$Cs[pane]=false;if(sel.substr(0,1)==="#")$P=$Ps[pane]=$Container.find(sel+":first");else{$P=$Ps[pane]=$Container.children(sel+":first");if(!$P.length)$P=$Ps[pane]=$Container.children("form:first").children(sel+":first");}if(!$P.length){$Ps[pane]=false;return true;}$P.attr("pane",pane).addClass(o.paneClass+" "+o.paneClass+"-"+pane);if(pane!="center"){s.isClosed=false;s.isSliding=false;s.isResizing=false;s.isHidden=false;s.noRoom=false;c[pane].pins=[];}CSS=$.extend({visibility:"visible",display:"block"},c.defaults.cssReq,c[pane].cssReq);if(o.applyDefaultStyles)$.extend(CSS,c.defaults.cssDef,c[pane].cssDef);$P.css(CSS);CSS={};switch(pane){case"north":CSS.top=cDims.top;CSS.left=cDims.left;CSS.right=cDims.right;break;case"south":CSS.bottom=cDims.bottom;CSS.left=cDims.left;CSS.right=cDims.right;break;case"west":CSS.left=cDims.left;break;case"east":CSS.right=cDims.right;break;case"center":}if(dir=="horz"){if(size===0||size=="auto"){$P.css({height:"auto"});size=$P.outerHeight();}size=max(size,minSize);size=min(size,maxSize);size=min(size,cDims.innerHeight-spacing);CSS.height=max(1,cssH(pane,size));s.size=size;s.maxSize=maxSize;s.minSize=max(minSize,size-CSS.height+1);$P.css(CSS);}else if(dir=="vert"){if(size===0||size=="auto"){$P.css({width:"auto",float:"left"});size=$P.outerWidth();$P.css({float:"none"});}size=max(size,minSize);size=min(size,maxSize);size=min(size,cDims.innerWidth-spacing);CSS.width=max(1,cssW(pane,size));s.size=size;s.maxSize=maxSize;s.minSize=max(minSize,size-CSS.width+1);$P.css(CSS);sizeMidPanes(pane,null,true);}else if(pane=="center"){$P.css(CSS);sizeMidPanes("center",null,true);}if(o.initClosed&&o.closable){$P.hide().addClass("closed");s.isClosed=true;}else if(o.initHidden||o.initClosed){hide(pane,true);s.isHidden=true;}else+$P.addClass("open");if(o.showOverflowOnHover)$P.hover(allowOverflow,resetOverflow);if(o.contentSelector){$C=$Cs[pane]=$P.children(o.contentSelector+":first");if(!$C.length){$Cs[pane]=false;return true;}$C.css(c.content.cssReq);if(o.applyDefaultStyles)$C.css(c.content.cssDef);$P.css({overflow:"hidden"});}});};var initHandles=function(){$.each(c.borderPanes.split(","),function(){var+pane=str(this),o=options[pane],s=state[pane],rClass=o.resizerClass,tClass=o.togglerClass,$P=$Ps[pane];$Rs[pane]=false;$Ts[pane]=false;if(!$P||(!o.closable&&!o.resizable))return;var+edge=c[pane].edge,isOpen=$P.is(":visible"),spacing=(isOpen?o.spacing_open:o.spacing_closed),_pane="-"+pane,_state=(isOpen?"-open":"-closed"),$R,$T;$R=$Rs[pane]=$("<span></span>");if(isOpen&&o.resizable);else if(!isOpen&&o.slidable)$R.attr("title",o.sliderTip).css("cursor",o.sliderCursor);$R.attr("id",(o.paneSelector.substr(0,1)=="#"?o.paneSelector.substr(1)+"-resizer":"")).attr("resizer",pane).css(c.resizers.cssReq).css(edge,cDims[edge]+getPaneSize(pane)).addClass(rClass+" "+rClass+_pane+" "+rClass+_state+" "+rClass+_pane+_state).appendTo($Container);if(o.applyDefaultStyles)$R.css(c.resizers.cssDef);if(o.closable){$T=$Ts[pane]=$("<div></div>");$T.attr("id",(o.paneSelector.substr(0,1)=="#"?o.paneSelector.substr(1)+"-toggler":"")).css(c.togglers.cssReq).attr("title",(isOpen?o.togglerTip_open:o.togglerTip_closed)).click(function(evt){toggle(pane);evt.stopPropagation();}).mouseover(function(evt){evt.stopPropagation();}).addClass(tClass+" "+tClass+_pane+" "+tClass+_state+" "+tClass+_pane+_state).appendTo($R);if(o.togglerContent_open)$("<span>"+o.togglerContent_open+"</span>").addClass("content content-open").css("display",s.isClosed?"none":"block").appendTo($T);if(o.togglerContent_closed)$("<span>"+o.togglerContent_closed+"</span>").addClass("content content-closed").css("display",s.isClosed?"block":"none").appendTo($T);if(o.applyDefaultStyles)$T.css(c.togglers.cssDef);if(!isOpen)bindStartSlidingEvent(pane,true);}});sizeHandles("all",true);};var initResizable=function(){var+draggingAvailable=(typeof $.fn.draggable=="function"),minPosition,maxPosition,edge;$.each(c.borderPanes.split(","),function(){var+pane=str(this),o=options[pane],s=state[pane];if(!draggingAvailable||!$Ps[pane]||!o.resizable){o.resizable=false;return true;}var+rClass=o.resizerClass,dragClass=rClass+"-drag",dragPaneClass=rClass+"-"+pane+"-drag",draggingClass=rClass+"-dragging",draggingPaneClass=rClass+"-"+pane+"-dragging",draggingClassSet=false,$P=$Ps[pane],$R=$Rs[pane];if(!s.isClosed)$R.attr("title",o.resizerTip).css("cursor",o.resizerCursor);$R.draggable({containment:$Container[0],axis:(c[pane].dir=="horz"?"y":"x"),delay:200,distance:1,helper:"clone",opacity:o.resizerDragOpacity,zIndex:c.zIndex.resizing,start:function(e,ui){if(false===execUserCallback(pane,o.onresize_start))return false;s.isResizing=true;clearTimer(pane,"closeSlider");$R.addClass(dragClass+" "+dragPaneClass);draggingClassSet=false;var resizerWidth=(pane=="east"||pane=="south"?o.spacing_open:0);setPaneMinMaxSizes(pane);s.minPosition-=resizerWidth;s.maxPosition-=resizerWidth;edge=(c[pane].dir=="horz"?"top":"left");$(o.maskIframesOnResize===true?"iframe":o.maskIframesOnResize).each(function(){$('<div class="ui-layout-mask"/>').css({background:"#fff",opacity:"0.001",zIndex:9,position:"absolute",width:this.offsetWidth+"px",height:this.offsetHeight+"px"}).css($(this).offset()).appendTo(this.parentNode);});},drag:function(e,ui){if(!draggingClassSet){$(".ui-draggable-dragging").addClass(draggingClass+" "+draggingPaneClass).children().css("visibility","hidden");draggingClassSet=true;if(s.isSliding)$Ps[pane].css("zIndex",c.zIndex.sliding);}if(ui.position[edge]<s.minPosition)ui.position[edge]=s.minPosition;else if(ui.position[edge]>s.maxPosition)ui.position[edge]=s.maxPosition;},stop:function(e,ui){var+dragPos=ui.position,resizerPos,newSize;$R.removeClass(dragClass+" "+dragPaneClass);switch(pane){case"north":resizerPos=dragPos.top;break;case"west":resizerPos=dragPos.left;break;case"south":resizerPos=cDims.outerHeight-dragPos.top-$R.outerHeight();break;case"east":resizerPos=cDims.outerWidth-dragPos.left-$R.outerWidth();break;}newSize=resizerPos-cDims[c[pane].edge];sizePane(pane,newSize);$("div.ui-layout-mask").remove();s.isResizing=false;}});});};var hide=function(pane,onInit){var+o=options[pane],s=state[pane],$P=$Ps[pane],$R=$Rs[pane];if(!$P||s.isHidden)return;if(false===execUserCallback(pane,o.onhide_start))return;s.isSliding=false;if($R)$R.hide();if(onInit||s.isClosed){s.isClosed=true;s.isHidden=true;$P.hide();sizeMidPanes(c[pane].dir=="horz"?"all":"center");execUserCallback(pane,o.onhide_end||o.onhide);}else{s.isHiding=true;close(pane,false);}};var show=function(pane,openPane){var+o=options[pane],s=state[pane],$P=$Ps[pane],$R=$Rs[pane];if(!$P||!s.isHidden)return;if(false===execUserCallback(pane,o.onshow_start))return;s.isSliding=false;s.isShowing=true;if($R&&o.spacing_open>0)$R.show();if(openPane===false)close(pane,true);else+open(pane);};var toggle=function(pane){var s=state[pane];if(s.isHidden)show(pane);else if(s.isClosed)open(pane);else+close(pane);};var close=function(pane,force,noAnimation){var+$P=$Ps[pane],$R=$Rs[pane],$T=$Ts[pane],o=options[pane],s=state[pane],doFX=!noAnimation&&!s.isClosed&&(o.fxName_close!="none"),edge=c[pane].edge,rClass=o.resizerClass,tClass=o.togglerClass,_pane="-"+pane,_open="-open",_sliding="-sliding",_closed="-closed",isShowing=s.isShowing,isHiding=s.isHiding;delete s.isShowing;delete s.isHiding;if(!$P||(!o.resizable&&!o.closable))return;else if(!force&&s.isClosed&&!isShowing)return;if(c.isLayoutBusy){setFlowCallback("close",pane,force);return;}if(!isShowing&&false===execUserCallback(pane,o.onclose_start))return;c[pane].isMoving=true;c.isLayoutBusy=true;s.isClosed=true;if(isHiding)s.isHidden=true;else if(isShowing)s.isHidden=false;syncPinBtns(pane,false);if(!s.isSliding)sizeMidPanes(c[pane].dir=="horz"?"all":"center");if($R){$R.css(edge,cDims[edge]).removeClass(rClass+_open+" "+rClass+_pane+_open).removeClass(rClass+_sliding+" "+rClass+_pane+_sliding).addClass(rClass+_closed+" "+rClass+_pane+_closed);if(o.resizable)$R.draggable("disable").css("cursor","default").attr("title","");if($T){$T.removeClass(tClass+_open+" "+tClass+_pane+_open).addClass(tClass+_closed+" "+tClass+_pane+_closed).attr("title",o.togglerTip_closed);}sizeHandles();}if(doFX){lockPaneForFX(pane,true);$P.hide(o.fxName_close,o.fxSettings_close,o.fxSpeed_close,function(){lockPaneForFX(pane,false);if(!s.isClosed)return;close_2();});}else{$P.hide();close_2();}function close_2(){bindStartSlidingEvent(pane,true);if(!isShowing)execUserCallback(pane,o.onclose_end||o.onclose);if(isShowing)execUserCallback(pane,o.onshow_end||o.onshow);if(isHiding)execUserCallback(pane,o.onhide_end||o.onhide);execFlowCallback(pane);}};var open=function(pane,slide,noAnimation){var+$P=$Ps[pane],$R=$Rs[pane],$T=$Ts[pane],o=options[pane],s=state[pane],doFX=!noAnimation&&s.isClosed&&(o.fxName_open!="none"),edge=c[pane].edge,rClass=o.resizerClass,tClass=o.togglerClass,_pane="-"+pane,_open="-open",_closed="-closed",_sliding="-sliding",isShowing=s.isShowing;delete s.isShowing;if(!$P||(!o.resizable&&!o.closable))return;else if(!s.isClosed&&!s.isSliding)return;if(s.isHidden&&!isShowing){show(pane,true);return;}if(c.isLayoutBusy){setFlowCallback("open",pane,slide);return;}if(false===execUserCallback(pane,o.onopen_start))return;c[pane].isMoving=true;c.isLayoutBusy=true;if(s.isSliding&&!slide)bindStopSlidingEvents(pane,false);s.isClosed=false;if(isShowing)s.isHidden=false;setPaneMinMaxSizes(pane);if(s.size>s.maxSize)$P.css(c[pane].sizeType,max(1,cssSize(pane,s.maxSize)));bindStartSlidingEvent(pane,false);if(doFX){lockPaneForFX(pane,true);$P.show(o.fxName_open,o.fxSettings_open,o.fxSpeed_open,function(){lockPaneForFX(pane,false);if(s.isClosed)return;open_2();});}else{$P.show();open_2();}function open_2(){if(!s.isSliding)sizeMidPanes(c[pane].dir=="vert"?"center":"all");if($R){$R.css(edge,cDims[edge]+getPaneSize(pane)).removeClass(rClass+_closed+" "+rClass+_pane+_closed).addClass(rClass+_open+" "+rClass+_pane+_open).addClass(!s.isSliding?"":rClass+_sliding+" "+rClass+_pane+_sliding);if(o.resizable)$R.draggable("enable").css("cursor",o.resizerCursor).attr("title",o.resizerTip);else+$R.css("cursor","default");if($T){$T.removeClass(tClass+_closed+" "+tClass+_pane+_closed).addClass(tClass+_open+" "+tClass+_pane+_open).attr("title",o.togglerTip_open);}sizeHandles("all");}sizeContent(pane);syncPinBtns(pane,!s.isSliding);execUserCallback(pane,o.onopen_end||o.onopen);if(isShowing)execUserCallback(pane,o.onshow_end||o.onshow);execFlowCallback(pane);}};var lockPaneForFX=function(pane,doLock){var $P=$Ps[pane];if(doLock){$P.css({zIndex:c.zIndex.animation});if(pane=="south")$P.css({top:cDims.top+cDims.innerHeight-$P.outerHeight()});else if(pane=="east")$P.css({left:cDims.left+cDims.innerWidth-$P.outerWidth()});}else{if(!state[pane].isSliding)$P.css({zIndex:c.zIndex.pane_normal});if(pane=="south")$P.css({top:"auto"});else if(pane=="east")$P.css({left:"auto"});}};var bindStartSlidingEvent=function(pane,enable){var+o=options[pane],$R=$Rs[pane],trigger=o.slideTrigger_open;if(!$R||!o.slidable)return;if(trigger!="click"&&trigger!="dblclick"&&trigger!="mouseover")trigger="click";$R+[enable?"bind":"unbind"](trigger,slideOpen).css("cursor",(enable?o.sliderCursor:"default")).attr("title",(enable?o.sliderTip:""));};var bindStopSlidingEvents=function(pane,enable){var+o=options[pane],s=state[pane],trigger=o.slideTrigger_close,action=(enable?"bind":"unbind"),$P=$Ps[pane],$R=$Rs[pane];s.isSliding=enable;clearTimer(pane,"closeSlider");$P.css({zIndex:(enable?c.zIndex.sliding:c.zIndex.pane_normal)});$R.css({zIndex:(enable?c.zIndex.sliding:c.zIndex.resizer_normal)});if(trigger!="click"&&trigger!="mouseout")trigger="mouseout";if(enable){$P.bind(trigger,slideClosed);$R.bind(trigger,slideClosed);if(trigger="mouseout"){$P.bind("mouseover",cancelMouseOut);$R.bind("mouseover",cancelMouseOut);}}else{$P.unbind(trigger);$R.unbind(trigger);if(trigger="mouseout"){$P.unbind("mouseover");$R.unbind("mouseover");clearTimer(pane,"closeSlider");}}function cancelMouseOut(evt){clearTimer(pane,"closeSlider");evt.stopPropagation();}};var slideOpen=function(){var pane=$(this).attr("resizer");if(state[pane].isClosed){bindStopSlidingEvents(pane,true);open(pane,true);}};var slideClosed=function(){var+$E=$(this),pane=$E.attr("pane")||$E.attr("resizer"),o=options[pane],s=state[pane];if(s.isClosed||s.isResizing)return;else if(o.slideTrigger_close=="click")close_NOW();else+setTimer(pane,"closeSlider",close_NOW,300);function close_NOW(){bindStopSlidingEvents(pane,false);if(!s.isClosed)close(pane);}};var sizePane=function(pane,size){var+edge=c[pane].edge,dir=c[pane].dir,o=options[pane],s=state[pane],$P=$Ps[pane],$R=$Rs[pane];setPaneMinMaxSizes(pane);s.minSize=max(s.minSize,o.minSize);if(o.maxSize>0)s.maxSize=min(s.maxSize,o.maxSize);size=max(size,s.minSize);size=min(size,s.maxSize);s.size=size;$R.css(edge,size+cDims[edge]);$P.css(c[pane].sizeType,max(1,cssSize(pane,size)));if(!s.isSliding)sizeMidPanes(dir=="horz"?"all":"center");sizeHandles();sizeContent(pane);execUserCallback(pane,o.onresize_end||o.onresize);};var sizeMidPanes=function(panes,overrideDims,onInit){if(!panes||panes=="all")panes="east,west,center";var d=getPaneDims();if(overrideDims)$.extend(d,overrideDims);$.each(panes.split(","),function(){if(!$Ps[this])return;var+pane=str(this),o=options[pane],s=state[pane],$P=$Ps[pane],$R=$Rs[pane],hasRoom=true,CSS={};if(pane=="center"){d=getPaneDims();CSS=$.extend({},d);CSS.width=max(1,cssW(pane,CSS.width));CSS.height=max(1,cssH(pane,CSS.height));hasRoom=(CSS.width>1&&CSS.height>1);if($.browser.msie&&(!$.boxModel||$.browser.version<7)){if($Ps.north)$Ps.north.css({width:cssW($Ps.north,cDims.innerWidth)});if($Ps.south)$Ps.south.css({width:cssW($Ps.south,cDims.innerWidth)});}}else{CSS.top=d.top;CSS.bottom=d.bottom;CSS.height=max(1,cssH(pane,d.height));hasRoom=(CSS.height>1);}if(hasRoom){$P.css(CSS);if(s.noRoom){s.noRoom=false;if(s.isHidden)return;else show(pane,!s.isClosed);}if(!onInit){sizeContent(pane);execUserCallback(pane,o.onresize_end||o.onresize);}}else if(!s.noRoom){s.noRoom=true;if(s.isHidden)return;if(onInit){$P.hide();if($R)$R.hide();}else hide(pane);}});};var sizeContent=function(panes){if(!panes||panes=="all")panes=c.allPanes;$.each(panes.split(","),function(){if(!$Cs[this])return;var+pane=str(this),ignore=options[pane].contentIgnoreSelector,$P=$Ps[pane],$C=$Cs[pane],e_C=$C[0],height=cssH($P);;$P.children().each(function(){if(this==e_C)return;var $E=$(this);if(!ignore||!$E.is(ignore))height-=$E.outerHeight();});if(height>0)height=cssH($C,height);if(height<1)$C.hide();else+$C.css({height:height}).show();});};var sizeHandles=function(panes,onInit){if(!panes||panes=="all")panes=c.borderPanes;$.each(panes.split(","),function(){var+pane=str(this),o=options[pane],s=state[pane],$P=$Ps[pane],$R=$Rs[pane],$T=$Ts[pane];if(!$P||!$R||(!o.resizable&&!o.closable))return;var+dir=c[pane].dir,_state=(s.isClosed?"_closed":"_open"),spacing=o["spacing"+_state],togAlign=o["togglerAlign"+_state],togLen=o["togglerLength"+_state],paneLen,offset,CSS={};if(spacing==0){$R.hide();return;}else if(!s.noRoom&&!s.isHidden)$R.show();if(dir=="horz"){paneLen=$P.outerWidth();$R.css({width:max(1,cssW($R,paneLen)),height:max(1,cssH($R,spacing)),left:cssNum($P,"left")});}else{paneLen=$P.outerHeight();$R.css({height:max(1,cssH($R,paneLen)),width:max(1,cssW($R,spacing)),top:cDims.top+getPaneSize("north",true)});}if($T){if(togLen==0||(s.isSliding&&o.hideTogglerOnSlide)){$T.hide();return;}else+$T.show();if(!(togLen>0)||togLen=="100%"||togLen>paneLen){togLen=paneLen;offset=0;}else{if(typeof togAlign=="string"){switch(togAlign){case"top":case"left":offset=0;break;case"bottom":case"right":offset=paneLen-togLen;break;case"middle":case"center":default:offset=Math.floor((paneLen-togLen)/2);}}else{var x=parseInt(togAlign);if(togAlign>=0)offset=x;else offset=paneLen-togLen+x;}}var+$TC_o=(o.togglerContent_open?$T.children(".content-open"):false),$TC_c=(o.togglerContent_closed?$T.children(".content-closed"):false),$TC=(s.isClosed?$TC_c:$TC_o);if($TC_o)$TC_o.css("display",s.isClosed?"none":"block");if($TC_c)$TC_c.css("display",s.isClosed?"block":"none");if(dir=="horz"){var width=cssW($T,togLen);$T.css({width:max(0,width),height:max(1,cssH($T,spacing)),left:offset});if($TC)$TC.css("marginLeft",Math.floor((width-$TC.outerWidth())/2));}else{var height=cssH($T,togLen);$T.css({height:max(0,height),width:max(1,cssW($T,spacing)),top:offset});if($TC)$TC.css("marginTop",Math.floor((height-$TC.outerHeight())/2));}}if(onInit&&o.initHidden){$R.hide();if($T)$T.hide();}});};var resizeAll=function(){var+oldW=cDims.innerWidth,oldH=cDims.innerHeight;cDims=state.container=getElemDims($Container);var+checkH=(cDims.innerHeight<oldH),checkW=(cDims.innerWidth<oldW),s,dir;if(checkH||checkW)$.each(["south","north","east","west"],function(i,pane){s=state[pane];dir=c[pane].dir;if(!s.isClosed&&((checkH&&dir=="horz")||(checkW&&dir=="vert"))){setPaneMinMaxSizes(pane);if(s.size>s.maxSize)sizePane(pane,s.maxSize);}});sizeMidPanes("all");sizeHandles("all");};function keyDown(evt){if(!evt)return true;var code=evt.keyCode;if(code<33)return true;var+PANE={38:"north",40:"south",37:"west",39:"east"},isCursorKey=(code>=37&&code<=40),ALT=evt.altKey,SHIFT=evt.shiftKey,CTRL=evt.ctrlKey,pane=false,s,o,k,m,el;if(!CTRL&&!SHIFT)return true;else if(isCursorKey&&options[PANE[code]].enableCursorHotkey)pane=PANE[code];else+$.each(c.borderPanes.split(","),function(i,p){o=options[p];k=o.customHotkey;m=o.customHotkeyModifier;if((SHIFT&&m=="SHIFT")||(CTRL&&m=="CTRL")||(CTRL&&SHIFT)){if(k&&code==(isNaN(k)||k<=9?k.toUpperCase().charCodeAt(0):k)){pane=p;return false;}}});if(!pane)return true;o=options[pane];s=state[pane];if(!o.enableCursorHotkey||s.isHidden||!$Ps[pane])return true;el=evt.target||evt.srcElement;if(el&&SHIFT&&isCursorKey&&(el.tagName=="TEXTAREA"||(el.tagName=="INPUT"&&(code==37||code==39))))return true;toggle(pane);evt.stopPropagation();evt.returnValue=false;return false;};function allowOverflow(elem){if(this&&this.tagName)elem=this;var $P;if(typeof elem=="string")$P=$Ps[elem];else{if($(elem).attr("pane"))$P=$(elem);else $P=$(elem).parents("div[pane]:first");}if(!$P.length)return;var+pane=$P.attr("pane"),s=state[pane];if(s.cssSaved)resetOverflow(pane);if(s.isSliding||s.isResizing||s.isClosed){s.cssSaved=false;return;}var+newCSS={zIndex:(c.zIndex.pane_normal+1)},curCSS={},of=$P.css("overflow"),ofX=$P.css("overflowX"),ofY=$P.css("overflowY");if(of!="visible"){curCSS.overflow=of;newCSS.overflow="visible";}if(ofX&&ofX!="visible"&&ofX!="auto"){curCSS.overflowX=ofX;newCSS.overflowX="visible";}if(ofY&&ofY!="visible"&&ofY!="auto"){curCSS.overflowY=ofX;newCSS.overflowY="visible";}s.cssSaved=curCSS;$P.css(newCSS);$.each(c.allPanes.split(","),function(i,p){if(p!=pane)resetOverflow(p);});};function resetOverflow(elem){if(this&&this.tagName)elem=this;var $P;if(typeof elem=="string")$P=$Ps[elem];else{if($(elem).hasClass("ui-layout-pane"))$P=$(elem);else $P=$(elem).parents("div[pane]:first");}if(!$P.length)return;var+pane=$P.attr("pane"),s=state[pane],CSS=s.cssSaved||{};if(!s.isSliding&&!s.isResizing)$P.css("zIndex",c.zIndex.pane_normal);$P.css(CSS);s.cssSaved=false;};function getBtn(selector,pane,action){var+$E=$(selector),err="Error Adding Button \n\nInvalid ";if(!$E.length)alert(err+"selector: "+selector);else if(c.borderPanes.indexOf(pane)==-1)alert(err+"pane: "+pane);else{var btn=options[pane].buttonClass+"-"+action;$E.addClass(btn+" "+btn+"-"+pane);return $E;}return false;};function addToggleBtn(selector,pane){var $E=getBtn(selector,pane,"toggle");if($E)$E.attr("title",state[pane].isClosed?"Open":"Close").click(function(evt){toggle(pane);evt.stopPropagation();});};function addOpenBtn(selector,pane){var $E=getBtn(selector,pane,"open");if($E)$E.attr("title","Open").click(function(evt){open(pane);evt.stopPropagation();});};function addCloseBtn(selector,pane){var $E=getBtn(selector,pane,"close");if($E)$E.attr("title","Close").click(function(evt){close(pane);evt.stopPropagation();});};function addPinBtn(selector,pane){var $E=getBtn(selector,pane,"pin");if($E){var s=state[pane];$E.click(function(evt){setPinState($(this),pane,(s.isSliding||s.isClosed));if(s.isSliding||s.isClosed)open(pane);else close(pane);evt.stopPropagation();});setPinState($E,pane,(!s.isClosed&&!s.isSliding));c[pane].pins.push(selector);}};function syncPinBtns(pane,doPin){$.each(c[pane].pins,function(i,selector){setPinState($(selector),pane,doPin);});};function setPinState($Pin,pane,doPin){var updown=$Pin.attr("pin");if(updown&&doPin==(updown=="down"))return;var+root=options[pane].buttonClass,class1=root+"-pin",class2=class1+"-"+pane,UP1=class1+"-up",UP2=class2+"-up",DN1=class1+"-down",DN2=class2+"-down";$Pin.attr("pin",doPin?"down":"up").attr("title",doPin?"Un-Pin":"Pin").removeClass(doPin?UP1:DN1).removeClass(doPin?UP2:DN2).addClass(doPin?DN1:UP1).addClass(doPin?DN2:UP2);};var+$Container=$(this).css({overflow:"hidden"}),$Ps={},$Cs={},$Rs={},$Ts={},c=config,cDims=state.container;create();return{options:options,state:state,panes:$Ps,toggle:toggle,open:open,close:close,hide:hide,show:show,resizeContent:sizeContent,sizePane:sizePane,resizeAll:resizeAll,addToggleBtn:addToggleBtn,addOpenBtn:addOpenBtn,addCloseBtn:addCloseBtn,addPinBtn:addPinBtn,allowOverflow:allowOverflow,resetOverflow:resetOverflow,cssWidth:cssW,cssHeight:cssH};}})(jQuery);
+ static/layout/jquery.ui.all.js view
@@ -0,0 +1,7600 @@+/*
+ * jQuery UI 1.5.2
+ *
+ * Copyright (c) 2008 Paul Bakaus (ui.jquery.com)
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ *
+ * http://docs.jquery.com/UI
+ */
+;(function($) {
+
+$.ui = {
+	plugin: {
+		add: function(module, option, set) {
+			var proto = $.ui[module].prototype;
+			for(var i in set) {
+				proto.plugins[i] = proto.plugins[i] || [];
+				proto.plugins[i].push([option, set[i]]);
+			}
+		},
+		call: function(instance, name, args) {
+			var set = instance.plugins[name];
+			if(!set) { return; }
+			
+			for (var i = 0; i < set.length; i++) {
+				if (instance.options[set[i][0]]) {
+					set[i][1].apply(instance.element, args);
+				}
+			}
+		}	
+	},
+	cssCache: {},
+	css: function(name) {
+		if ($.ui.cssCache[name]) { return $.ui.cssCache[name]; }
+		var tmp = $('<div class="ui-gen">').addClass(name).css({position:'absolute', top:'-5000px', left:'-5000px', display:'block'}).appendTo('body');
+		
+		//if (!$.browser.safari)
+			//tmp.appendTo('body'); 
+		
+		//Opera and Safari set width and height to 0px instead of auto
+		//Safari returns rgba(0,0,0,0) when bgcolor is not set
+		$.ui.cssCache[name] = !!(
+			(!(/auto|default/).test(tmp.css('cursor')) || (/^[1-9]/).test(tmp.css('height')) || (/^[1-9]/).test(tmp.css('width')) || 
+			!(/none/).test(tmp.css('backgroundImage')) || !(/transparent|rgba\(0, 0, 0, 0\)/).test(tmp.css('backgroundColor')))
+		);
+		try { $('body').get(0).removeChild(tmp.get(0));	} catch(e){}
+		return $.ui.cssCache[name];
+	},
+	disableSelection: function(el) {
+		$(el).attr('unselectable', 'on').css('MozUserSelect', 'none');
+	},
+	enableSelection: function(el) {
+		$(el).attr('unselectable', 'off').css('MozUserSelect', '');
+	},
+	hasScroll: function(e, a) {
+		var scroll = /top/.test(a||"top") ? 'scrollTop' : 'scrollLeft', has = false;
+		if (e[scroll] > 0) return true; e[scroll] = 1;
+		has = e[scroll] > 0 ? true : false; e[scroll] = 0;
+		return has;
+	}
+};
+
+
+/** jQuery core modifications and additions **/
+
+var _remove = $.fn.remove;
+$.fn.remove = function() {
+	$("*", this).add(this).triggerHandler("remove");
+	return _remove.apply(this, arguments );
+};
+
+// $.widget is a factory to create jQuery plugins
+// taking some boilerplate code out of the plugin code
+// created by Scott González and Jörn Zaefferer
+function getter(namespace, plugin, method) {
+	var methods = $[namespace][plugin].getter || [];
+	methods = (typeof methods == "string" ? methods.split(/,?\s+/) : methods);
+	return ($.inArray(method, methods) != -1);
+}
+
+$.widget = function(name, prototype) {
+	var namespace = name.split(".")[0];
+	name = name.split(".")[1];
+	
+	// create plugin method
+	$.fn[name] = function(options) {
+		var isMethodCall = (typeof options == 'string'),
+			args = Array.prototype.slice.call(arguments, 1);
+		
+		if (isMethodCall && getter(namespace, name, options)) {
+			var instance = $.data(this[0], name);
+			return (instance ? instance[options].apply(instance, args)
+				: undefined);
+		}
+		
+		return this.each(function() {
+			var instance = $.data(this, name);
+			if (isMethodCall && instance && $.isFunction(instance[options])) {
+				instance[options].apply(instance, args);
+			} else if (!isMethodCall) {
+				$.data(this, name, new $[namespace][name](this, options));
+			}
+		});
+	};
+	
+	// create widget constructor
+	$[namespace][name] = function(element, options) {
+		var self = this;
+		
+		this.widgetName = name;
+		this.widgetBaseClass = namespace + '-' + name;
+		
+		this.options = $.extend({}, $.widget.defaults, $[namespace][name].defaults, options);
+		this.element = $(element)
+			.bind('setData.' + name, function(e, key, value) {
+				return self.setData(key, value);
+			})
+			.bind('getData.' + name, function(e, key) {
+				return self.getData(key);
+			})
+			.bind('remove', function() {
+				return self.destroy();
+			});
+		this.init();
+	};
+	
+	// add widget prototype
+	$[namespace][name].prototype = $.extend({}, $.widget.prototype, prototype);
+};
+
+$.widget.prototype = {
+	init: function() {},
+	destroy: function() {
+		this.element.removeData(this.widgetName);
+	},
+	
+	getData: function(key) {
+		return this.options[key];
+	},
+	setData: function(key, value) {
+		this.options[key] = value;
+		
+		if (key == 'disabled') {
+			this.element[value ? 'addClass' : 'removeClass'](
+				this.widgetBaseClass + '-disabled');
+		}
+	},
+	
+	enable: function() {
+		this.setData('disabled', false);
+	},
+	disable: function() {
+		this.setData('disabled', true);
+	}
+};
+
+$.widget.defaults = {
+	disabled: false
+};
+
+
+/** Mouse Interaction Plugin **/
+
+$.ui.mouse = {
+	mouseInit: function() {
+		var self = this;
+	
+		this.element.bind('mousedown.'+this.widgetName, function(e) {
+			return self.mouseDown(e);
+		});
+		
+		// Prevent text selection in IE
+		if ($.browser.msie) {
+			this._mouseUnselectable = this.element.attr('unselectable');
+			this.element.attr('unselectable', 'on');
+		}
+		
+		this.started = false;
+	},
+	
+	// TODO: make sure destroying one instance of mouse doesn't mess with
+	// other instances of mouse
+	mouseDestroy: function() {
+		this.element.unbind('.'+this.widgetName);
+		
+		// Restore text selection in IE
+		($.browser.msie
+			&& this.element.attr('unselectable', this._mouseUnselectable));
+	},
+	
+	mouseDown: function(e) {
+		// we may have missed mouseup (out of window)
+		(this._mouseStarted && this.mouseUp(e));
+		
+		this._mouseDownEvent = e;
+		
+		var self = this,
+			btnIsLeft = (e.which == 1),
+			elIsCancel = (typeof this.options.cancel == "string" ? $(e.target).parents().add(e.target).filter(this.options.cancel).length : false);
+		if (!btnIsLeft || elIsCancel || !this.mouseCapture(e)) {
+			return true;
+		}
+		
+		this._mouseDelayMet = !this.options.delay;
+		if (!this._mouseDelayMet) {
+			this._mouseDelayTimer = setTimeout(function() {
+				self._mouseDelayMet = true;
+			}, this.options.delay);
+		}
+		
+		if (this.mouseDistanceMet(e) && this.mouseDelayMet(e)) {
+			this._mouseStarted = (this.mouseStart(e) !== false);
+			if (!this._mouseStarted) {
+				e.preventDefault();
+				return true;
+			}
+		}
+		
+		// these delegates are required to keep context
+		this._mouseMoveDelegate = function(e) {
+			return self.mouseMove(e);
+		};
+		this._mouseUpDelegate = function(e) {
+			return self.mouseUp(e);
+		};
+		$(document)
+			.bind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
+			.bind('mouseup.'+this.widgetName, this._mouseUpDelegate);
+		
+		return false;
+	},
+	
+	mouseMove: function(e) {
+		// IE mouseup check - mouseup happened when mouse was out of window
+		if ($.browser.msie && !e.button) {
+			return this.mouseUp(e);
+		}
+		
+		if (this._mouseStarted) {
+			this.mouseDrag(e);
+			return false;
+		}
+		
+		if (this.mouseDistanceMet(e) && this.mouseDelayMet(e)) {
+			this._mouseStarted =
+				(this.mouseStart(this._mouseDownEvent, e) !== false);
+			(this._mouseStarted ? this.mouseDrag(e) : this.mouseUp(e));
+		}
+		
+		return !this._mouseStarted;
+	},
+	
+	mouseUp: function(e) {
+		$(document)
+			.unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
+			.unbind('mouseup.'+this.widgetName, this._mouseUpDelegate);
+		
+		if (this._mouseStarted) {
+			this._mouseStarted = false;
+			this.mouseStop(e);
+		}
+		
+		return false;
+	},
+	
+	mouseDistanceMet: function(e) {
+		return (Math.max(
+				Math.abs(this._mouseDownEvent.pageX - e.pageX),
+				Math.abs(this._mouseDownEvent.pageY - e.pageY)
+			) >= this.options.distance
+		);
+	},
+	
+	mouseDelayMet: function(e) {
+		return this._mouseDelayMet;
+	},
+	
+	// These are placeholder methods, to be overriden by extending plugin
+	mouseStart: function(e) {},
+	mouseDrag: function(e) {},
+	mouseStop: function(e) {},
+	mouseCapture: function(e) { return true; }
+};
+
+$.ui.mouse.defaults = {
+	cancel: null,
+	distance: 1,
+	delay: 0
+};
+
+})(jQuery);
+/*
+ * jQuery UI Draggable
+ *
+ * Copyright (c) 2008 Paul Bakaus
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ * 
+ * http://docs.jquery.com/UI/Draggables
+ *
+ * Depends:
+ *	ui.core.js
+ */
+(function($) {
+
+$.widget("ui.draggable", $.extend({}, $.ui.mouse, {
+	init: function() {
+		
+		//Initialize needed constants
+		var o = this.options;
+
+		//Position the node
+		if (o.helper == 'original' && !(/(relative|absolute|fixed)/).test(this.element.css('position')))
+			this.element.css('position', 'relative');
+
+		this.element.addClass('ui-draggable');
+		(o.disabled && this.element.addClass('ui-draggable-disabled'));
+		
+		this.mouseInit();
+		
+	},
+	mouseStart: function(e) {
+		var o = this.options;
+		
+		if (this.helper || o.disabled || $(e.target).is('.ui-resizable-handle')) return false;
+		
+		var handle = !this.options.handle || !$(this.options.handle, this.element).length ? true : false;
+		
+	
+		$(this.options.handle, this.element).find("*").andSelf().each(function() {
+			if(this == e.target) handle = true;
+		});
+		if (!handle) return false;
+		
+		if($.ui.ddmanager) $.ui.ddmanager.current = this;
+		
+		//Create and append the visible helper
+		this.helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [e])) : (o.helper == 'clone' ? this.element.clone() : this.element);
+		if(!this.helper.parents('body').length) this.helper.appendTo((o.appendTo == 'parent' ? this.element[0].parentNode : o.appendTo));
+		if(this.helper[0] != this.element[0] && !(/(fixed|absolute)/).test(this.helper.css("position"))) this.helper.css("position", "absolute");
+		
+		/*
+		 * - Position generation -
+		 * This block generates everything position related - it's the core of draggables.
+		 */
+		
+		this.margins = {																				//Cache the margins
+			left: (parseInt(this.element.css("marginLeft"),10) || 0),
+			top: (parseInt(this.element.css("marginTop"),10) || 0)
+		};		
+		
+		this.cssPosition = this.helper.css("position");													//Store the helper's css position
+		this.offset = this.element.offset();															//The element's absolute position on the page
+		this.offset = {																					//Substract the margins from the element's absolute offset
+			top: this.offset.top - this.margins.top,
+			left: this.offset.left - this.margins.left
+		};
+		
+		this.offset.click = {																			//Where the click happened, relative to the element
+			left: e.pageX - this.offset.left,
+			top: e.pageY - this.offset.top
+		};
+		
+		this.offsetParent = this.helper.offsetParent(); var po = this.offsetParent.offset();			//Get the offsetParent and cache its position
+		if(this.offsetParent[0] == document.body && $.browser.mozilla) po = { top: 0, left: 0 };		//Ugly FF3 fix
+		this.offset.parent = {																			//Store its position plus border
+			top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0),
+			left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0)
+		};
+		
+		var p = this.element.position();																//This is a relative to absolute position minus the actual position calculation - only used for relative positioned helpers
+		this.offset.relative = this.cssPosition == "relative" ? {
+			top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.offsetParent[0].scrollTop,
+			left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.offsetParent[0].scrollLeft
+		} : { top: 0, left: 0 };
+		
+		this.originalPosition = this.generatePosition(e);												//Generate the original position
+		this.helperProportions = { width: this.helper.outerWidth(), height: this.helper.outerHeight() };//Cache the helper size
+		
+		if(o.cursorAt) {
+			if(o.cursorAt.left != undefined) this.offset.click.left = o.cursorAt.left + this.margins.left;
+			if(o.cursorAt.right != undefined) this.offset.click.left = this.helperProportions.width - o.cursorAt.right + this.margins.left;
+			if(o.cursorAt.top != undefined) this.offset.click.top = o.cursorAt.top + this.margins.top;
+			if(o.cursorAt.bottom != undefined) this.offset.click.top = this.helperProportions.height - o.cursorAt.bottom + this.margins.top;
+		}
+		
+		
+		/*
+		 * - Position constraining -
+		 * Here we prepare position constraining like grid and containment.
+		 */	
+		
+		if(o.containment) {
+			if(o.containment == 'parent') o.containment = this.helper[0].parentNode;
+			if(o.containment == 'document' || o.containment == 'window') this.containment = [
+				0 - this.offset.relative.left - this.offset.parent.left,
+				0 - this.offset.relative.top - this.offset.parent.top,
+				$(o.containment == 'document' ? document : window).width() - this.offset.relative.left - this.offset.parent.left - this.helperProportions.width - this.margins.left - (parseInt(this.element.css("marginRight"),10) || 0),
+				($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.offset.relative.top - this.offset.parent.top - this.helperProportions.height - this.margins.top - (parseInt(this.element.css("marginBottom"),10) || 0)
+			];
+			
+			if(!(/^(document|window|parent)$/).test(o.containment)) {
+				var ce = $(o.containment)[0];
+				var co = $(o.containment).offset();
+				
+				this.containment = [
+					co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) - this.offset.relative.left - this.offset.parent.left,
+					co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) - this.offset.relative.top - this.offset.parent.top,
+					co.left+Math.max(ce.scrollWidth,ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - this.offset.relative.left - this.offset.parent.left - this.helperProportions.width - this.margins.left - (parseInt(this.element.css("marginRight"),10) || 0),
+					co.top+Math.max(ce.scrollHeight,ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - this.offset.relative.top - this.offset.parent.top - this.helperProportions.height - this.margins.top - (parseInt(this.element.css("marginBottom"),10) || 0)
+				];
+			}
+		}
+		
+		//Call plugins and callbacks
+		this.propagate("start", e);
+		
+		this.helperProportions = { width: this.helper.outerWidth(), height: this.helper.outerHeight() };//Recache the helper size
+		if ($.ui.ddmanager && !o.dropBehaviour) $.ui.ddmanager.prepareOffsets(this, e);
+		
+		this.helper.addClass("ui-draggable-dragging");
+		this.mouseDrag(e); //Execute the drag once - this causes the helper not to be visible before getting its correct position
+		return true;
+	},
+	convertPositionTo: function(d, pos) {
+		if(!pos) pos = this.position;
+		var mod = d == "absolute" ? 1 : -1;
+		return {
+			top: (
+				pos.top																	// the calculated relative position
+				+ this.offset.relative.top	* mod										// Only for relative positioned nodes: Relative offset from element to offset parent
+				+ this.offset.parent.top * mod											// The offsetParent's offset without borders (offset + border)
+				- (this.cssPosition == "fixed" || (this.cssPosition == "absolute" && this.offsetParent[0] == document.body) ? 0 : this.offsetParent[0].scrollTop) * mod	// The offsetParent's scroll position, not if the element is fixed
+				+ (this.cssPosition == "fixed" ? $(document).scrollTop() : 0) * mod
+				+ this.margins.top * mod												//Add the margin (you don't want the margin counting in intersection methods)
+			),
+			left: (
+				pos.left																// the calculated relative position
+				+ this.offset.relative.left	* mod										// Only for relative positioned nodes: Relative offset from element to offset parent
+				+ this.offset.parent.left * mod											// The offsetParent's offset without borders (offset + border)
+				- (this.cssPosition == "fixed" || (this.cssPosition == "absolute" && this.offsetParent[0] == document.body) ? 0 : this.offsetParent[0].scrollLeft) * mod	// The offsetParent's scroll position, not if the element is fixed
+				+ (this.cssPosition == "fixed" ? $(document).scrollLeft() : 0) * mod
+				+ this.margins.left * mod												//Add the margin (you don't want the margin counting in intersection methods)
+			)
+		};
+	},
+	generatePosition: function(e) {
+		
+		var o = this.options;
+		var position = {
+			top: (
+				e.pageY																	// The absolute mouse position
+				- this.offset.click.top													// Click offset (relative to the element)
+				- this.offset.relative.top												// Only for relative positioned nodes: Relative offset from element to offset parent
+				- this.offset.parent.top												// The offsetParent's offset without borders (offset + border)
+				+ (this.cssPosition == "fixed" || (this.cssPosition == "absolute" && this.offsetParent[0] == document.body) ? 0 : this.offsetParent[0].scrollTop)	// The offsetParent's scroll position, not if the element is fixed
+				- (this.cssPosition == "fixed" ? $(document).scrollTop() : 0)
+			),
+			left: (
+				e.pageX																	// The absolute mouse position
+				- this.offset.click.left												// Click offset (relative to the element)
+				- this.offset.relative.left												// Only for relative positioned nodes: Relative offset from element to offset parent
+				- this.offset.parent.left												// The offsetParent's offset without borders (offset + border)
+				+ (this.cssPosition == "fixed" || (this.cssPosition == "absolute" && this.offsetParent[0] == document.body) ? 0 : this.offsetParent[0].scrollLeft)	// The offsetParent's scroll position, not if the element is fixed
+				- (this.cssPosition == "fixed" ? $(document).scrollLeft() : 0)
+			)
+		};
+		
+		if(!this.originalPosition) return position;										//If we are not dragging yet, we won't check for options
+		
+		/*
+		 * - Position constraining -
+		 * Constrain the position to a mix of grid, containment.
+		 */
+		if(this.containment) {
+			if(position.left < this.containment[0]) position.left = this.containment[0];
+			if(position.top < this.containment[1]) position.top = this.containment[1];
+			if(position.left > this.containment[2]) position.left = this.containment[2];
+			if(position.top > this.containment[3]) position.top = this.containment[3];
+		}
+		
+		if(o.grid) {
+			var top = this.originalPosition.top + Math.round((position.top - this.originalPosition.top) / o.grid[1]) * o.grid[1];
+			position.top = this.containment ? (!(top < this.containment[1] || top > this.containment[3]) ? top : (!(top < this.containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;
+			
+			var left = this.originalPosition.left + Math.round((position.left - this.originalPosition.left) / o.grid[0]) * o.grid[0];
+			position.left = this.containment ? (!(left < this.containment[0] || left > this.containment[2]) ? left : (!(left < this.containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left;
+		}
+		
+		return position;
+	},
+	mouseDrag: function(e) {
+		
+		//Compute the helpers position
+		this.position = this.generatePosition(e);
+		this.positionAbs = this.convertPositionTo("absolute");
+		
+		//Call plugins and callbacks and use the resulting position if something is returned		
+		this.position = this.propagate("drag", e) || this.position;
+		
+		if(!this.options.axis || this.options.axis != "y") this.helper[0].style.left = this.position.left+'px';
+		if(!this.options.axis || this.options.axis != "x") this.helper[0].style.top = this.position.top+'px';
+		if($.ui.ddmanager) $.ui.ddmanager.drag(this, e);
+		
+		return false;
+	},
+	mouseStop: function(e) {
+		
+		//If we are using droppables, inform the manager about the drop
+		var dropped = false;
+		if ($.ui.ddmanager && !this.options.dropBehaviour)
+			var dropped = $.ui.ddmanager.drop(this, e);		
+		
+		if((this.options.revert == "invalid" && !dropped) || (this.options.revert == "valid" && dropped) || this.options.revert === true) {
+			var self = this;
+			$(this.helper).animate(this.originalPosition, parseInt(this.options.revert, 10) || 500, function() {
+				self.propagate("stop", e);
+				self.clear();
+			});
+		} else {
+			this.propagate("stop", e);
+			this.clear();
+		}
+		
+		return false;
+	},
+	clear: function() {
+		this.helper.removeClass("ui-draggable-dragging");
+		if(this.options.helper != 'original' && !this.cancelHelperRemoval) this.helper.remove();
+		//if($.ui.ddmanager) $.ui.ddmanager.current = null;
+		this.helper = null;
+		this.cancelHelperRemoval = false;
+	},
+	
+	// From now on bulk stuff - mainly helpers
+	plugins: {},
+	uiHash: function(e) {
+		return {
+			helper: this.helper,
+			position: this.position,
+			absolutePosition: this.positionAbs,
+			options: this.options			
+		};
+	},
+	propagate: function(n,e) {
+		$.ui.plugin.call(this, n, [e, this.uiHash()]);
+		if(n == "drag") this.positionAbs = this.convertPositionTo("absolute"); //The absolute position has to be recalculated after plugins
+		return this.element.triggerHandler(n == "drag" ? n : "drag"+n, [e, this.uiHash()], this.options[n]);
+	},
+	destroy: function() {
+		if(!this.element.data('draggable')) return;
+		this.element.removeData("draggable").unbind(".draggable").removeClass('ui-draggable');
+		this.mouseDestroy();
+	}
+}));
+
+$.extend($.ui.draggable, {
+	defaults: {
+		appendTo: "parent",
+		axis: false,
+		cancel: ":input",
+		delay: 0,
+		distance: 1,
+		helper: "original"
+	}
+});
+
+$.ui.plugin.add("draggable", "cursor", {
+	start: function(e, ui) {
+		var t = $('body');
+		if (t.css("cursor")) ui.options._cursor = t.css("cursor");
+		t.css("cursor", ui.options.cursor);
+	},
+	stop: function(e, ui) {
+		if (ui.options._cursor) $('body').css("cursor", ui.options._cursor);
+	}
+});
+
+$.ui.plugin.add("draggable", "zIndex", {
+	start: function(e, ui) {
+		var t = $(ui.helper);
+		if(t.css("zIndex")) ui.options._zIndex = t.css("zIndex");
+		t.css('zIndex', ui.options.zIndex);
+	},
+	stop: function(e, ui) {
+		if(ui.options._zIndex) $(ui.helper).css('zIndex', ui.options._zIndex);
+	}
+});
+
+$.ui.plugin.add("draggable", "opacity", {
+	start: function(e, ui) {
+		var t = $(ui.helper);
+		if(t.css("opacity")) ui.options._opacity = t.css("opacity");
+		t.css('opacity', ui.options.opacity);
+	},
+	stop: function(e, ui) {
+		if(ui.options._opacity) $(ui.helper).css('opacity', ui.options._opacity);
+	}
+});
+
+$.ui.plugin.add("draggable", "iframeFix", {
+	start: function(e, ui) {
+		$(ui.options.iframeFix === true ? "iframe" : ui.options.iframeFix).each(function() {					
+			$('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>')
+			.css({
+				width: this.offsetWidth+"px", height: this.offsetHeight+"px",
+				position: "absolute", opacity: "0.001", zIndex: 1000
+			})
+			.css($(this).offset())
+			.appendTo("body");
+		});
+	},
+	stop: function(e, ui) {
+		$("div.DragDropIframeFix").each(function() { this.parentNode.removeChild(this); }); //Remove frame helpers	
+	}
+});
+
+$.ui.plugin.add("draggable", "scroll", {
+	start: function(e, ui) {
+		var o = ui.options;
+		var i = $(this).data("draggable");
+		o.scrollSensitivity	= o.scrollSensitivity || 20;
+		o.scrollSpeed		= o.scrollSpeed || 20;
+		
+		i.overflowY = function(el) {
+			do { if(/auto|scroll/.test(el.css('overflow')) || (/auto|scroll/).test(el.css('overflow-y'))) return el; el = el.parent(); } while (el[0].parentNode);
+			return $(document);
+		}(this);
+		i.overflowX = function(el) {
+			do { if(/auto|scroll/.test(el.css('overflow')) || (/auto|scroll/).test(el.css('overflow-x'))) return el; el = el.parent(); } while (el[0].parentNode);
+			return $(document);
+		}(this);
+		
+		if(i.overflowY[0] != document && i.overflowY[0].tagName != 'HTML') i.overflowYOffset = i.overflowY.offset();
+		if(i.overflowX[0] != document && i.overflowX[0].tagName != 'HTML') i.overflowXOffset = i.overflowX.offset();
+		
+	},
+	drag: function(e, ui) {
+		
+		var o = ui.options;
+		var i = $(this).data("draggable");
+		
+		if(i.overflowY[0] != document && i.overflowY[0].tagName != 'HTML') {
+			if((i.overflowYOffset.top + i.overflowY[0].offsetHeight) - e.pageY < o.scrollSensitivity)
+				i.overflowY[0].scrollTop = i.overflowY[0].scrollTop + o.scrollSpeed;
+			if(e.pageY - i.overflowYOffset.top < o.scrollSensitivity)
+				i.overflowY[0].scrollTop = i.overflowY[0].scrollTop - o.scrollSpeed;
+							
+		} else {
+			if(e.pageY - $(document).scrollTop() < o.scrollSensitivity)
+				$(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
+			if($(window).height() - (e.pageY - $(document).scrollTop()) < o.scrollSensitivity)
+				$(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
+		}
+		
+		if(i.overflowX[0] != document && i.overflowX[0].tagName != 'HTML') {
+			if((i.overflowXOffset.left + i.overflowX[0].offsetWidth) - e.pageX < o.scrollSensitivity)
+				i.overflowX[0].scrollLeft = i.overflowX[0].scrollLeft + o.scrollSpeed;
+			if(e.pageX - i.overflowXOffset.left < o.scrollSensitivity)
+				i.overflowX[0].scrollLeft = i.overflowX[0].scrollLeft - o.scrollSpeed;
+		} else {
+			if(e.pageX - $(document).scrollLeft() < o.scrollSensitivity)
+				$(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
+			if($(window).width() - (e.pageX - $(document).scrollLeft()) < o.scrollSensitivity)
+				$(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
+		}
+		
+	}
+});
+
+$.ui.plugin.add("draggable", "snap", {
+	start: function(e, ui) {
+		
+		var inst = $(this).data("draggable");
+		inst.snapElements = [];
+		$(ui.options.snap === true ? '.ui-draggable' : ui.options.snap).each(function() {
+			var $t = $(this); var $o = $t.offset();
+			if(this != inst.element[0]) inst.snapElements.push({
+				item: this,
+				width: $t.outerWidth(), height: $t.outerHeight(),
+				top: $o.top, left: $o.left
+			});
+		});
+		
+	},
+	drag: function(e, ui) {
+		
+		var inst = $(this).data("draggable");
+		var d = ui.options.snapTolerance || 20;
+		var x1 = ui.absolutePosition.left, x2 = x1 + inst.helperProportions.width,
+			y1 = ui.absolutePosition.top, y2 = y1 + inst.helperProportions.height;
+		
+		for (var i = inst.snapElements.length - 1; i >= 0; i--){
+			
+			var l = inst.snapElements[i].left, r = l + inst.snapElements[i].width, 
+				t = inst.snapElements[i].top, b = t + inst.snapElements[i].height;
+			
+			//Yes, I know, this is insane ;)
+			if(!((l-d < x1 && x1 < r+d && t-d < y1 && y1 < b+d) || (l-d < x1 && x1 < r+d && t-d < y2 && y2 < b+d) || (l-d < x2 && x2 < r+d && t-d < y1 && y1 < b+d) || (l-d < x2 && x2 < r+d && t-d < y2 && y2 < b+d))) continue;
+			
+			if(ui.options.snapMode != 'inner') {
+				var ts = Math.abs(t - y2) <= 20;
+				var bs = Math.abs(b - y1) <= 20;
+				var ls = Math.abs(l - x2) <= 20;
+				var rs = Math.abs(r - x1) <= 20;
+				if(ts) ui.position.top = inst.convertPositionTo("relative", { top: t - inst.helperProportions.height, left: 0 }).top;
+				if(bs) ui.position.top = inst.convertPositionTo("relative", { top: b, left: 0 }).top;
+				if(ls) ui.position.left = inst.convertPositionTo("relative", { top: 0, left: l - inst.helperProportions.width }).left;
+				if(rs) ui.position.left = inst.convertPositionTo("relative", { top: 0, left: r }).left;
+			}
+			
+			if(ui.options.snapMode != 'outer') {
+				var ts = Math.abs(t - y1) <= 20;
+				var bs = Math.abs(b - y2) <= 20;
+				var ls = Math.abs(l - x1) <= 20;
+				var rs = Math.abs(r - x2) <= 20;
+				if(ts) ui.position.top = inst.convertPositionTo("relative", { top: t, left: 0 }).top;
+				if(bs) ui.position.top = inst.convertPositionTo("relative", { top: b - inst.helperProportions.height, left: 0 }).top;
+				if(ls) ui.position.left = inst.convertPositionTo("relative", { top: 0, left: l }).left;
+				if(rs) ui.position.left = inst.convertPositionTo("relative", { top: 0, left: r - inst.helperProportions.width }).left;
+			}
+			
+		};
+	}
+});
+
+$.ui.plugin.add("draggable", "connectToSortable", {
+	start: function(e,ui) {
+	
+		var inst = $(this).data("draggable");
+		inst.sortables = [];
+		$(ui.options.connectToSortable).each(function() {
+			if($.data(this, 'sortable')) {
+				var sortable = $.data(this, 'sortable');
+				inst.sortables.push({
+					instance: sortable,
+					shouldRevert: sortable.options.revert
+				});
+				sortable.refreshItems();	//Do a one-time refresh at start to refresh the containerCache	
+				sortable.propagate("activate", e, inst);
+			}
+		});
+
+	},
+	stop: function(e,ui) {
+		
+		//If we are still over the sortable, we fake the stop event of the sortable, but also remove helper
+		var inst = $(this).data("draggable");
+		
+		$.each(inst.sortables, function() {
+			if(this.instance.isOver) {
+				this.instance.isOver = 0;
+				inst.cancelHelperRemoval = true; //Don't remove the helper in the draggable instance
+				this.instance.cancelHelperRemoval = false; //Remove it in the sortable instance (so sortable plugins like revert still work)
+				if(this.shouldRevert) this.instance.options.revert = true; //revert here
+				this.instance.mouseStop(e);
+				
+				//Also propagate receive event, since the sortable is actually receiving a element
+				this.instance.element.triggerHandler("sortreceive", [e, $.extend(this.instance.ui(), { sender: inst.element })], this.instance.options["receive"]);
+
+				this.instance.options.helper = this.instance.options._helper;
+			} else {
+				this.instance.propagate("deactivate", e, inst);
+			}
+
+		});
+		
+	},
+	drag: function(e,ui) {
+
+		var inst = $(this).data("draggable"), self = this;
+		
+		var checkPos = function(o) {
+				
+			var l = o.left, r = l + o.width,
+				t = o.top, b = t + o.height;
+
+			return (l < (this.positionAbs.left + this.offset.click.left) && (this.positionAbs.left + this.offset.click.left) < r
+					&& t < (this.positionAbs.top + this.offset.click.top) && (this.positionAbs.top + this.offset.click.top) < b);				
+		};
+		
+		$.each(inst.sortables, function(i) {
+
+			if(checkPos.call(inst, this.instance.containerCache)) {
+
+				//If it intersects, we use a little isOver variable and set it once, so our move-in stuff gets fired only once
+				if(!this.instance.isOver) {
+					this.instance.isOver = 1;
+
+					//Now we fake the start of dragging for the sortable instance,
+					//by cloning the list group item, appending it to the sortable and using it as inst.currentItem
+					//We can then fire the start event of the sortable with our passed browser event, and our own helper (so it doesn't create a new one)
+					this.instance.currentItem = $(self).clone().appendTo(this.instance.element).data("sortable-item", true);
+					this.instance.options._helper = this.instance.options.helper; //Store helper option to later restore it
+					this.instance.options.helper = function() { return ui.helper[0]; };
+				
+					e.target = this.instance.currentItem[0];
+					this.instance.mouseCapture(e, true);
+					this.instance.mouseStart(e, true, true);
+
+					//Because the browser event is way off the new appended portlet, we modify a couple of variables to reflect the changes
+					this.instance.offset.click.top = inst.offset.click.top;
+					this.instance.offset.click.left = inst.offset.click.left;
+					this.instance.offset.parent.left -= inst.offset.parent.left - this.instance.offset.parent.left;
+					this.instance.offset.parent.top -= inst.offset.parent.top - this.instance.offset.parent.top;
+					
+					inst.propagate("toSortable", e);
+				
+				}
+				
+				//Provided we did all the previous steps, we can fire the drag event of the sortable on every draggable drag, when it intersects with the sortable
+				if(this.instance.currentItem) this.instance.mouseDrag(e);
+				
+			} else {
+				
+				//If it doesn't intersect with the sortable, and it intersected before,
+				//we fake the drag stop of the sortable, but make sure it doesn't remove the helper by using cancelHelperRemoval
+				if(this.instance.isOver) {
+					this.instance.isOver = 0;
+					this.instance.cancelHelperRemoval = true;
+					this.instance.options.revert = false; //No revert here
+					this.instance.mouseStop(e, true);
+					this.instance.options.helper = this.instance.options._helper;
+					
+					//Now we remove our currentItem, the list group clone again, and the placeholder, and animate the helper back to it's original size
+					this.instance.currentItem.remove();
+					if(this.instance.placeholder) this.instance.placeholder.remove();
+					
+					inst.propagate("fromSortable", e);
+				}
+				
+			};
+
+		});
+
+	}
+});
+
+$.ui.plugin.add("draggable", "stack", {
+	start: function(e,ui) {
+		var group = $.makeArray($(ui.options.stack.group)).sort(function(a,b) {
+			return (parseInt($(a).css("zIndex"),10) || ui.options.stack.min) - (parseInt($(b).css("zIndex"),10) || ui.options.stack.min);
+		});
+		
+		$(group).each(function(i) {
+			this.style.zIndex = ui.options.stack.min + i;
+		});
+		
+		this[0].style.zIndex = ui.options.stack.min + group.length;
+	}
+});
+
+})(jQuery);
+/*
+ * jQuery UI Droppable
+ *
+ * Copyright (c) 2008 Paul Bakaus
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ * 
+ * http://docs.jquery.com/UI/Droppables
+ *
+ * Depends:
+ *	ui.core.js
+ *	ui.draggable.js
+ */
+(function($) {
+
+$.widget("ui.droppable", {
+	init: function() {
+
+		this.element.addClass("ui-droppable");
+		this.isover = 0; this.isout = 1;
+		
+		//Prepare the passed options
+		var o = this.options, accept = o.accept;
+		o = $.extend(o, {
+			accept: o.accept && o.accept.constructor == Function ? o.accept : function(d) {
+				return $(d).is(accept);
+			}
+		});
+		
+		//Store the droppable's proportions
+		this.proportions = { width: this.element[0].offsetWidth, height: this.element[0].offsetHeight };
+		
+		// Add the reference and positions to the manager
+		$.ui.ddmanager.droppables.push(this);
+		
+	},
+	plugins: {},
+	ui: function(c) {
+		return {
+			draggable: (c.currentItem || c.element),
+			helper: c.helper,
+			position: c.position,
+			absolutePosition: c.positionAbs,
+			options: this.options,
+			element: this.element
+		};
+	},
+	destroy: function() {
+		var drop = $.ui.ddmanager.droppables;
+		for ( var i = 0; i < drop.length; i++ )
+			if ( drop[i] == this )
+				drop.splice(i, 1);
+		
+		this.element
+			.removeClass("ui-droppable ui-droppable-disabled")
+			.removeData("droppable")
+			.unbind(".droppable");
+	},
+	over: function(e) {
+		
+		var draggable = $.ui.ddmanager.current;
+		if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element
+		
+		if (this.options.accept.call(this.element,(draggable.currentItem || draggable.element))) {
+			$.ui.plugin.call(this, 'over', [e, this.ui(draggable)]);
+			this.element.triggerHandler("dropover", [e, this.ui(draggable)], this.options.over);
+		}
+		
+	},
+	out: function(e) {
+		
+		var draggable = $.ui.ddmanager.current;
+		if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element
+		
+		if (this.options.accept.call(this.element,(draggable.currentItem || draggable.element))) {
+			$.ui.plugin.call(this, 'out', [e, this.ui(draggable)]);
+			this.element.triggerHandler("dropout", [e, this.ui(draggable)], this.options.out);
+		}
+		
+	},
+	drop: function(e,custom) {
+		
+		var draggable = custom || $.ui.ddmanager.current;
+		if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return false; // Bail if draggable and droppable are same element
+		
+		var childrenIntersection = false;
+		this.element.find(".ui-droppable").not(".ui-draggable-dragging").each(function() {
+			var inst = $.data(this, 'droppable');
+			if(inst.options.greedy && $.ui.intersect(draggable, $.extend(inst, { offset: inst.element.offset() }), inst.options.tolerance)) {
+				childrenIntersection = true; return false;
+			}
+		});
+		if(childrenIntersection) return false;
+		
+		if(this.options.accept.call(this.element,(draggable.currentItem || draggable.element))) {
+			$.ui.plugin.call(this, 'drop', [e, this.ui(draggable)]);
+			this.element.triggerHandler("drop", [e, this.ui(draggable)], this.options.drop);
+			return true;
+		}
+		
+		return false;
+		
+	},
+	activate: function(e) {
+		
+		var draggable = $.ui.ddmanager.current;
+		$.ui.plugin.call(this, 'activate', [e, this.ui(draggable)]);
+		if(draggable) this.element.triggerHandler("dropactivate", [e, this.ui(draggable)], this.options.activate);
+		
+	},
+	deactivate: function(e) {
+		
+		var draggable = $.ui.ddmanager.current;
+		$.ui.plugin.call(this, 'deactivate', [e, this.ui(draggable)]);
+		if(draggable) this.element.triggerHandler("dropdeactivate", [e, this.ui(draggable)], this.options.deactivate);
+		
+	}
+});
+
+$.extend($.ui.droppable, {
+	defaults: {
+		disabled: false,
+		tolerance: 'intersect'
+	}
+});
+
+$.ui.intersect = function(draggable, droppable, toleranceMode) {
+	
+	if (!droppable.offset) return false;
+	
+	var x1 = (draggable.positionAbs || draggable.position.absolute).left, x2 = x1 + draggable.helperProportions.width,
+		y1 = (draggable.positionAbs || draggable.position.absolute).top, y2 = y1 + draggable.helperProportions.height;
+	var l = droppable.offset.left, r = l + droppable.proportions.width,
+		t = droppable.offset.top, b = t + droppable.proportions.height;
+	
+	switch (toleranceMode) {
+		case 'fit':
+			return (l < x1 && x2 < r
+				&& t < y1 && y2 < b);
+			break;
+		case 'intersect':
+			return (l < x1 + (draggable.helperProportions.width / 2) // Right Half
+				&& x2 - (draggable.helperProportions.width / 2) < r // Left Half
+				&& t < y1 + (draggable.helperProportions.height / 2) // Bottom Half
+				&& y2 - (draggable.helperProportions.height / 2) < b ); // Top Half
+			break;
+		case 'pointer':
+			return (l < ((draggable.positionAbs || draggable.position.absolute).left + (draggable.clickOffset || draggable.offset.click).left) && ((draggable.positionAbs || draggable.position.absolute).left + (draggable.clickOffset || draggable.offset.click).left) < r
+				&& t < ((draggable.positionAbs || draggable.position.absolute).top + (draggable.clickOffset || draggable.offset.click).top) && ((draggable.positionAbs || draggable.position.absolute).top + (draggable.clickOffset || draggable.offset.click).top) < b);
+			break;
+		case 'touch':
+			return (
+					(y1 >= t && y1 <= b) ||	// Top edge touching
+					(y2 >= t && y2 <= b) ||	// Bottom edge touching
+					(y1 < t && y2 > b)		// Surrounded vertically
+				) && (
+					(x1 >= l && x1 <= r) ||	// Left edge touching
+					(x2 >= l && x2 <= r) ||	// Right edge touching
+					(x1 < l && x2 > r)		// Surrounded horizontally
+				);
+			break;
+		default:
+			return false;
+			break;
+		}
+	
+};
+
+/*
+	This manager tracks offsets of draggables and droppables
+*/
+$.ui.ddmanager = {
+	current: null,
+	droppables: [],
+	prepareOffsets: function(t, e) {
+		
+		var m = $.ui.ddmanager.droppables;
+		var type = e ? e.type : null; // workaround for #2317
+
+		for (var i = 0; i < m.length; i++) {
+			if(m[i].options.disabled || (t && !m[i].options.accept.call(m[i].element,(t.currentItem || t.element)))) continue;
+			m[i].visible = m[i].element.css("display") != "none"; if(!m[i].visible) continue; //If the element is not visible, continue
+			m[i].offset = m[i].element.offset();
+			m[i].proportions = { width: m[i].element[0].offsetWidth, height: m[i].element[0].offsetHeight };
+			
+			if(type == "dragstart" || type == "sortactivate") m[i].activate.call(m[i], e); //Activate the droppable if used directly from draggables
+		}
+		
+	},
+	drop: function(draggable, e) {
+		
+		var dropped = false;
+		$.each($.ui.ddmanager.droppables, function() {
+			
+			if(!this.options) return;
+			if (!this.options.disabled && this.visible && $.ui.intersect(draggable, this, this.options.tolerance))
+				dropped = this.drop.call(this, e);
+			
+			if (!this.options.disabled && this.visible && this.options.accept.call(this.element,(draggable.currentItem || draggable.element))) {
+				this.isout = 1; this.isover = 0;
+				this.deactivate.call(this, e);
+			}
+			
+		});
+		return dropped;
+		
+	},
+	drag: function(draggable, e) {
+		
+		//If you have a highly dynamic page, you might try this option. It renders positions every time you move the mouse.
+		if(draggable.options.refreshPositions) $.ui.ddmanager.prepareOffsets(draggable, e);
+		
+		//Run through all droppables and check their positions based on specific tolerance options
+
+		$.each($.ui.ddmanager.droppables, function() {
+			
+			if(this.options.disabled || this.greedyChild || !this.visible) return;
+			var intersects = $.ui.intersect(draggable, this, this.options.tolerance);
+			
+			var c = !intersects && this.isover == 1 ? 'isout' : (intersects && this.isover == 0 ? 'isover' : null);
+			if(!c) return;
+			
+			var parentInstance;
+			if (this.options.greedy) {
+				var parent = this.element.parents('.ui-droppable:eq(0)');
+				if (parent.length) {
+					parentInstance = $.data(parent[0], 'droppable');
+					parentInstance.greedyChild = (c == 'isover' ? 1 : 0);
+				}
+			}
+			
+			// we just moved into a greedy child
+			if (parentInstance && c == 'isover') {
+				parentInstance['isover'] = 0;
+				parentInstance['isout'] = 1;
+				parentInstance.out.call(parentInstance, e);
+			}
+			
+			this[c] = 1; this[c == 'isout' ? 'isover' : 'isout'] = 0;
+			this[c == "isover" ? "over" : "out"].call(this, e);
+			
+			// we just moved out of a greedy child
+			if (parentInstance && c == 'isout') {
+				parentInstance['isout'] = 0;
+				parentInstance['isover'] = 1;
+				parentInstance.over.call(parentInstance, e);
+			}
+		});
+		
+	}
+};
+
+/*
+ * Droppable Extensions
+ */
+
+$.ui.plugin.add("droppable", "activeClass", {
+	activate: function(e, ui) {
+		$(this).addClass(ui.options.activeClass);
+	},
+	deactivate: function(e, ui) {
+		$(this).removeClass(ui.options.activeClass);
+	},
+	drop: function(e, ui) {
+		$(this).removeClass(ui.options.activeClass);
+	}
+});
+
+$.ui.plugin.add("droppable", "hoverClass", {
+	over: function(e, ui) {
+		$(this).addClass(ui.options.hoverClass);
+	},
+	out: function(e, ui) {
+		$(this).removeClass(ui.options.hoverClass);
+	},
+	drop: function(e, ui) {
+		$(this).removeClass(ui.options.hoverClass);
+	}
+});
+
+})(jQuery);
+/*
+ * jQuery UI Resizable
+ *
+ * Copyright (c) 2008 Paul Bakaus
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ * 
+ * http://docs.jquery.com/UI/Resizables
+ *
+ * Depends:
+ *	ui.core.js
+ */
+(function($) {
+
+$.widget("ui.resizable", $.extend({}, $.ui.mouse, {
+	init: function() {
+
+		var self = this, o = this.options;
+
+		var elpos = this.element.css('position');
+		
+		this.originalElement = this.element;
+		
+		// simulate .ui-resizable { position: relative; }
+		this.element.addClass("ui-resizable").css({ position: /static/.test(elpos) ? 'relative' : elpos });
+		
+		$.extend(o, {
+			_aspectRatio: !!(o.aspectRatio),
+			helper: o.helper || o.ghost || o.animate ? o.helper || 'proxy' : null,
+			knobHandles: o.knobHandles === true ? 'ui-resizable-knob-handle' : o.knobHandles
+		});
+		
+		//Default Theme
+		var aBorder = '1px solid #DEDEDE';
+		
+		o.defaultTheme = {
+			'ui-resizable': { display: 'block' },
+			'ui-resizable-handle': { position: 'absolute', background: '#F2F2F2', fontSize: '0.1px' },
+			'ui-resizable-n': { cursor: 'n-resize', height: '4px', left: '0px', right: '0px', borderTop: aBorder },
+			'ui-resizable-s': { cursor: 's-resize', height: '4px', left: '0px', right: '0px', borderBottom: aBorder },
+			'ui-resizable-e': { cursor: 'e-resize', width: '4px', top: '0px', bottom: '0px', borderRight: aBorder },
+			'ui-resizable-w': { cursor: 'w-resize', width: '4px', top: '0px', bottom: '0px', borderLeft: aBorder },
+			'ui-resizable-se': { cursor: 'se-resize', width: '4px', height: '4px', borderRight: aBorder, borderBottom: aBorder },
+			'ui-resizable-sw': { cursor: 'sw-resize', width: '4px', height: '4px', borderBottom: aBorder, borderLeft: aBorder },
+			'ui-resizable-ne': { cursor: 'ne-resize', width: '4px', height: '4px', borderRight: aBorder, borderTop: aBorder },
+			'ui-resizable-nw': { cursor: 'nw-resize', width: '4px', height: '4px', borderLeft: aBorder, borderTop: aBorder }
+		};
+		
+		o.knobTheme = {
+			'ui-resizable-handle': { background: '#F2F2F2', border: '1px solid #808080', height: '8px', width: '8px' },
+			'ui-resizable-n': { cursor: 'n-resize', top: '0px', left: '45%' },
+			'ui-resizable-s': { cursor: 's-resize', bottom: '0px', left: '45%' },
+			'ui-resizable-e': { cursor: 'e-resize', right: '0px', top: '45%' },
+			'ui-resizable-w': { cursor: 'w-resize', left: '0px', top: '45%' },
+			'ui-resizable-se': { cursor: 'se-resize', right: '0px', bottom: '0px' },
+			'ui-resizable-sw': { cursor: 'sw-resize', left: '0px', bottom: '0px' },
+			'ui-resizable-nw': { cursor: 'nw-resize', left: '0px', top: '0px' },
+			'ui-resizable-ne': { cursor: 'ne-resize', right: '0px', top: '0px' }
+		};
+		
+		o._nodeName = this.element[0].nodeName;
+		
+		//Wrap the element if it cannot hold child nodes
+		if(o._nodeName.match(/canvas|textarea|input|select|button|img/i)) {
+			var el = this.element;
+			
+			//Opera fixing relative position
+			if (/relative/.test(el.css('position')) && $.browser.opera)
+				el.css({ position: 'relative', top: 'auto', left: 'auto' });
+			
+			//Create a wrapper element and set the wrapper to the new current internal element
+			el.wrap(
+				$('<div class="ui-wrapper"	style="overflow: hidden;"></div>').css( {
+					position: el.css('position'),
+					width: el.outerWidth(),
+					height: el.outerHeight(),
+					top: el.css('top'),
+					left: el.css('left')
+				})
+			);
+			
+			var oel = this.element; this.element = this.element.parent();
+			
+			// store instance on wrapper
+			this.element.data('resizable', this); 
+			
+			//Move margins to the wrapper
+			this.element.css({ marginLeft: oel.css("marginLeft"), marginTop: oel.css("marginTop"),
+				marginRight: oel.css("marginRight"), marginBottom: oel.css("marginBottom")
+			});
+			
+			oel.css({ marginLeft: 0, marginTop: 0, marginRight: 0, marginBottom: 0});
+			
+			//Prevent Safari textarea resize
+			if ($.browser.safari && o.preventDefault) oel.css('resize', 'none');
+			
+			o.proportionallyResize = oel.css({ position: 'static', zoom: 1, display: 'block' });
+			
+			// avoid IE jump
+			this.element.css({ margin: oel.css('margin') });
+			
+			// fix handlers offset
+			this._proportionallyResize();
+		}
+		
+		if(!o.handles) o.handles = !$('.ui-resizable-handle', this.element).length ? "e,s,se" : { n: '.ui-resizable-n', e: '.ui-resizable-e', s: '.ui-resizable-s', w: '.ui-resizable-w', se: '.ui-resizable-se', sw: '.ui-resizable-sw', ne: '.ui-resizable-ne', nw: '.ui-resizable-nw' };
+		if(o.handles.constructor == String) {
+			
+			o.zIndex = o.zIndex || 1000;
+			
+			if(o.handles == 'all') o.handles = 'n,e,s,w,se,sw,ne,nw';
+			
+			var n = o.handles.split(","); o.handles = {};
+			
+			// insertions are applied when don't have theme loaded
+			var insertionsDefault = {
+				handle: 'position: absolute; display: none; overflow:hidden;',
+				n: 'top: 0pt; width:100%;',
+				e: 'right: 0pt; height:100%;',
+				s: 'bottom: 0pt; width:100%;',
+				w: 'left: 0pt; height:100%;',
+				se: 'bottom: 0pt; right: 0px;',
+				sw: 'bottom: 0pt; left: 0px;',
+				ne: 'top: 0pt; right: 0px;',
+				nw: 'top: 0pt; left: 0px;'
+			};
+			
+			for(var i = 0; i < n.length; i++) {
+				var handle = $.trim(n[i]), dt = o.defaultTheme, hname = 'ui-resizable-'+handle, loadDefault = !$.ui.css(hname) && !o.knobHandles, userKnobClass = $.ui.css('ui-resizable-knob-handle'), 
+							allDefTheme = $.extend(dt[hname], dt['ui-resizable-handle']), allKnobTheme = $.extend(o.knobTheme[hname], !userKnobClass ? o.knobTheme['ui-resizable-handle'] : {});
+				
+				// increase zIndex of sw, se, ne, nw axis
+				var applyZIndex = /sw|se|ne|nw/.test(handle) ? { zIndex: ++o.zIndex } : {};
+				
+				var defCss = (loadDefault ? insertionsDefault[handle] : ''), 
+					axis = $(['<div class="ui-resizable-handle ', hname, '" style="', defCss, insertionsDefault.handle, '"></div>'].join('')).css( applyZIndex );
+				o.handles[handle] = '.ui-resizable-'+handle;
+				
+				this.element.append(
+					//Theme detection, if not loaded, load o.defaultTheme
+					axis.css( loadDefault ? allDefTheme : {} )
+						// Load the knobHandle css, fix width, height, top, left...
+						.css( o.knobHandles ? allKnobTheme : {} ).addClass(o.knobHandles ? 'ui-resizable-knob-handle' : '').addClass(o.knobHandles)
+				);
+			}
+			
+			if (o.knobHandles) this.element.addClass('ui-resizable-knob').css( !$.ui.css('ui-resizable-knob') ? { /*border: '1px #fff dashed'*/ } : {} );
+		}
+		
+		this._renderAxis = function(target) {
+			target = target || this.element;
+			
+			for(var i in o.handles) {
+				if(o.handles[i].constructor == String) 
+					o.handles[i] = $(o.handles[i], this.element).show();
+				
+				if (o.transparent)
+					o.handles[i].css({opacity:0});
+				
+				//Apply pad to wrapper element, needed to fix axis position (textarea, inputs, scrolls)
+				if (this.element.is('.ui-wrapper') && 
+					o._nodeName.match(/textarea|input|select|button/i)) {
+					
+					var axis = $(o.handles[i], this.element), padWrapper = 0;
+					
+					//Checking the correct pad and border
+					padWrapper = /sw|ne|nw|se|n|s/.test(i) ? axis.outerHeight() : axis.outerWidth();
+					
+					//The padding type i have to apply...
+					var padPos = [ 'padding', 
+						/ne|nw|n/.test(i) ? 'Top' :
+						/se|sw|s/.test(i) ? 'Bottom' : 
+						/^e$/.test(i) ? 'Right' : 'Left' ].join(""); 
+					
+					if (!o.transparent)
+						target.css(padPos, padWrapper);
+					
+					this._proportionallyResize();
+				}
+				if(!$(o.handles[i]).length) continue;
+			}
+		};
+		
+		this._renderAxis(this.element);
+		o._handles = $('.ui-resizable-handle', self.element);
+		
+		if (o.disableSelection)
+			o._handles.each(function(i, e) { $.ui.disableSelection(e); });
+		
+		//Matching axis name
+		o._handles.mouseover(function() {
+			if (!o.resizing) {
+				if (this.className) 
+					var axis = this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);
+				//Axis, default = se
+				self.axis = o.axis = axis && axis[1] ? axis[1] : 'se';
+			}
+		});
+		
+		//If we want to auto hide the elements
+		if (o.autoHide) {
+			o._handles.hide();
+			$(self.element).addClass("ui-resizable-autohide").hover(function() {
+				$(this).removeClass("ui-resizable-autohide");
+				o._handles.show();
+			},
+			function(){
+				if (!o.resizing) {
+					$(this).addClass("ui-resizable-autohide");
+					o._handles.hide();
+				}
+			});
+		}
+		
+		this.mouseInit();
+	},
+	plugins: {},
+	ui: function() {
+		return {
+			originalElement: this.originalElement,
+			element: this.element,
+			helper: this.helper,
+			position: this.position,
+			size: this.size,
+			options: this.options,
+			originalSize: this.originalSize,
+			originalPosition: this.originalPosition
+		};
+	},
+	propagate: function(n,e) {
+		$.ui.plugin.call(this, n, [e, this.ui()]);
+		if (n != "resize") this.element.triggerHandler(["resize", n].join(""), [e, this.ui()], this.options[n]);
+	},
+	destroy: function() {
+		var el = this.element, wrapped = el.children(".ui-resizable").get(0);
+		
+		this.mouseDestroy();
+		
+		var _destroy = function(exp) {
+			$(exp).removeClass("ui-resizable ui-resizable-disabled")
+				.removeData("resizable").unbind(".resizable").find('.ui-resizable-handle').remove();
+		};
+		
+		_destroy(el);
+		
+		if (el.is('.ui-wrapper') && wrapped) {
+			el.parent().append(
+				$(wrapped).css({
+					position: el.css('position'),
+					width: el.outerWidth(),
+					height: el.outerHeight(),
+					top: el.css('top'),
+					left: el.css('left')
+				})
+			).end().remove();
+			
+			_destroy(wrapped);
+		}
+	},
+	mouseStart: function(e) {
+		if(this.options.disabled) return false;
+		
+		var handle = false;
+		for(var i in this.options.handles) {
+			if($(this.options.handles[i])[0] == e.target) handle = true;
+		}
+		if (!handle) return false;
+		
+		var o = this.options, iniPos = this.element.position(), el = this.element, 
+			num = function(v) { return parseInt(v, 10) || 0; }, ie6 = $.browser.msie && $.browser.version < 7;
+		o.resizing = true;
+		o.documentScroll = { top: $(document).scrollTop(), left: $(document).scrollLeft() };
+		
+		// bugfix #1749
+		if (el.is('.ui-draggable') || (/absolute/).test(el.css('position'))) {
+			
+			// sOffset decides if document scrollOffset will be added to the top/left of the resizable element
+			var sOffset = $.browser.msie && !o.containment && (/absolute/).test(el.css('position')) && !(/relative/).test(el.parent().css('position'));
+			var dscrollt = sOffset ? o.documentScroll.top : 0, dscrolll = sOffset ? o.documentScroll.left : 0;
+			
+			el.css({ position: 'absolute', top: (iniPos.top + dscrollt), left: (iniPos.left + dscrolll) });
+		}
+		
+		//Opera fixing relative position
+		if ($.browser.opera && /relative/.test(el.css('position')))
+			el.css({ position: 'relative', top: 'auto', left: 'auto' });
+		
+		this._renderProxy();
+		
+		var curleft = num(this.helper.css('left')), curtop = num(this.helper.css('top'));
+		
+		if (o.containment) {
+			curleft += $(o.containment).scrollLeft()||0;
+			curtop += $(o.containment).scrollTop()||0;
+		}
+		
+		//Store needed variables
+		this.offset = this.helper.offset();
+		this.position = { left: curleft, top: curtop };
+		this.size = o.helper || ie6 ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() };
+		this.originalSize = o.helper || ie6 ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() };
+		this.originalPosition = { left: curleft, top: curtop };
+		this.sizeDiff = { width: el.outerWidth() - el.width(), height: el.outerHeight() - el.height() };
+		this.originalMousePosition = { left: e.pageX, top: e.pageY };
+		
+		//Aspect Ratio
+		o.aspectRatio = (typeof o.aspectRatio == 'number') ? o.aspectRatio : ((this.originalSize.height / this.originalSize.width)||1);
+		
+		if (o.preserveCursor)
+			$('body').css('cursor', this.axis + '-resize');
+			
+		this.propagate("start", e);
+		return true;
+	},
+	mouseDrag: function(e) {
+		
+		//Increase performance, avoid regex
+		var el = this.helper, o = this.options, props = {},
+			self = this, smp = this.originalMousePosition, a = this.axis;
+		
+		var dx = (e.pageX-smp.left)||0, dy = (e.pageY-smp.top)||0;
+		var trigger = this._change[a];
+		if (!trigger) return false;
+		
+		// Calculate the attrs that will be change
+		var data = trigger.apply(this, [e, dx, dy]), ie6 = $.browser.msie && $.browser.version < 7, csdif = this.sizeDiff;
+		
+		if (o._aspectRatio || e.shiftKey)
+			data = this._updateRatio(data, e);
+		
+		data = this._respectSize(data, e);
+		
+		// plugins callbacks need to be called first
+		this.propagate("resize", e);
+		
+		el.css({
+			top: this.position.top + "px", left: this.position.left + "px", 
+			width: this.size.width + "px", height: this.size.height + "px"
+		});
+		
+		if (!o.helper && o.proportionallyResize)
+			this._proportionallyResize();
+		
+		this._updateCache(data);
+		
+		// calling the user callback at the end
+		this.element.triggerHandler("resize", [e, this.ui()], this.options["resize"]);
+		
+		return false;
+	},
+	mouseStop: function(e) {
+		
+		this.options.resizing = false;
+		var o = this.options, num = function(v) { return parseInt(v, 10) || 0; }, self = this;
+		
+		if(o.helper) {
+			var pr = o.proportionallyResize, ista = pr && (/textarea/i).test(pr.get(0).nodeName), 
+						soffseth = ista && $.ui.hasScroll(pr.get(0), 'left') /* TODO - jump height */ ? 0 : self.sizeDiff.height,
+							soffsetw = ista ? 0 : self.sizeDiff.width;
+			
+			var s = { width: (self.size.width - soffsetw), height: (self.size.height - soffseth) },
+				left = (parseInt(self.element.css('left'), 10) + (self.position.left - self.originalPosition.left)) || null, 
+				top = (parseInt(self.element.css('top'), 10) + (self.position.top - self.originalPosition.top)) || null;
+			
+			if (!o.animate)
+				this.element.css($.extend(s, { top: top, left: left }));
+			
+			if (o.helper && !o.animate) this._proportionallyResize();
+		}
+		
+		if (o.preserveCursor)
+			$('body').css('cursor', 'auto');
+		
+		this.propagate("stop", e);
+		
+		if (o.helper) this.helper.remove();
+		
+		return false;
+	},
+	_updateCache: function(data) {
+		var o = this.options;
+		this.offset = this.helper.offset();
+		if (data.left) this.position.left = data.left;
+		if (data.top) this.position.top = data.top;
+		if (data.height) this.size.height = data.height;
+		if (data.width) this.size.width = data.width;
+	},
+	_updateRatio: function(data, e) {
+		var o = this.options, cpos = this.position, csize = this.size, a = this.axis;
+		
+		if (data.height) data.width = (csize.height / o.aspectRatio);
+		else if (data.width) data.height = (csize.width * o.aspectRatio);
+		
+		if (a == 'sw') {
+			data.left = cpos.left + (csize.width - data.width);
+			data.top = null;
+		}
+		if (a == 'nw') { 
+			data.top = cpos.top + (csize.height - data.height);
+			data.left = cpos.left + (csize.width - data.width);
+		}
+		
+		return data;
+	},
+	_respectSize: function(data, e) {
+		
+		var el = this.helper, o = this.options, pRatio = o._aspectRatio || e.shiftKey, a = this.axis, 
+				ismaxw = data.width && o.maxWidth && o.maxWidth < data.width, ismaxh = data.height && o.maxHeight && o.maxHeight < data.height,
+					isminw = data.width && o.minWidth && o.minWidth > data.width, isminh = data.height && o.minHeight && o.minHeight > data.height;
+		
+		if (isminw) data.width = o.minWidth;
+		if (isminh) data.height = o.minHeight;
+		if (ismaxw) data.width = o.maxWidth;
+		if (ismaxh) data.height = o.maxHeight;
+		
+		var dw = this.originalPosition.left + this.originalSize.width, dh = this.position.top + this.size.height;
+		var cw = /sw|nw|w/.test(a), ch = /nw|ne|n/.test(a);
+		
+		if (isminw && cw) data.left = dw - o.minWidth;
+		if (ismaxw && cw) data.left = dw - o.maxWidth;
+		if (isminh && ch)	data.top = dh - o.minHeight;
+		if (ismaxh && ch)	data.top = dh - o.maxHeight;
+		
+		// fixing jump error on top/left - bug #2330
+		var isNotwh = !data.width && !data.height;
+		if (isNotwh && !data.left && data.top) data.top = null;
+		else if (isNotwh && !data.top && data.left) data.left = null;
+		
+		return data;
+	},
+	_proportionallyResize: function() {
+		var o = this.options;
+		if (!o.proportionallyResize) return;
+		var prel = o.proportionallyResize, el = this.helper || this.element;
+		
+		if (!o.borderDif) {
+			var b = [prel.css('borderTopWidth'), prel.css('borderRightWidth'), prel.css('borderBottomWidth'), prel.css('borderLeftWidth')],
+				p = [prel.css('paddingTop'), prel.css('paddingRight'), prel.css('paddingBottom'), prel.css('paddingLeft')];
+			
+			o.borderDif = $.map(b, function(v, i) {
+				var border = parseInt(v,10)||0, padding = parseInt(p[i],10)||0;
+				return border + padding; 
+			});
+		}
+		prel.css({
+			height: (el.height() - o.borderDif[0] - o.borderDif[2]) + "px",
+			width: (el.width() - o.borderDif[1] - o.borderDif[3]) + "px"
+		});
+	},
+	_renderProxy: function() {
+		var el = this.element, o = this.options;
+		this.elementOffset = el.offset();
+		
+		if(o.helper) {
+			this.helper = this.helper || $('<div style="overflow:hidden;"></div>');
+			
+			// fix ie6 offset
+			var ie6 = $.browser.msie && $.browser.version < 7, ie6offset = (ie6 ? 1 : 0),
+			pxyoffset = ( ie6 ? 2 : -1 );
+			
+			this.helper.addClass(o.helper).css({
+				width: el.outerWidth() + pxyoffset,
+				height: el.outerHeight() + pxyoffset,
+				position: 'absolute',
+				left: this.elementOffset.left - ie6offset +'px',
+				top: this.elementOffset.top - ie6offset +'px',
+				zIndex: ++o.zIndex
+			});
+			
+			this.helper.appendTo("body");
+			
+			if (o.disableSelection)
+				$.ui.disableSelection(this.helper.get(0));
+			
+		} else {
+			this.helper = el; 
+		}
+	},
+	_change: {
+		e: function(e, dx, dy) {
+			return { width: this.originalSize.width + dx };
+		},
+		w: function(e, dx, dy) {
+			var o = this.options, cs = this.originalSize, sp = this.originalPosition;
+			return { left: sp.left + dx, width: cs.width - dx };
+		},
+		n: function(e, dx, dy) {
+			var o = this.options, cs = this.originalSize, sp = this.originalPosition;
+			return { top: sp.top + dy, height: cs.height - dy };
+		},
+		s: function(e, dx, dy) {
+			return { height: this.originalSize.height + dy };
+		},
+		se: function(e, dx, dy) {
+			return $.extend(this._change.s.apply(this, arguments), this._change.e.apply(this, [e, dx, dy]));
+		},
+		sw: function(e, dx, dy) {
+			return $.extend(this._change.s.apply(this, arguments), this._change.w.apply(this, [e, dx, dy]));
+		},
+		ne: function(e, dx, dy) {
+			return $.extend(this._change.n.apply(this, arguments), this._change.e.apply(this, [e, dx, dy]));
+		},
+		nw: function(e, dx, dy) {
+			return $.extend(this._change.n.apply(this, arguments), this._change.w.apply(this, [e, dx, dy]));
+		}
+	}
+}));
+
+$.extend($.ui.resizable, {
+	defaults: {
+		cancel: ":input",
+		distance: 1,
+		delay: 0,
+		preventDefault: true,
+		transparent: false,
+		minWidth: 10,
+		minHeight: 10,
+		aspectRatio: false,
+		disableSelection: true,
+		preserveCursor: true,
+		autoHide: false,
+		knobHandles: false
+	}
+});
+
+/*
+ * Resizable Extensions
+ */
+
+$.ui.plugin.add("resizable", "containment", {
+	
+	start: function(e, ui) {
+		var o = ui.options, self = $(this).data("resizable"), el = self.element;
+		var oc = o.containment,	ce = (oc instanceof $) ? oc.get(0) : (/parent/.test(oc)) ? el.parent().get(0) : oc;
+		if (!ce) return;
+		
+		self.containerElement = $(ce);
+		
+		if (/document/.test(oc) || oc == document) {
+			self.containerOffset = { left: 0, top: 0 };
+			self.containerPosition = { left: 0, top: 0 };
+			
+			self.parentData = { 
+				element: $(document), left: 0, top: 0, 
+				width: $(document).width(), height: $(document).height() || document.body.parentNode.scrollHeight
+			};
+		}
+		
+				
+		// i'm a node, so compute top, left, right, bottom
+		else{
+			self.containerOffset = $(ce).offset();
+			self.containerPosition = $(ce).position();
+			self.containerSize = { height: $(ce).innerHeight(), width: $(ce).innerWidth() };
+		
+			var co = self.containerOffset, ch = self.containerSize.height,	cw = self.containerSize.width, 
+						width = ($.ui.hasScroll(ce, "left") ? ce.scrollWidth : cw ), height = ($.ui.hasScroll(ce) ? ce.scrollHeight : ch);
+		
+			self.parentData = { 
+				element: ce, left: co.left, top: co.top, width: width, height: height
+			};
+		}
+	},
+	
+	resize: function(e, ui) {
+		var o = ui.options, self = $(this).data("resizable"), 
+				ps = self.containerSize, co = self.containerOffset, cs = self.size, cp = self.position,
+				pRatio = o._aspectRatio || e.shiftKey, cop = { top:0, left:0 }, ce = self.containerElement;
+		
+		if (ce[0] != document && /static/.test(ce.css('position')))
+			cop = self.containerPosition;
+		
+		if (cp.left < (o.helper ? co.left : cop.left)) {
+			self.size.width = self.size.width + (o.helper ? (self.position.left - co.left) : (self.position.left - cop.left));
+			if (pRatio) self.size.height = self.size.width * o.aspectRatio;
+			self.position.left = o.helper ? co.left : cop.left;
+		}
+		
+		if (cp.top < (o.helper ? co.top : 0)) {
+			self.size.height = self.size.height + (o.helper ? (self.position.top - co.top) : self.position.top);
+			if (pRatio) self.size.width = self.size.height / o.aspectRatio;
+			self.position.top = o.helper ? co.top : 0;
+		}
+		
+		var woset = (o.helper ? self.offset.left - co.left : (self.position.left - cop.left)) + self.sizeDiff.width, 
+					hoset = (o.helper ? self.offset.top - co.top : self.position.top) + self.sizeDiff.height;
+		
+		if (woset + self.size.width >= self.parentData.width) {
+			self.size.width = self.parentData.width - woset;
+			if (pRatio) self.size.height = self.size.width * o.aspectRatio;
+		}
+		
+		if (hoset + self.size.height >= self.parentData.height) {
+			self.size.height = self.parentData.height - hoset;
+			if (pRatio) self.size.width = self.size.height / o.aspectRatio;
+		}
+	},
+	
+	stop: function(e, ui){
+		var o = ui.options, self = $(this).data("resizable"), cp = self.position,
+				co = self.containerOffset, cop = self.containerPosition, ce = self.containerElement;
+		
+		var helper = $(self.helper), ho = helper.offset(), w = helper.innerWidth(), h = helper.innerHeight();
+		
+		
+		if (o.helper && !o.animate && /relative/.test(ce.css('position')))
+			$(this).css({ left: (ho.left - co.left), top: (ho.top - co.top), width: w, height: h });
+		
+		if (o.helper && !o.animate && /static/.test(ce.css('position')))
+			$(this).css({ left: cop.left + (ho.left - co.left), top: cop.top + (ho.top - co.top), width: w, height: h });
+		
+	}
+});
+
+$.ui.plugin.add("resizable", "grid", {
+	
+	resize: function(e, ui) {
+		var o = ui.options, self = $(this).data("resizable"), cs = self.size, os = self.originalSize, op = self.originalPosition, a = self.axis, ratio = o._aspectRatio || e.shiftKey;
+		o.grid = typeof o.grid == "number" ? [o.grid, o.grid] : o.grid;
+		var ox = Math.round((cs.width - os.width) / (o.grid[0]||1)) * (o.grid[0]||1), oy = Math.round((cs.height - os.height) / (o.grid[1]||1)) * (o.grid[1]||1);
+		
+		if (/^(se|s|e)$/.test(a)) {
+			self.size.width = os.width + ox;
+			self.size.height = os.height + oy;
+		}
+		else if (/^(ne)$/.test(a)) {
+			self.size.width = os.width + ox;
+			self.size.height = os.height + oy;
+			self.position.top = op.top - oy;
+		}
+		else if (/^(sw)$/.test(a)) {
+			self.size.width = os.width + ox;
+			self.size.height = os.height + oy;
+			self.position.left = op.left - ox;
+		}
+		else {
+			self.size.width = os.width + ox;
+			self.size.height = os.height + oy;
+			self.position.top = op.top - oy;
+			self.position.left = op.left - ox;
+		}
+	}
+	
+});
+
+$.ui.plugin.add("resizable", "animate", {
+	
+	stop: function(e, ui) {
+		var o = ui.options, self = $(this).data("resizable");
+		
+		var pr = o.proportionallyResize, ista = pr && (/textarea/i).test(pr.get(0).nodeName), 
+						soffseth = ista && $.ui.hasScroll(pr.get(0), 'left') /* TODO - jump height */ ? 0 : self.sizeDiff.height,
+							soffsetw = ista ? 0 : self.sizeDiff.width;
+		
+		var style = { width: (self.size.width - soffsetw), height: (self.size.height - soffseth) },
+					left = (parseInt(self.element.css('left'), 10) + (self.position.left - self.originalPosition.left)) || null, 
+						top = (parseInt(self.element.css('top'), 10) + (self.position.top - self.originalPosition.top)) || null; 
+		
+		self.element.animate(
+			$.extend(style, top && left ? { top: top, left: left } : {}), { 
+				duration: o.animateDuration || "slow", easing: o.animateEasing || "swing", 
+				step: function() {
+					
+					var data = {
+						width: parseInt(self.element.css('width'), 10),
+						height: parseInt(self.element.css('height'), 10),
+						top: parseInt(self.element.css('top'), 10),
+						left: parseInt(self.element.css('left'), 10)
+					};
+					
+					if (pr) pr.css({ width: data.width, height: data.height });
+					
+					// propagating resize, and updating values for each animation step
+					self._updateCache(data);
+					self.propagate("animate", e);
+					
+				}
+			}
+		);
+	}
+	
+});
+
+$.ui.plugin.add("resizable", "ghost", {
+	
+	start: function(e, ui) {
+		var o = ui.options, self = $(this).data("resizable"), pr = o.proportionallyResize, cs = self.size;
+		
+		if (!pr) self.ghost = self.element.clone();
+		else self.ghost = pr.clone();
+		
+		self.ghost.css(
+			{ opacity: .25, display: 'block', position: 'relative', height: cs.height, width: cs.width, margin: 0, left: 0, top: 0 }
+		)
+		.addClass('ui-resizable-ghost').addClass(typeof o.ghost == 'string' ? o.ghost : '');
+		
+		self.ghost.appendTo(self.helper);
+		
+	},
+	
+	resize: function(e, ui){
+		var o = ui.options, self = $(this).data("resizable"), pr = o.proportionallyResize;
+		
+		if (self.ghost) self.ghost.css({ position: 'relative', height: self.size.height, width: self.size.width });
+		
+	},
+	
+	stop: function(e, ui){
+		var o = ui.options, self = $(this).data("resizable"), pr = o.proportionallyResize;
+		if (self.ghost && self.helper) self.helper.get(0).removeChild(self.ghost.get(0));
+	}
+	
+});
+
+$.ui.plugin.add("resizable", "alsoResize", {
+	
+	start: function(e, ui) {
+		var o = ui.options, self = $(this).data("resizable"), 
+		
+		_store = function(exp) {
+			$(exp).each(function() {
+				$(this).data("resizable-alsoresize", {
+					width: parseInt($(this).width(), 10), height: parseInt($(this).height(), 10),
+					left: parseInt($(this).css('left'), 10), top: parseInt($(this).css('top'), 10)
+				});
+			});
+		};
+		
+		if (typeof(o.alsoResize) == 'object') {
+			if (o.alsoResize.length) { o.alsoResize = o.alsoResize[0];	_store(o.alsoResize); }
+			else { $.each(o.alsoResize, function(exp, c) { _store(exp); }); }
+		}else{
+			_store(o.alsoResize);
+		} 
+	},
+	
+	resize: function(e, ui){
+		var o = ui.options, self = $(this).data("resizable"), os = self.originalSize, op = self.originalPosition;
+		
+		var delta = { 
+			height: (self.size.height - os.height) || 0, width: (self.size.width - os.width) || 0,
+			top: (self.position.top - op.top) || 0, left: (self.position.left - op.left) || 0
+		},
+		
+		_alsoResize = function(exp, c) {
+			$(exp).each(function() {
+				var start = $(this).data("resizable-alsoresize"), style = {}, css = c && c.length ? c : ['width', 'height', 'top', 'left'];
+				
+				$.each(css || ['width', 'height', 'top', 'left'], function(i, prop) {
+					var sum = (start[prop]||0) + (delta[prop]||0);
+					if (sum && sum >= 0)
+						style[prop] = sum || null;
+				});
+				$(this).css(style);
+			});
+		};
+		
+		if (typeof(o.alsoResize) == 'object') {
+			$.each(o.alsoResize, function(exp, c) { _alsoResize(exp, c); });
+		}else{
+			_alsoResize(o.alsoResize);
+		}
+	},
+	
+	stop: function(e, ui){
+		$(this).removeData("resizable-alsoresize-start");
+	}
+});
+
+})(jQuery);
+/*
+ * jQuery UI Selectable
+ *
+ * Copyright (c) 2008 Richard D. Worth (rdworth.org)
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ * 
+ * http://docs.jquery.com/UI/Selectables
+ *
+ * Depends:
+ *	ui.core.js
+ */
+(function($) {
+
+$.widget("ui.selectable", $.extend({}, $.ui.mouse, {
+	init: function() {
+		var self = this;
+		
+		this.element.addClass("ui-selectable");
+		
+		this.dragged = false;
+
+		// cache selectee children based on filter
+		var selectees;
+		this.refresh = function() {
+			selectees = $(self.options.filter, self.element[0]);
+			selectees.each(function() {
+				var $this = $(this);
+				var pos = $this.offset();
+				$.data(this, "selectable-item", {
+					element: this,
+					$element: $this,
+					left: pos.left,
+					top: pos.top,
+					right: pos.left + $this.width(),
+					bottom: pos.top + $this.height(),
+					startselected: false,
+					selected: $this.hasClass('ui-selected'),
+					selecting: $this.hasClass('ui-selecting'),
+					unselecting: $this.hasClass('ui-unselecting')
+				});
+			});
+		};
+		this.refresh();
+
+		this.selectees = selectees.addClass("ui-selectee");
+		
+		this.mouseInit();
+		
+		this.helper = $(document.createElement('div')).css({border:'1px dotted black'});
+	},
+	toggle: function() {
+		if(this.options.disabled){
+			this.enable();
+		} else {
+			this.disable();
+		}
+	},
+	destroy: function() {
+		this.element
+			.removeClass("ui-selectable ui-selectable-disabled")
+			.removeData("selectable")
+			.unbind(".selectable");
+		this.mouseDestroy();
+	},
+	mouseStart: function(e) {
+		var self = this;
+		
+		this.opos = [e.pageX, e.pageY];
+		
+		if (this.options.disabled)
+			return;
+
+		var options = this.options;
+
+		this.selectees = $(options.filter, this.element[0]);
+
+		// selectable START callback
+		this.element.triggerHandler("selectablestart", [e, {
+			"selectable": this.element[0],
+			"options": options
+		}], options.start);
+
+		$('body').append(this.helper);
+		// position helper (lasso)
+		this.helper.css({
+			"z-index": 100,
+			"position": "absolute",
+			"left": e.clientX,
+			"top": e.clientY,
+			"width": 0,
+			"height": 0
+		});
+
+		if (options.autoRefresh) {
+			this.refresh();
+		}
+
+		this.selectees.filter('.ui-selected').each(function() {
+			var selectee = $.data(this, "selectable-item");
+			selectee.startselected = true;
+			if (!e.ctrlKey) {
+				selectee.$element.removeClass('ui-selected');
+				selectee.selected = false;
+				selectee.$element.addClass('ui-unselecting');
+				selectee.unselecting = true;
+				// selectable UNSELECTING callback
+				self.element.triggerHandler("selectableunselecting", [e, {
+					selectable: self.element[0],
+					unselecting: selectee.element,
+					options: options
+				}], options.unselecting);
+			}
+		});
+		
+		var isSelectee = false;
+		$(e.target).parents().andSelf().each(function() {
+			if($.data(this, "selectable-item")) isSelectee = true;
+		});
+		return this.options.keyboard ? !isSelectee : true;
+	},
+	mouseDrag: function(e) {
+		var self = this;
+		this.dragged = true;
+		
+		if (this.options.disabled)
+			return;
+
+		var options = this.options;
+
+		var x1 = this.opos[0], y1 = this.opos[1], x2 = e.pageX, y2 = e.pageY;
+		if (x1 > x2) { var tmp = x2; x2 = x1; x1 = tmp; }
+		if (y1 > y2) { var tmp = y2; y2 = y1; y1 = tmp; }
+		this.helper.css({left: x1, top: y1, width: x2-x1, height: y2-y1});
+
+		this.selectees.each(function() {
+			var selectee = $.data(this, "selectable-item");
+			//prevent helper from being selected if appendTo: selectable
+			if (!selectee || selectee.element == self.element[0])
+				return;
+			var hit = false;
+			if (options.tolerance == 'touch') {
+				hit = ( !(selectee.left > x2 || selectee.right < x1 || selectee.top > y2 || selectee.bottom < y1) );
+			} else if (options.tolerance == 'fit') {
+				hit = (selectee.left > x1 && selectee.right < x2 && selectee.top > y1 && selectee.bottom < y2);
+			}
+
+			if (hit) {
+				// SELECT
+				if (selectee.selected) {
+					selectee.$element.removeClass('ui-selected');
+					selectee.selected = false;
+				}
+				if (selectee.unselecting) {
+					selectee.$element.removeClass('ui-unselecting');
+					selectee.unselecting = false;
+				}
+				if (!selectee.selecting) {
+					selectee.$element.addClass('ui-selecting');
+					selectee.selecting = true;
+					// selectable SELECTING callback
+					self.element.triggerHandler("selectableselecting", [e, {
+						selectable: self.element[0],
+						selecting: selectee.element,
+						options: options
+					}], options.selecting);
+				}
+			} else {
+				// UNSELECT
+				if (selectee.selecting) {
+					if (e.ctrlKey && selectee.startselected) {
+						selectee.$element.removeClass('ui-selecting');
+						selectee.selecting = false;
+						selectee.$element.addClass('ui-selected');
+						selectee.selected = true;
+					} else {
+						selectee.$element.removeClass('ui-selecting');
+						selectee.selecting = false;
+						if (selectee.startselected) {
+							selectee.$element.addClass('ui-unselecting');
+							selectee.unselecting = true;
+						}
+						// selectable UNSELECTING callback
+						self.element.triggerHandler("selectableunselecting", [e, {
+							selectable: self.element[0],
+							unselecting: selectee.element,
+							options: options
+						}], options.unselecting);
+					}
+				}
+				if (selectee.selected) {
+					if (!e.ctrlKey && !selectee.startselected) {
+						selectee.$element.removeClass('ui-selected');
+						selectee.selected = false;
+
+						selectee.$element.addClass('ui-unselecting');
+						selectee.unselecting = true;
+						// selectable UNSELECTING callback
+						self.element.triggerHandler("selectableunselecting", [e, {
+							selectable: self.element[0],
+							unselecting: selectee.element,
+							options: options
+						}], options.unselecting);
+					}
+				}
+			}
+		});
+		
+		return false;
+	},
+	mouseStop: function(e) {
+		var self = this;
+		
+		this.dragged = false;
+		
+		var options = this.options;
+
+		$('.ui-unselecting', this.element[0]).each(function() {
+			var selectee = $.data(this, "selectable-item");
+			selectee.$element.removeClass('ui-unselecting');
+			selectee.unselecting = false;
+			selectee.startselected = false;
+			self.element.triggerHandler("selectableunselected", [e, {
+				selectable: self.element[0],
+				unselected: selectee.element,
+				options: options
+			}], options.unselected);
+		});
+		$('.ui-selecting', this.element[0]).each(function() {
+			var selectee = $.data(this, "selectable-item");
+			selectee.$element.removeClass('ui-selecting').addClass('ui-selected');
+			selectee.selecting = false;
+			selectee.selected = true;
+			selectee.startselected = true;
+			self.element.triggerHandler("selectableselected", [e, {
+				selectable: self.element[0],
+				selected: selectee.element,
+				options: options
+			}], options.selected);
+		});
+		this.element.triggerHandler("selectablestop", [e, {
+			selectable: self.element[0],
+			options: this.options
+		}], this.options.stop);
+		
+		this.helper.remove();
+		
+		return false;
+	}
+}));
+
+$.extend($.ui.selectable, {
+	defaults: {
+		distance: 1,
+		delay: 0,
+		cancel: ":input",
+		appendTo: 'body',
+		autoRefresh: true,
+		filter: '*',
+		tolerance: 'touch'
+	}
+});
+
+})(jQuery);
+/*
+ * jQuery UI Sortable
+ *
+ * Copyright (c) 2008 Paul Bakaus
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ * 
+ * http://docs.jquery.com/UI/Sortables
+ *
+ * Depends:
+ *	ui.core.js
+ */
+(function($) {
+
+function contains(a, b) { 
+    var safari2 = $.browser.safari && $.browser.version < 522; 
+    if (a.contains && !safari2) { 
+        return a.contains(b); 
+    } 
+    if (a.compareDocumentPosition) 
+        return !!(a.compareDocumentPosition(b) & 16); 
+    while (b = b.parentNode) 
+          if (b == a) return true; 
+    return false; 
+};
+
+$.widget("ui.sortable", $.extend({}, $.ui.mouse, {
+	init: function() {
+
+		var o = this.options;
+		this.containerCache = {};
+		this.element.addClass("ui-sortable");
+	
+		//Get the items
+		this.refresh();
+
+		//Let's determine if the items are floating
+		this.floating = this.items.length ? (/left|right/).test(this.items[0].item.css('float')) : false;
+		
+		//Let's determine the parent's offset
+		if(!(/(relative|absolute|fixed)/).test(this.element.css('position'))) this.element.css('position', 'relative');
+		this.offset = this.element.offset();
+
+		//Initialize mouse events for interaction
+		this.mouseInit();
+		
+	},
+	plugins: {},
+	ui: function(inst) {
+		return {
+			helper: (inst || this)["helper"],
+			placeholder: (inst || this)["placeholder"] || $([]),
+			position: (inst || this)["position"],
+			absolutePosition: (inst || this)["positionAbs"],
+			options: this.options,
+			element: this.element,
+			item: (inst || this)["currentItem"],
+			sender: inst ? inst.element : null
+		};		
+	},
+	propagate: function(n,e,inst, noPropagation) {
+		$.ui.plugin.call(this, n, [e, this.ui(inst)]);
+		if(!noPropagation) this.element.triggerHandler(n == "sort" ? n : "sort"+n, [e, this.ui(inst)], this.options[n]);
+	},
+	serialize: function(o) {
+
+		var items = ($.isFunction(this.options.items) ? this.options.items.call(this.element) : $(this.options.items, this.element)).not('.ui-sortable-helper'); //Only the items of the sortable itself
+		var str = []; o = o || {};
+		
+		items.each(function() {
+			var res = ($(this).attr(o.attribute || 'id') || '').match(o.expression || (/(.+)[-=_](.+)/));
+			if(res) str.push((o.key || res[1])+'[]='+(o.key && o.expression ? res[1] : res[2]));
+		});
+		
+		return str.join('&');
+		
+	},
+	toArray: function(attr) {
+		
+		var items = ($.isFunction(this.options.items) ? this.options.items.call(this.element) : $(this.options.items, this.element)).not('.ui-sortable-helper'); //Only the items of the sortable itself
+		var ret = [];
+
+		items.each(function() { ret.push($(this).attr(attr || 'id')); });
+		return ret;
+		
+	},
+	/* Be careful with the following core functions */
+	intersectsWith: function(item) {
+		
+		var x1 = this.positionAbs.left, x2 = x1 + this.helperProportions.width,
+		y1 = this.positionAbs.top, y2 = y1 + this.helperProportions.height;
+		var l = item.left, r = l + item.width, 
+		t = item.top, b = t + item.height;
+
+		if(this.options.tolerance == "pointer" || this.options.forcePointerForContainers || (this.options.tolerance == "guess" && this.helperProportions[this.floating ? 'width' : 'height'] > item[this.floating ? 'width' : 'height'])) {
+			return (y1 + this.offset.click.top > t && y1 + this.offset.click.top < b && x1 + this.offset.click.left > l && x1 + this.offset.click.left < r);
+		} else {
+		
+			return (l < x1 + (this.helperProportions.width / 2) // Right Half
+				&& x2 - (this.helperProportions.width / 2) < r // Left Half
+				&& t < y1 + (this.helperProportions.height / 2) // Bottom Half
+				&& y2 - (this.helperProportions.height / 2) < b ); // Top Half
+		
+		}
+		
+	},
+	intersectsWithEdge: function(item) {	
+		var x1 = this.positionAbs.left, x2 = x1 + this.helperProportions.width,
+			y1 = this.positionAbs.top, y2 = y1 + this.helperProportions.height;
+		var l = item.left, r = l + item.width, 
+			t = item.top, b = t + item.height;
+
+		if(this.options.tolerance == "pointer" || (this.options.tolerance == "guess" && this.helperProportions[this.floating ? 'width' : 'height'] > item[this.floating ? 'width' : 'height'])) {
+
+			if(!(y1 + this.offset.click.top > t && y1 + this.offset.click.top < b && x1 + this.offset.click.left > l && x1 + this.offset.click.left < r)) return false;
+			
+			if(this.floating) {
+				if(x1 + this.offset.click.left > l && x1 + this.offset.click.left < l + item.width/2) return 2;
+				if(x1 + this.offset.click.left > l+item.width/2 && x1 + this.offset.click.left < r) return 1;
+			} else {
+				if(y1 + this.offset.click.top > t && y1 + this.offset.click.top < t + item.height/2) return 2;
+				if(y1 + this.offset.click.top > t+item.height/2 && y1 + this.offset.click.top < b) return 1;
+			}
+
+		} else {
+		
+			if (!(l < x1 + (this.helperProportions.width / 2) // Right Half
+				&& x2 - (this.helperProportions.width / 2) < r // Left Half
+				&& t < y1 + (this.helperProportions.height / 2) // Bottom Half
+				&& y2 - (this.helperProportions.height / 2) < b )) return false; // Top Half
+			
+			if(this.floating) {
+				if(x2 > l && x1 < l) return 2; //Crosses left edge
+				if(x1 < r && x2 > r) return 1; //Crosses right edge
+			} else {
+				if(y2 > t && y1 < t) return 1; //Crosses top edge
+				if(y1 < b && y2 > b) return 2; //Crosses bottom edge
+			}
+		
+		}
+		
+		return false;
+		
+	},
+	refresh: function() {
+		this.refreshItems();
+		this.refreshPositions();
+	},
+	refreshItems: function() {
+		
+		this.items = [];
+		this.containers = [this];
+		var items = this.items;
+		var self = this;
+		var queries = [[$.isFunction(this.options.items) ? this.options.items.call(this.element, null, { options: this.options, item: this.currentItem }) : $(this.options.items, this.element), this]];
+	
+		if(this.options.connectWith) {
+			for (var i = this.options.connectWith.length - 1; i >= 0; i--){
+				var cur = $(this.options.connectWith[i]);
+				for (var j = cur.length - 1; j >= 0; j--){
+					var inst = $.data(cur[j], 'sortable');
+					if(inst && !inst.options.disabled) {
+						queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element) : $(inst.options.items, inst.element), inst]);
+						this.containers.push(inst);
+					}
+				};
+			};
+		}
+
+		for (var i = queries.length - 1; i >= 0; i--){
+			queries[i][0].each(function() {
+				$.data(this, 'sortable-item', queries[i][1]); // Data for target checking (mouse manager)
+				items.push({
+					item: $(this),
+					instance: queries[i][1],
+					width: 0, height: 0,
+					left: 0, top: 0
+				});
+			});
+		};
+
+	},
+	refreshPositions: function(fast) {
+
+		//This has to be redone because due to the item being moved out/into the offsetParent, the offsetParent's position will change
+		if(this.offsetParent) {
+			var po = this.offsetParent.offset();
+			this.offset.parent = { top: po.top + this.offsetParentBorders.top, left: po.left + this.offsetParentBorders.left };
+		}
+
+		for (var i = this.items.length - 1; i >= 0; i--){		
+			
+			//We ignore calculating positions of all connected containers when we're not over them
+			if(this.items[i].instance != this.currentContainer && this.currentContainer && this.items[i].item[0] != this.currentItem[0])
+				continue;
+				
+			var t = this.options.toleranceElement ? $(this.options.toleranceElement, this.items[i].item) : this.items[i].item;
+			
+			if(!fast) {
+				this.items[i].width = t[0].offsetWidth;
+				this.items[i].height = t[0].offsetHeight;
+			}
+			
+			var p = t.offset();
+			this.items[i].left = p.left;
+			this.items[i].top = p.top;
+			
+		};
+
+		if(this.options.custom && this.options.custom.refreshContainers) {
+			this.options.custom.refreshContainers.call(this);
+		} else {
+			for (var i = this.containers.length - 1; i >= 0; i--){
+				var p =this.containers[i].element.offset();
+				this.containers[i].containerCache.left = p.left;
+				this.containers[i].containerCache.top = p.top;
+				this.containers[i].containerCache.width	= this.containers[i].element.outerWidth();
+				this.containers[i].containerCache.height = this.containers[i].element.outerHeight();
+			};
+		}
+
+	},
+	destroy: function() {
+		this.element
+			.removeClass("ui-sortable ui-sortable-disabled")
+			.removeData("sortable")
+			.unbind(".sortable");
+		this.mouseDestroy();
+		
+		for ( var i = this.items.length - 1; i >= 0; i-- )
+			this.items[i].item.removeData("sortable-item");
+	},
+	createPlaceholder: function(that) {
+		
+		var self = that || this, o = self.options;
+
+		if(o.placeholder.constructor == String) {
+			var className = o.placeholder;
+			o.placeholder = {
+				element: function() {
+					return $('<div></div>').addClass(className)[0];
+				},
+				update: function(i, p) {
+					p.css(i.offset()).css({ width: i.outerWidth(), height: i.outerHeight() });
+				}
+			};
+		}
+		
+		self.placeholder = $(o.placeholder.element.call(self.element, self.currentItem)).appendTo('body').css({ position: 'absolute' });
+		o.placeholder.update.call(self.element, self.currentItem, self.placeholder);
+	},
+	contactContainers: function(e) {
+		for (var i = this.containers.length - 1; i >= 0; i--){
+
+			if(this.intersectsWith(this.containers[i].containerCache)) {
+				if(!this.containers[i].containerCache.over) {
+					
+
+					if(this.currentContainer != this.containers[i]) {
+						
+						//When entering a new container, we will find the item with the least distance and append our item near it
+						var dist = 10000; var itemWithLeastDistance = null; var base = this.positionAbs[this.containers[i].floating ? 'left' : 'top'];
+						for (var j = this.items.length - 1; j >= 0; j--) {
+							if(!contains(this.containers[i].element[0], this.items[j].item[0])) continue;
+							var cur = this.items[j][this.containers[i].floating ? 'left' : 'top'];
+							if(Math.abs(cur - base) < dist) {
+								dist = Math.abs(cur - base); itemWithLeastDistance = this.items[j];
+							}
+						}
+						
+						if(!itemWithLeastDistance && !this.options.dropOnEmpty) //Check if dropOnEmpty is enabled
+							continue;
+						
+						//We also need to exchange the placeholder
+						if(this.placeholder) this.placeholder.remove();
+						if(this.containers[i].options.placeholder) {
+							this.containers[i].createPlaceholder(this);
+						} else {
+							this.placeholder = null;;
+						}
+						
+						this.currentContainer = this.containers[i];
+						itemWithLeastDistance ? this.rearrange(e, itemWithLeastDistance, null, true) : this.rearrange(e, null, this.containers[i].element, true);
+						this.propagate("change", e); //Call plugins and callbacks
+						this.containers[i].propagate("change", e, this); //Call plugins and callbacks
+
+					}
+					
+					this.containers[i].propagate("over", e, this);
+					this.containers[i].containerCache.over = 1;
+				}
+			} else {
+				if(this.containers[i].containerCache.over) {
+					this.containers[i].propagate("out", e, this);
+					this.containers[i].containerCache.over = 0;
+				}
+			}
+			
+		};			
+	},
+	mouseCapture: function(e, overrideHandle) {
+	
+		if(this.options.disabled || this.options.type == 'static') return false;
+
+		//We have to refresh the items data once first
+		this.refreshItems();
+
+		//Find out if the clicked node (or one of its parents) is a actual item in this.items
+		var currentItem = null, self = this, nodes = $(e.target).parents().each(function() {	
+			if($.data(this, 'sortable-item') == self) {
+				currentItem = $(this);
+				return false;
+			}
+		});
+		if($.data(e.target, 'sortable-item') == self) currentItem = $(e.target);
+
+		if(!currentItem) return false;
+		if(this.options.handle && !overrideHandle) {
+			var validHandle = false;
+			
+			$(this.options.handle, currentItem).find("*").andSelf().each(function() { if(this == e.target) validHandle = true; });
+			if(!validHandle) return false;
+		}
+			
+		this.currentItem = currentItem;
+		return true;	
+			
+	},
+	mouseStart: function(e, overrideHandle, noActivation) {
+
+		var o = this.options;
+		this.currentContainer = this;
+
+		//We only need to call refreshPositions, because the refreshItems call has been moved to mouseCapture
+		this.refreshPositions();
+
+		//Create and append the visible helper			
+		this.helper = typeof o.helper == 'function' ? $(o.helper.apply(this.element[0], [e, this.currentItem])) : this.currentItem.clone();
+		if (!this.helper.parents('body').length) $(o.appendTo != 'parent' ? o.appendTo : this.currentItem[0].parentNode)[0].appendChild(this.helper[0]); //Add the helper to the DOM if that didn't happen already
+		this.helper.css({ position: 'absolute', clear: 'both' }).addClass('ui-sortable-helper'); //Position it absolutely and add a helper class
+
+		/*
+		 * - Position generation -
+		 * This block generates everything position related - it's the core of draggables.
+		 */
+
+		this.margins = {																				//Cache the margins
+			left: (parseInt(this.currentItem.css("marginLeft"),10) || 0),
+			top: (parseInt(this.currentItem.css("marginTop"),10) || 0)
+		};		
+	
+		this.offset = this.currentItem.offset();														//The element's absolute position on the page
+		this.offset = {																					//Substract the margins from the element's absolute offset
+			top: this.offset.top - this.margins.top,
+			left: this.offset.left - this.margins.left
+		};
+		
+		this.offset.click = {																			//Where the click happened, relative to the element
+			left: e.pageX - this.offset.left,
+			top: e.pageY - this.offset.top
+		};
+		
+		this.offsetParent = this.helper.offsetParent();													//Get the offsetParent and cache its position
+		var po = this.offsetParent.offset();			
+
+		this.offsetParentBorders = {
+			top: (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0),
+			left: (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0)
+		};
+		this.offset.parent = {																			//Store its position plus border
+			top: po.top + this.offsetParentBorders.top,
+			left: po.left + this.offsetParentBorders.left
+		};
+	
+		this.originalPosition = this.generatePosition(e);												//Generate the original position
+		this.domPosition = { prev: this.currentItem.prev()[0], parent: this.currentItem.parent()[0] };  //Cache the former DOM position
+		
+		//If o.placeholder is used, create a new element at the given position with the class
+		this.helperProportions = { width: this.helper.outerWidth(), height: this.helper.outerHeight() };//Cache the helper size
+		if(o.placeholder) this.createPlaceholder();
+		
+		//Call plugins and callbacks
+		this.propagate("start", e);
+		this.helperProportions = { width: this.helper.outerWidth(), height: this.helper.outerHeight() };//Recache the helper size
+		
+		if(o.cursorAt) {
+			if(o.cursorAt.left != undefined) this.offset.click.left = o.cursorAt.left;
+			if(o.cursorAt.right != undefined) this.offset.click.left = this.helperProportions.width - o.cursorAt.right;
+			if(o.cursorAt.top != undefined) this.offset.click.top = o.cursorAt.top;
+			if(o.cursorAt.bottom != undefined) this.offset.click.top = this.helperProportions.height - o.cursorAt.bottom;
+		}
+
+		/*
+		 * - Position constraining -
+		 * Here we prepare position constraining like grid and containment.
+		 */	
+		
+		if(o.containment) {
+			if(o.containment == 'parent') o.containment = this.helper[0].parentNode;
+			if(o.containment == 'document' || o.containment == 'window') this.containment = [
+				0 - this.offset.parent.left,
+				0 - this.offset.parent.top,
+				$(o.containment == 'document' ? document : window).width() - this.offset.parent.left - this.helperProportions.width - this.margins.left - (parseInt(this.element.css("marginRight"),10) || 0),
+				($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.offset.parent.top - this.helperProportions.height - this.margins.top - (parseInt(this.element.css("marginBottom"),10) || 0)
+			];
+
+			if(!(/^(document|window|parent)$/).test(o.containment)) {
+				var ce = $(o.containment)[0];
+				var co = $(o.containment).offset();
+				
+				this.containment = [
+					co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) - this.offset.parent.left,
+					co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) - this.offset.parent.top,
+					co.left+Math.max(ce.scrollWidth,ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - this.offset.parent.left - this.helperProportions.width - this.margins.left - (parseInt(this.currentItem.css("marginRight"),10) || 0),
+					co.top+Math.max(ce.scrollHeight,ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - this.offset.parent.top - this.helperProportions.height - this.margins.top - (parseInt(this.currentItem.css("marginBottom"),10) || 0)
+				];
+			}
+		}
+
+		//Set the original element visibility to hidden to still fill out the white space
+		if(this.options.placeholder != 'clone')
+			this.currentItem.css('visibility', 'hidden');
+		
+		//Post 'activate' events to possible containers
+		if(!noActivation) {
+			 for (var i = this.containers.length - 1; i >= 0; i--) { this.containers[i].propagate("activate", e, this); }
+		}
+		
+		//Prepare possible droppables
+		if($.ui.ddmanager) $.ui.ddmanager.current = this;
+		if ($.ui.ddmanager && !o.dropBehaviour) $.ui.ddmanager.prepareOffsets(this, e);
+
+		this.dragging = true;
+
+		this.mouseDrag(e); //Execute the drag once - this causes the helper not to be visible before getting its correct position
+		return true;
+
+
+	},
+	convertPositionTo: function(d, pos) {
+		if(!pos) pos = this.position;
+		var mod = d == "absolute" ? 1 : -1;
+		return {
+			top: (
+				pos.top																	// the calculated relative position
+				+ this.offset.parent.top * mod											// The offsetParent's offset without borders (offset + border)
+				- (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollTop) * mod	// The offsetParent's scroll position
+				+ this.margins.top * mod												//Add the margin (you don't want the margin counting in intersection methods)
+			),
+			left: (
+				pos.left																// the calculated relative position
+				+ this.offset.parent.left * mod											// The offsetParent's offset without borders (offset + border)
+				- (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollLeft) * mod	// The offsetParent's scroll position
+				+ this.margins.left * mod												//Add the margin (you don't want the margin counting in intersection methods)
+			)
+		};
+	},
+	generatePosition: function(e) {
+		
+		var o = this.options;
+		var position = {
+			top: (
+				e.pageY																	// The absolute mouse position
+				- this.offset.click.top													// Click offset (relative to the element)
+				- this.offset.parent.top												// The offsetParent's offset without borders (offset + border)
+				+ (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollTop)	// The offsetParent's scroll position, not if the element is fixed
+			),
+			left: (
+				e.pageX																	// The absolute mouse position
+				- this.offset.click.left												// Click offset (relative to the element)
+				- this.offset.parent.left												// The offsetParent's offset without borders (offset + border)
+				+ (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollLeft)	// The offsetParent's scroll position, not if the element is fixed
+			)
+		};
+		
+		if(!this.originalPosition) return position;										//If we are not dragging yet, we won't check for options
+		
+		/*
+		 * - Position constraining -
+		 * Constrain the position to a mix of grid, containment.
+		 */
+		if(this.containment) {
+			if(position.left < this.containment[0]) position.left = this.containment[0];
+			if(position.top < this.containment[1]) position.top = this.containment[1];
+			if(position.left > this.containment[2]) position.left = this.containment[2];
+			if(position.top > this.containment[3]) position.top = this.containment[3];
+		}
+		
+		if(o.grid) {
+			var top = this.originalPosition.top + Math.round((position.top - this.originalPosition.top) / o.grid[1]) * o.grid[1];
+			position.top = this.containment ? (!(top < this.containment[1] || top > this.containment[3]) ? top : (!(top < this.containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;
+			
+			var left = this.originalPosition.left + Math.round((position.left - this.originalPosition.left) / o.grid[0]) * o.grid[0];
+			position.left = this.containment ? (!(left < this.containment[0] || left > this.containment[2]) ? left : (!(left < this.containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left;
+		}
+		
+		return position;
+	},
+	mouseDrag: function(e) {
+
+		//Compute the helpers position
+		this.position = this.generatePosition(e);
+		this.positionAbs = this.convertPositionTo("absolute");
+
+		//Call the internal plugins
+		$.ui.plugin.call(this, "sort", [e, this.ui()]);
+		
+		//Regenerate the absolute position used for position checks
+		this.positionAbs = this.convertPositionTo("absolute");
+		
+		//Set the helper's position
+		this.helper[0].style.left = this.position.left+'px';
+		this.helper[0].style.top = this.position.top+'px';
+
+		//Rearrange
+		for (var i = this.items.length - 1; i >= 0; i--) {
+			var intersection = this.intersectsWithEdge(this.items[i]);
+			if(!intersection) continue;
+			
+			if(this.items[i].item[0] != this.currentItem[0] //cannot intersect with itself
+				&&	this.currentItem[intersection == 1 ? "next" : "prev"]()[0] != this.items[i].item[0] //no useless actions that have been done before
+				&&	!contains(this.currentItem[0], this.items[i].item[0]) //no action if the item moved is the parent of the item checked
+				&& (this.options.type == 'semi-dynamic' ? !contains(this.element[0], this.items[i].item[0]) : true)
+			) {
+				
+				this.direction = intersection == 1 ? "down" : "up";
+				this.rearrange(e, this.items[i]);
+				this.propagate("change", e); //Call plugins and callbacks
+				break;
+			}
+		}
+		
+		//Post events to containers
+		this.contactContainers(e);
+		
+		//Interconnect with droppables
+		if($.ui.ddmanager) $.ui.ddmanager.drag(this, e);
+
+		//Call callbacks
+		this.element.triggerHandler("sort", [e, this.ui()], this.options["sort"]);
+
+		return false;
+		
+	},
+	rearrange: function(e, i, a, hardRefresh) {
+		a ? a[0].appendChild(this.currentItem[0]) : i.item[0].parentNode.insertBefore(this.currentItem[0], (this.direction == 'down' ? i.item[0] : i.item[0].nextSibling));
+		
+		//Various things done here to improve the performance:
+		// 1. we create a setTimeout, that calls refreshPositions
+		// 2. on the instance, we have a counter variable, that get's higher after every append
+		// 3. on the local scope, we copy the counter variable, and check in the timeout, if it's still the same
+		// 4. this lets only the last addition to the timeout stack through
+		this.counter = this.counter ? ++this.counter : 1;
+		var self = this, counter = this.counter;
+
+		window.setTimeout(function() {
+			if(counter == self.counter) self.refreshPositions(!hardRefresh); //Precompute after each DOM insertion, NOT on mousemove
+		},0);
+		
+		if(this.options.placeholder)
+			this.options.placeholder.update.call(this.element, this.currentItem, this.placeholder);
+	},
+	mouseStop: function(e, noPropagation) {
+
+		//If we are using droppables, inform the manager about the drop
+		if ($.ui.ddmanager && !this.options.dropBehaviour)
+			$.ui.ddmanager.drop(this, e);
+			
+		if(this.options.revert) {
+			var self = this;
+			var cur = self.currentItem.offset();
+
+			//Also animate the placeholder if we have one
+			if(self.placeholder) self.placeholder.animate({ opacity: 'hide' }, (parseInt(this.options.revert, 10) || 500)-50);
+
+			$(this.helper).animate({
+				left: cur.left - this.offset.parent.left - self.margins.left + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollLeft),
+				top: cur.top - this.offset.parent.top - self.margins.top + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollTop)
+			}, parseInt(this.options.revert, 10) || 500, function() {
+				self.clear(e);
+			});
+		} else {
+			this.clear(e, noPropagation);
+		}
+
+		return false;
+		
+	},
+	clear: function(e, noPropagation) {
+
+		if(this.domPosition.prev != this.currentItem.prev().not(".ui-sortable-helper")[0] || this.domPosition.parent != this.currentItem.parent()[0]) this.propagate("update", e, null, noPropagation); //Trigger update callback if the DOM position has changed
+		if(!contains(this.element[0], this.currentItem[0])) { //Node was moved out of the current element
+			this.propagate("remove", e, null, noPropagation);
+			for (var i = this.containers.length - 1; i >= 0; i--){
+				if(contains(this.containers[i].element[0], this.currentItem[0])) {
+					this.containers[i].propagate("update", e, this, noPropagation);
+					this.containers[i].propagate("receive", e, this, noPropagation);
+				}
+			};
+		};
+		
+		//Post events to containers
+		for (var i = this.containers.length - 1; i >= 0; i--){
+			this.containers[i].propagate("deactivate", e, this, noPropagation);
+			if(this.containers[i].containerCache.over) {
+				this.containers[i].propagate("out", e, this);
+				this.containers[i].containerCache.over = 0;
+			}
+		}
+		
+		this.dragging = false;
+		if(this.cancelHelperRemoval) {
+			this.propagate("stop", e, null, noPropagation);
+			return false;
+		}
+		
+		$(this.currentItem).css('visibility', '');
+		if(this.placeholder) this.placeholder.remove();
+		this.helper.remove(); this.helper = null;
+		this.propagate("stop", e, null, noPropagation);
+		
+		return true;
+		
+	}
+}));
+
+$.extend($.ui.sortable, {
+	getter: "serialize toArray",
+	defaults: {
+		helper: "clone",
+		tolerance: "guess",
+		distance: 1,
+		delay: 0,
+		scroll: true,
+		scrollSensitivity: 20,
+		scrollSpeed: 20,
+		cancel: ":input",
+		items: '> *',
+		zIndex: 1000,
+		dropOnEmpty: true,
+		appendTo: "parent"
+	}
+});
+
+/*
+ * Sortable Extensions
+ */
+
+$.ui.plugin.add("sortable", "cursor", {
+	start: function(e, ui) {
+		var t = $('body');
+		if (t.css("cursor")) ui.options._cursor = t.css("cursor");
+		t.css("cursor", ui.options.cursor);
+	},
+	stop: function(e, ui) {
+		if (ui.options._cursor) $('body').css("cursor", ui.options._cursor);
+	}
+});
+
+$.ui.plugin.add("sortable", "zIndex", {
+	start: function(e, ui) {
+		var t = ui.helper;
+		if(t.css("zIndex")) ui.options._zIndex = t.css("zIndex");
+		t.css('zIndex', ui.options.zIndex);
+	},
+	stop: function(e, ui) {
+		if(ui.options._zIndex) $(ui.helper).css('zIndex', ui.options._zIndex);
+	}
+});
+
+$.ui.plugin.add("sortable", "opacity", {
+	start: function(e, ui) {
+		var t = ui.helper;
+		if(t.css("opacity")) ui.options._opacity = t.css("opacity");
+		t.css('opacity', ui.options.opacity);
+	},
+	stop: function(e, ui) {
+		if(ui.options._opacity) $(ui.helper).css('opacity', ui.options._opacity);
+	}
+});
+
+$.ui.plugin.add("sortable", "scroll", {
+	start: function(e, ui) {
+		var o = ui.options;
+		var i = $(this).data("sortable");
+	
+		i.overflowY = function(el) {
+			do { if(/auto|scroll/.test(el.css('overflow')) || (/auto|scroll/).test(el.css('overflow-y'))) return el; el = el.parent(); } while (el[0].parentNode);
+			return $(document);
+		}(i.currentItem);
+		i.overflowX = function(el) {
+			do { if(/auto|scroll/.test(el.css('overflow')) || (/auto|scroll/).test(el.css('overflow-x'))) return el; el = el.parent(); } while (el[0].parentNode);
+			return $(document);
+		}(i.currentItem);
+		
+		if(i.overflowY[0] != document && i.overflowY[0].tagName != 'HTML') i.overflowYOffset = i.overflowY.offset();
+		if(i.overflowX[0] != document && i.overflowX[0].tagName != 'HTML') i.overflowXOffset = i.overflowX.offset();
+		
+	},
+	sort: function(e, ui) {
+		
+		var o = ui.options;
+		var i = $(this).data("sortable");
+		
+		if(i.overflowY[0] != document && i.overflowY[0].tagName != 'HTML') {
+			if((i.overflowYOffset.top + i.overflowY[0].offsetHeight) - e.pageY < o.scrollSensitivity)
+				i.overflowY[0].scrollTop = i.overflowY[0].scrollTop + o.scrollSpeed;
+			if(e.pageY - i.overflowYOffset.top < o.scrollSensitivity)
+				i.overflowY[0].scrollTop = i.overflowY[0].scrollTop - o.scrollSpeed;
+		} else {
+			if(e.pageY - $(document).scrollTop() < o.scrollSensitivity)
+				$(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
+			if($(window).height() - (e.pageY - $(document).scrollTop()) < o.scrollSensitivity)
+				$(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
+		}
+		
+		if(i.overflowX[0] != document && i.overflowX[0].tagName != 'HTML') {
+			if((i.overflowXOffset.left + i.overflowX[0].offsetWidth) - e.pageX < o.scrollSensitivity)
+				i.overflowX[0].scrollLeft = i.overflowX[0].scrollLeft + o.scrollSpeed;
+			if(e.pageX - i.overflowXOffset.left < o.scrollSensitivity)
+				i.overflowX[0].scrollLeft = i.overflowX[0].scrollLeft - o.scrollSpeed;
+		} else {
+			if(e.pageX - $(document).scrollLeft() < o.scrollSensitivity)
+				$(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
+			if($(window).width() - (e.pageX - $(document).scrollLeft()) < o.scrollSensitivity)
+				$(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
+		}
+		
+	}
+});
+
+$.ui.plugin.add("sortable", "axis", {
+	sort: function(e, ui) {
+		
+		var i = $(this).data("sortable");
+		
+		if(ui.options.axis == "y") i.position.left = i.originalPosition.left;
+		if(ui.options.axis == "x") i.position.top = i.originalPosition.top;
+		
+	}
+});
+
+})(jQuery);
+/*
+ * jQuery UI Effects 1.5.2
+ *
+ * Copyright (c) 2008 Aaron Eisenberger (aaronchi@gmail.com)
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ * 
+ * http://docs.jquery.com/UI/Effects/
+ */
+;(function($) {
+
+$.effects = $.effects || {}; //Add the 'effects' scope
+
+$.extend($.effects, {
+	save: function(el, set) {
+		for(var i=0;i<set.length;i++) {
+			if(set[i] !== null) $.data(el[0], "ec.storage."+set[i], el[0].style[set[i]]);
+		}
+	},
+	restore: function(el, set) {
+		for(var i=0;i<set.length;i++) {
+			if(set[i] !== null) el.css(set[i], $.data(el[0], "ec.storage."+set[i]));
+		}
+	},
+	setMode: function(el, mode) {
+		if (mode == 'toggle') mode = el.is(':hidden') ? 'show' : 'hide'; // Set for toggle
+		return mode;
+	},
+	getBaseline: function(origin, original) { // Translates a [top,left] array into a baseline value
+		// this should be a little more flexible in the future to handle a string & hash
+		var y, x;
+		switch (origin[0]) {
+			case 'top': y = 0; break;
+			case 'middle': y = 0.5; break;
+			case 'bottom': y = 1; break;
+			default: y = origin[0] / original.height;
+		};
+		switch (origin[1]) {
+			case 'left': x = 0; break;
+			case 'center': x = 0.5; break;
+			case 'right': x = 1; break;
+			default: x = origin[1] / original.width;
+		};
+		return {x: x, y: y};
+	},
+	createWrapper: function(el) {
+		if (el.parent().attr('id') == 'fxWrapper')
+			return el;
+		var props = {width: el.outerWidth({margin:true}), height: el.outerHeight({margin:true}), 'float': el.css('float')};
+		el.wrap('<div id="fxWrapper" style="font-size:100%;background:transparent;border:none;margin:0;padding:0"></div>');
+		var wrapper = el.parent();
+		if (el.css('position') == 'static'){
+			wrapper.css({position: 'relative'});
+			el.css({position: 'relative'});
+		} else {
+			var top = el.css('top'); if(isNaN(parseInt(top))) top = 'auto';
+			var left = el.css('left'); if(isNaN(parseInt(left))) left = 'auto';
+			wrapper.css({ position: el.css('position'), top: top, left: left, zIndex: el.css('z-index') }).show();
+			el.css({position: 'relative', top:0, left:0});
+		}
+		wrapper.css(props);
+		return wrapper;
+	},
+	removeWrapper: function(el) {
+		if (el.parent().attr('id') == 'fxWrapper')
+			return el.parent().replaceWith(el);
+		return el;
+	},
+	setTransition: function(el, list, factor, val) {
+		val = val || {};
+		$.each(list,function(i, x){
+			unit = el.cssUnit(x);
+			if (unit[0] > 0) val[x] = unit[0] * factor + unit[1];
+		});
+		return val;
+	},
+	animateClass: function(value, duration, easing, callback) {
+
+		var cb = (typeof easing == "function" ? easing : (callback ? callback : null));
+		var ea = (typeof easing == "object" ? easing : null);
+
+		return this.each(function() {
+
+			var offset = {}; var that = $(this); var oldStyleAttr = that.attr("style") || '';
+			if(typeof oldStyleAttr == 'object') oldStyleAttr = oldStyleAttr["cssText"]; /* Stupidly in IE, style is a object.. */
+			if(value.toggle) { that.hasClass(value.toggle) ? value.remove = value.toggle : value.add = value.toggle; }
+
+			//Let's get a style offset
+			var oldStyle = $.extend({}, (document.defaultView ? document.defaultView.getComputedStyle(this,null) : this.currentStyle));
+			if(value.add) that.addClass(value.add); if(value.remove) that.removeClass(value.remove);
+			var newStyle = $.extend({}, (document.defaultView ? document.defaultView.getComputedStyle(this,null) : this.currentStyle));
+			if(value.add) that.removeClass(value.add); if(value.remove) that.addClass(value.remove);
+
+			// The main function to form the object for animation
+			for(var n in newStyle) {
+				if( typeof newStyle[n] != "function" && newStyle[n] /* No functions and null properties */
+				&& n.indexOf("Moz") == -1 && n.indexOf("length") == -1 /* No mozilla spezific render properties. */
+				&& newStyle[n] != oldStyle[n] /* Only values that have changed are used for the animation */
+				&& (n.match(/color/i) || (!n.match(/color/i) && !isNaN(parseInt(newStyle[n],10)))) /* Only things that can be parsed to integers or colors */
+				&& (oldStyle.position != "static" || (oldStyle.position == "static" && !n.match(/left|top|bottom|right/))) /* No need for positions when dealing with static positions */
+				) offset[n] = newStyle[n];
+			}
+
+			that.animate(offset, duration, ea, function() { // Animate the newly constructed offset object
+				// Change style attribute back to original. For stupid IE, we need to clear the damn object.
+				if(typeof $(this).attr("style") == 'object') { $(this).attr("style")["cssText"] = ""; $(this).attr("style")["cssText"] = oldStyleAttr; } else $(this).attr("style", oldStyleAttr);
+				if(value.add) $(this).addClass(value.add); if(value.remove) $(this).removeClass(value.remove);
+				if(cb) cb.apply(this, arguments);
+			});
+
+		});
+	}
+});
+
+//Extend the methods of jQuery
+$.fn.extend({
+	//Save old methods
+	_show: $.fn.show,
+	_hide: $.fn.hide,
+	__toggle: $.fn.toggle,
+	_addClass: $.fn.addClass,
+	_removeClass: $.fn.removeClass,
+	_toggleClass: $.fn.toggleClass,
+	// New ec methods
+	effect: function(fx,o,speed,callback) {
+		return $.effects[fx] ? $.effects[fx].call(this, {method: fx, options: o || {}, duration: speed, callback: callback }) : null;
+	},
+	show: function() {
+		if(!arguments[0] || (arguments[0].constructor == Number || /(slow|normal|fast)/.test(arguments[0])))
+			return this._show.apply(this, arguments);
+		else {
+			var o = arguments[1] || {}; o['mode'] = 'show';
+			return this.effect.apply(this, [arguments[0], o, arguments[2] || o.duration, arguments[3] || o.callback]);
+		}
+	},
+	hide: function() {
+		if(!arguments[0] || (arguments[0].constructor == Number || /(slow|normal|fast)/.test(arguments[0])))
+			return this._hide.apply(this, arguments);
+		else {
+			var o = arguments[1] || {}; o['mode'] = 'hide';
+			return this.effect.apply(this, [arguments[0], o, arguments[2] || o.duration, arguments[3] || o.callback]);
+		}
+	},
+	toggle: function(){
+		if(!arguments[0] || (arguments[0].constructor == Number || /(slow|normal|fast)/.test(arguments[0])) || (arguments[0].constructor == Function))
+			return this.__toggle.apply(this, arguments);
+		else {
+			var o = arguments[1] || {}; o['mode'] = 'toggle';
+			return this.effect.apply(this, [arguments[0], o, arguments[2] || o.duration, arguments[3] || o.callback]);
+		}
+	},
+	addClass: function(classNames,speed,easing,callback) {
+		return speed ? $.effects.animateClass.apply(this, [{ add: classNames },speed,easing,callback]) : this._addClass(classNames);
+	},
+	removeClass: function(classNames,speed,easing,callback) {
+		return speed ? $.effects.animateClass.apply(this, [{ remove: classNames },speed,easing,callback]) : this._removeClass(classNames);
+	},
+	toggleClass: function(classNames,speed,easing,callback) {
+		return speed ? $.effects.animateClass.apply(this, [{ toggle: classNames },speed,easing,callback]) : this._toggleClass(classNames);
+	},
+	morph: function(remove,add,speed,easing,callback) {
+		return $.effects.animateClass.apply(this, [{ add: add, remove: remove },speed,easing,callback]);
+	},
+	switchClass: function() {
+		return this.morph.apply(this, arguments);
+	},
+	// helper functions
+	cssUnit: function(key) {
+		var style = this.css(key), val = [];
+		$.each( ['em','px','%','pt'], function(i, unit){
+			if(style.indexOf(unit) > 0)
+				val = [parseFloat(style), unit];
+		});
+		return val;
+	}
+});
+
+/*
+ * jQuery Color Animations
+ * Copyright 2007 John Resig
+ * Released under the MIT and GPL licenses.
+ */
+
+// We override the animation for all of these color styles
+jQuery.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor', 'color', 'outlineColor'], function(i,attr){
+		jQuery.fx.step[attr] = function(fx){
+				if ( fx.state == 0 ) {
+						fx.start = getColor( fx.elem, attr );
+						fx.end = getRGB( fx.end );
+				}
+
+				fx.elem.style[attr] = "rgb(" + [
+						Math.max(Math.min( parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0]), 255), 0),
+						Math.max(Math.min( parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1]), 255), 0),
+						Math.max(Math.min( parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2]), 255), 0)
+				].join(",") + ")";
+		}
+});
+
+// Color Conversion functions from highlightFade
+// By Blair Mitchelmore
+// http://jquery.offput.ca/highlightFade/
+
+// Parse strings looking for color tuples [255,255,255]
+function getRGB(color) {
+		var result;
+
+		// Check if we're already dealing with an array of colors
+		if ( color && color.constructor == Array && color.length == 3 )
+				return color;
+
+		// Look for rgb(num,num,num)
+		if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color))
+				return [parseInt(result[1]), parseInt(result[2]), parseInt(result[3])];
+
+		// Look for rgb(num%,num%,num%)
+		if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color))
+				return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55];
+
+		// Look for #a0b1c2
+		if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color))
+				return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)];
+
+		// Look for #fff
+		if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color))
+				return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)];
+
+		// Look for rgba(0, 0, 0, 0) == transparent in Safari 3
+		if (result = /rgba\(0, 0, 0, 0\)/.exec(color))
+				return colors['transparent']
+
+		// Otherwise, we're most likely dealing with a named color
+		return colors[jQuery.trim(color).toLowerCase()];
+}
+
+function getColor(elem, attr) {
+		var color;
+
+		do {
+				color = jQuery.curCSS(elem, attr);
+
+				// Keep going until we find an element that has color, or we hit the body
+				if ( color != '' && color != 'transparent' || jQuery.nodeName(elem, "body") )
+						break;
+
+				attr = "backgroundColor";
+		} while ( elem = elem.parentNode );
+
+		return getRGB(color);
+};
+
+// Some named colors to work with
+// From Interface by Stefan Petre
+// http://interface.eyecon.ro/
+
+var colors = {
+	aqua:[0,255,255],
+	azure:[240,255,255],
+	beige:[245,245,220],
+	black:[0,0,0],
+	blue:[0,0,255],
+	brown:[165,42,42],
+	cyan:[0,255,255],
+	darkblue:[0,0,139],
+	darkcyan:[0,139,139],
+	darkgrey:[169,169,169],
+	darkgreen:[0,100,0],
+	darkkhaki:[189,183,107],
+	darkmagenta:[139,0,139],
+	darkolivegreen:[85,107,47],
+	darkorange:[255,140,0],
+	darkorchid:[153,50,204],
+	darkred:[139,0,0],
+	darksalmon:[233,150,122],
+	darkviolet:[148,0,211],
+	fuchsia:[255,0,255],
+	gold:[255,215,0],
+	green:[0,128,0],
+	indigo:[75,0,130],
+	khaki:[240,230,140],
+	lightblue:[173,216,230],
+	lightcyan:[224,255,255],
+	lightgreen:[144,238,144],
+	lightgrey:[211,211,211],
+	lightpink:[255,182,193],
+	lightyellow:[255,255,224],
+	lime:[0,255,0],
+	magenta:[255,0,255],
+	maroon:[128,0,0],
+	navy:[0,0,128],
+	olive:[128,128,0],
+	orange:[255,165,0],
+	pink:[255,192,203],
+	purple:[128,0,128],
+	violet:[128,0,128],
+	red:[255,0,0],
+	silver:[192,192,192],
+	white:[255,255,255],
+	yellow:[255,255,0],
+	transparent: [255,255,255]
+};
+	
+/*
+ * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
+ *
+ * Uses the built in easing capabilities added In jQuery 1.1
+ * to offer multiple easing options
+ *
+ * TERMS OF USE - jQuery Easing
+ * 
+ * Open source under the BSD License. 
+ * 
+ * Copyright © 2008 George McGinley Smith
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without modification, 
+ * are permitted provided that the following conditions are met:
+ * 
+ * Redistributions of source code must retain the above copyright notice, this list of 
+ * conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice, this list 
+ * of conditions and the following disclaimer in the documentation and/or other materials 
+ * provided with the distribution.
+ * 
+ * Neither the name of the author nor the names of contributors may be used to endorse 
+ * or promote products derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
+ * OF THE POSSIBILITY OF SUCH DAMAGE. 
+ *
+*/
+
+// t: current time, b: begInnIng value, c: change In value, d: duration
+jQuery.easing['jswing'] = jQuery.easing['swing'];
+
+jQuery.extend( jQuery.easing,
+{
+	def: 'easeOutQuad',
+	swing: function (x, t, b, c, d) {
+		//alert(jQuery.easing.default);
+		return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
+	},
+	easeInQuad: function (x, t, b, c, d) {
+		return c*(t/=d)*t + b;
+	},
+	easeOutQuad: function (x, t, b, c, d) {
+		return -c *(t/=d)*(t-2) + b;
+	},
+	easeInOutQuad: function (x, t, b, c, d) {
+		if ((t/=d/2) < 1) return c/2*t*t + b;
+		return -c/2 * ((--t)*(t-2) - 1) + b;
+	},
+	easeInCubic: function (x, t, b, c, d) {
+		return c*(t/=d)*t*t + b;
+	},
+	easeOutCubic: function (x, t, b, c, d) {
+		return c*((t=t/d-1)*t*t + 1) + b;
+	},
+	easeInOutCubic: function (x, t, b, c, d) {
+		if ((t/=d/2) < 1) return c/2*t*t*t + b;
+		return c/2*((t-=2)*t*t + 2) + b;
+	},
+	easeInQuart: function (x, t, b, c, d) {
+		return c*(t/=d)*t*t*t + b;
+	},
+	easeOutQuart: function (x, t, b, c, d) {
+		return -c * ((t=t/d-1)*t*t*t - 1) + b;
+	},
+	easeInOutQuart: function (x, t, b, c, d) {
+		if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
+		return -c/2 * ((t-=2)*t*t*t - 2) + b;
+	},
+	easeInQuint: function (x, t, b, c, d) {
+		return c*(t/=d)*t*t*t*t + b;
+	},
+	easeOutQuint: function (x, t, b, c, d) {
+		return c*((t=t/d-1)*t*t*t*t + 1) + b;
+	},
+	easeInOutQuint: function (x, t, b, c, d) {
+		if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
+		return c/2*((t-=2)*t*t*t*t + 2) + b;
+	},
+	easeInSine: function (x, t, b, c, d) {
+		return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
+	},
+	easeOutSine: function (x, t, b, c, d) {
+		return c * Math.sin(t/d * (Math.PI/2)) + b;
+	},
+	easeInOutSine: function (x, t, b, c, d) {
+		return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
+	},
+	easeInExpo: function (x, t, b, c, d) {
+		return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
+	},
+	easeOutExpo: function (x, t, b, c, d) {
+		return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
+	},
+	easeInOutExpo: function (x, t, b, c, d) {
+		if (t==0) return b;
+		if (t==d) return b+c;
+		if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
+		return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
+	},
+	easeInCirc: function (x, t, b, c, d) {
+		return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
+	},
+	easeOutCirc: function (x, t, b, c, d) {
+		return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
+	},
+	easeInOutCirc: function (x, t, b, c, d) {
+		if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
+		return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
+	},
+	easeInElastic: function (x, t, b, c, d) {
+		var s=1.70158;var p=0;var a=c;
+		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
+		if (a < Math.abs(c)) { a=c; var s=p/4; }
+		else var s = p/(2*Math.PI) * Math.asin (c/a);
+		return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
+	},
+	easeOutElastic: function (x, t, b, c, d) {
+		var s=1.70158;var p=0;var a=c;
+		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
+		if (a < Math.abs(c)) { a=c; var s=p/4; }
+		else var s = p/(2*Math.PI) * Math.asin (c/a);
+		return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
+	},
+	easeInOutElastic: function (x, t, b, c, d) {
+		var s=1.70158;var p=0;var a=c;
+		if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) p=d*(.3*1.5);
+		if (a < Math.abs(c)) { a=c; var s=p/4; }
+		else var s = p/(2*Math.PI) * Math.asin (c/a);
+		if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
+		return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
+	},
+	easeInBack: function (x, t, b, c, d, s) {
+		if (s == undefined) s = 1.70158;
+		return c*(t/=d)*t*((s+1)*t - s) + b;
+	},
+	easeOutBack: function (x, t, b, c, d, s) {
+		if (s == undefined) s = 1.70158;
+		return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
+	},
+	easeInOutBack: function (x, t, b, c, d, s) {
+		if (s == undefined) s = 1.70158; 
+		if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
+		return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
+	},
+	easeInBounce: function (x, t, b, c, d) {
+		return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
+	},
+	easeOutBounce: function (x, t, b, c, d) {
+		if ((t/=d) < (1/2.75)) {
+			return c*(7.5625*t*t) + b;
+		} else if (t < (2/2.75)) {
+			return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
+		} else if (t < (2.5/2.75)) {
+			return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
+		} else {
+			return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
+		}
+	},
+	easeInOutBounce: function (x, t, b, c, d) {
+		if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
+		return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
+	}
+});
+
+/*
+ *
+ * TERMS OF USE - EASING EQUATIONS
+ * 
+ * Open source under the BSD License. 
+ * 
+ * Copyright © 2001 Robert Penner
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without modification, 
+ * are permitted provided that the following conditions are met:
+ * 
+ * Redistributions of source code must retain the above copyright notice, this list of 
+ * conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice, this list 
+ * of conditions and the following disclaimer in the documentation and/or other materials 
+ * provided with the distribution.
+ * 
+ * Neither the name of the author nor the names of contributors may be used to endorse 
+ * or promote products derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
+ * OF THE POSSIBILITY OF SUCH DAMAGE. 
+ *
+ */
+
+})(jQuery);
+/*
+ * jQuery UI Effects Blind
+ *
+ * Copyright (c) 2008 Aaron Eisenberger (aaronchi@gmail.com)
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ * 
+ * http://docs.jquery.com/UI/Effects/Blind
+ *
+ * Depends:
+ *	effects.core.js
+ */
+(function($) {
+
+$.effects.blind = function(o) {
+
+	return this.queue(function() {
+
+		// Create element
+		var el = $(this), props = ['position','top','left'];
+		
+		// Set options
+		var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode
+		var direction = o.options.direction || 'vertical'; // Default direction
+		
+		// Adjust
+		$.effects.save(el, props); el.show(); // Save & Show
+		var wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper
+		var ref = (direction == 'vertical') ? 'height' : 'width';
+		var distance = (direction == 'vertical') ? wrapper.height() : wrapper.width();
+		if(mode == 'show') wrapper.css(ref, 0); // Shift
+		
+		// Animation
+		var animation = {};
+		animation[ref] = mode == 'show' ? distance : 0;
+	 
+		// Animate
+		wrapper.animate(animation, o.duration, o.options.easing, function() {
+			if(mode == 'hide') el.hide(); // Hide
+			$.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
+			if(o.callback) o.callback.apply(el[0], arguments); // Callback
+			el.dequeue();
+		});
+		
+	});
+	
+};
+
+})(jQuery);
+/*
+ * jQuery UI Effects Bounce
+ *
+ * Copyright (c) 2008 Aaron Eisenberger (aaronchi@gmail.com)
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ * 
+ * http://docs.jquery.com/UI/Effects/Bounce
+ *
+ * Depends:
+ *	effects.core.js
+ */
+(function($) {
+
+$.effects.bounce = function(o) {
+
+	return this.queue(function() {
+
+		// Create element
+		var el = $(this), props = ['position','top','left'];
+
+		// Set options
+		var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode
+		var direction = o.options.direction || 'up'; // Default direction
+		var distance = o.options.distance || 20; // Default distance
+		var times = o.options.times || 5; // Default # of times
+		var speed = o.duration || 250; // Default speed per bounce
+		if (/show|hide/.test(mode)) props.push('opacity'); // Avoid touching opacity to prevent clearType and PNG issues in IE
+
+		// Adjust
+		$.effects.save(el, props); el.show(); // Save & Show
+		$.effects.createWrapper(el); // Create Wrapper
+		var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left';
+		var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';
+		var distance = o.options.distance || (ref == 'top' ? el.outerHeight({margin:true}) / 3 : el.outerWidth({margin:true}) / 3);
+		if (mode == 'show') el.css('opacity', 0).css(ref, motion == 'pos' ? -distance : distance); // Shift
+		if (mode == 'hide') distance = distance / (times * 2);
+		if (mode != 'hide') times--;
+		
+		// Animate
+		if (mode == 'show') { // Show Bounce
+			var animation = {opacity: 1};
+			animation[ref] = (motion == 'pos' ? '+=' : '-=') + distance;
+			el.animate(animation, speed / 2, o.options.easing);
+			distance = distance / 2;
+			times--;
+		};
+		for (var i = 0; i < times; i++) { // Bounces
+			var animation1 = {}, animation2 = {};
+			animation1[ref] = (motion == 'pos' ? '-=' : '+=') + distance;
+			animation2[ref] = (motion == 'pos' ? '+=' : '-=') + distance;
+			el.animate(animation1, speed / 2, o.options.easing).animate(animation2, speed / 2, o.options.easing);
+			distance = (mode == 'hide') ? distance * 2 : distance / 2;
+		};
+		if (mode == 'hide') { // Last Bounce
+			var animation = {opacity: 0};
+			animation[ref] = (motion == 'pos' ? '-=' : '+=')  + distance;
+			el.animate(animation, speed / 2, o.options.easing, function(){
+				el.hide(); // Hide
+				$.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
+				if(o.callback) o.callback.apply(this, arguments); // Callback
+			});
+		} else {
+			var animation1 = {}, animation2 = {};
+			animation1[ref] = (motion == 'pos' ? '-=' : '+=') + distance;
+			animation2[ref] = (motion == 'pos' ? '+=' : '-=') + distance;
+			el.animate(animation1, speed / 2, o.options.easing).animate(animation2, speed / 2, o.options.easing, function(){
+				$.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
+				if(o.callback) o.callback.apply(this, arguments); // Callback
+			});
+		};
+		el.queue('fx', function() { el.dequeue(); });
+		el.dequeue();
+	});
+	
+};
+
+})(jQuery);
+/*
+ * jQuery UI Effects Clip
+ *
+ * Copyright (c) 2008 Aaron Eisenberger (aaronchi@gmail.com)
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ * 
+ * http://docs.jquery.com/UI/Effects/Clip
+ *
+ * Depends:
+ *	effects.core.js
+ */
+(function($) {
+
+$.effects.clip = function(o) {
+
+	return this.queue(function() {
+
+		// Create element
+		var el = $(this), props = ['position','top','left','height','width'];
+		
+		// Set options
+		var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode
+		var direction = o.options.direction || 'vertical'; // Default direction
+		
+		// Adjust
+		$.effects.save(el, props); el.show(); // Save & Show
+		var wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper
+		var animate = el[0].tagName == 'IMG' ? wrapper : el;
+		var ref = {
+			size: (direction == 'vertical') ? 'height' : 'width',
+			position: (direction == 'vertical') ? 'top' : 'left'
+		};
+		var distance = (direction == 'vertical') ? animate.height() : animate.width();
+		if(mode == 'show') { animate.css(ref.size, 0); animate.css(ref.position, distance / 2); } // Shift
+		
+		// Animation
+		var animation = {};
+		animation[ref.size] = mode == 'show' ? distance : 0;
+		animation[ref.position] = mode == 'show' ? 0 : distance / 2;
+			
+		// Animate
+		animate.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
+			if(mode == 'hide') el.hide(); // Hide
+			$.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
+			if(o.callback) o.callback.apply(el[0], arguments); // Callback
+			el.dequeue();
+		}}); 
+		
+	});
+	
+};
+
+})(jQuery);
+/*
+ * jQuery UI Effects Drop
+ *
+ * Copyright (c) 2008 Aaron Eisenberger (aaronchi@gmail.com)
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ * 
+ * http://docs.jquery.com/UI/Effects/Drop
+ *
+ * Depends:
+ *	effects.core.js
+ */
+(function($) {
+
+$.effects.drop = function(o) {
+
+	return this.queue(function() {
+
+		// Create element
+		var el = $(this), props = ['position','top','left','opacity'];
+		
+		// Set options
+		var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode
+		var direction = o.options.direction || 'left'; // Default Direction
+		
+		// Adjust
+		$.effects.save(el, props); el.show(); // Save & Show
+		$.effects.createWrapper(el); // Create Wrapper
+		var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left';
+		var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';
+		var distance = o.options.distance || (ref == 'top' ? el.outerHeight({margin:true}) / 2 : el.outerWidth({margin:true}) / 2);
+		if (mode == 'show') el.css('opacity', 0).css(ref, motion == 'pos' ? -distance : distance); // Shift
+		
+		// Animation
+		var animation = {opacity: mode == 'show' ? 1 : 0};
+		animation[ref] = (mode == 'show' ? (motion == 'pos' ? '+=' : '-=') : (motion == 'pos' ? '-=' : '+=')) + distance;
+		
+		// Animate
+		el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
+			if(mode == 'hide') el.hide(); // Hide
+			$.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
+			if(o.callback) o.callback.apply(this, arguments); // Callback
+			el.dequeue();
+		}});
+		
+	});
+	
+};
+
+})(jQuery);
+/*
+ * jQuery UI Effects Explode
+ *
+ * Copyright (c) 2008 Paul Bakaus (ui.jquery.com)
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ * 
+ * http://docs.jquery.com/UI/Effects/Explode
+ *
+ * Depends:
+ *	effects.core.js
+ */
+(function($) {
+
+$.effects.explode = function(o) {
+
+	return this.queue(function() {
+
+	var rows = o.options.pieces ? Math.round(Math.sqrt(o.options.pieces)) : 3;
+	var cells = o.options.pieces ? Math.round(Math.sqrt(o.options.pieces)) : 3;
+	
+	o.options.mode = o.options.mode == 'toggle' ? ($(this).is(':visible') ? 'hide' : 'show') : o.options.mode;
+	var el = $(this).show().css('visibility', 'hidden');
+	var offset = el.offset();
+	
+	//Substract the margins - not fixing the problem yet.
+	offset.top -= parseInt(el.css("marginTop")) || 0;
+	offset.left -= parseInt(el.css("marginLeft")) || 0;
+	
+	var width = el.outerWidth(true);
+	var height = el.outerHeight(true);
+
+	for(var i=0;i<rows;i++) { // =
+		for(var j=0;j<cells;j++) { // ||
+			el
+				.clone()
+				.appendTo('body')
+				.wrap('<div></div>')
+				.css({
+					position: 'absolute',
+					visibility: 'visible',
+					left: -j*(width/cells),
+					top: -i*(height/rows)
+				})
+				.parent()
+				.addClass('effects-explode')
+				.css({
+					position: 'absolute',
+					overflow: 'hidden',
+					width: width/cells,
+					height: height/rows,
+					left: offset.left + j*(width/cells) + (o.options.mode == 'show' ? (j-Math.floor(cells/2))*(width/cells) : 0),
+					top: offset.top + i*(height/rows) + (o.options.mode == 'show' ? (i-Math.floor(rows/2))*(height/rows) : 0),
+					opacity: o.options.mode == 'show' ? 0 : 1
+				}).animate({
+					left: offset.left + j*(width/cells) + (o.options.mode == 'show' ? 0 : (j-Math.floor(cells/2))*(width/cells)),
+					top: offset.top + i*(height/rows) + (o.options.mode == 'show' ? 0 : (i-Math.floor(rows/2))*(height/rows)),
+					opacity: o.options.mode == 'show' ? 1 : 0
+				}, o.duration || 500);
+		}
+	}
+
+	// Set a timeout, to call the callback approx. when the other animations have finished
+	setTimeout(function() {
+		
+		o.options.mode == 'show' ? el.css({ visibility: 'visible' }) : el.css({ visibility: 'visible' }).hide();
+				if(o.callback) o.callback.apply(el[0]); // Callback
+				el.dequeue();
+				
+				$('.effects-explode').remove();
+		
+	}, o.duration || 500);
+	
+		
+	});
+	
+};
+
+})(jQuery);
+/*
+ * jQuery UI Effects Fold
+ *
+ * Copyright (c) 2008 Aaron Eisenberger (aaronchi@gmail.com)
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ * 
+ * http://docs.jquery.com/UI/Effects/Fold
+ *
+ * Depends:
+ *	effects.core.js
+ */
+(function($) {
+
+$.effects.fold = function(o) {
+
+	return this.queue(function() {
+
+		// Create element
+		var el = $(this), props = ['position','top','left'];
+		
+		// Set options
+		var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode
+		var size = o.options.size || 15; // Default fold size
+		var horizFirst = !(!o.options.horizFirst); // Ensure a boolean value
+		
+		// Adjust
+		$.effects.save(el, props); el.show(); // Save & Show
+		var wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper
+		var widthFirst = ((mode == 'show') != horizFirst);
+		var ref = widthFirst ? ['width', 'height'] : ['height', 'width'];
+		var distance = widthFirst ? [wrapper.width(), wrapper.height()] : [wrapper.height(), wrapper.width()];
+		var percent = /([0-9]+)%/.exec(size);
+		if(percent) size = parseInt(percent[1]) / 100 * distance[mode == 'hide' ? 0 : 1];
+		if(mode == 'show') wrapper.css(horizFirst ? {height: 0, width: size} : {height: size, width: 0}); // Shift
+		
+		// Animation
+		var animation1 = {}, animation2 = {};
+		animation1[ref[0]] = mode == 'show' ? distance[0] : size;
+		animation2[ref[1]] = mode == 'show' ? distance[1] : 0;
+		
+		// Animate
+		wrapper.animate(animation1, o.duration / 2, o.options.easing)
+		.animate(animation2, o.duration / 2, o.options.easing, function() {
+			if(mode == 'hide') el.hide(); // Hide
+			$.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
+			if(o.callback) o.callback.apply(el[0], arguments); // Callback
+			el.dequeue();
+		});
+		
+	});
+	
+};
+
+})(jQuery);
+/*
+ * jQuery UI Effects Highlight
+ *
+ * Copyright (c) 2008 Aaron Eisenberger (aaronchi@gmail.com)
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ * 
+ * http://docs.jquery.com/UI/Effects/Highlight
+ *
+ * Depends:
+ *	effects.core.js
+ */
+;(function($) {
+
+$.effects.highlight = function(o) {
+
+	return this.queue(function() {
+		
+		// Create element
+		var el = $(this), props = ['backgroundImage','backgroundColor','opacity'];
+		
+		// Set options
+		var mode = $.effects.setMode(el, o.options.mode || 'show'); // Set Mode
+		var color = o.options.color || "#ffff99"; // Default highlight color
+		var oldColor = el.css("backgroundColor");
+		
+		// Adjust
+		$.effects.save(el, props); el.show(); // Save & Show
+		el.css({backgroundImage: 'none', backgroundColor: color}); // Shift
+		
+		// Animation
+		var animation = {backgroundColor: oldColor };
+		if (mode == "hide") animation['opacity'] = 0;
+		
+		// Animate
+		el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
+			if(mode == "hide") el.hide();
+			$.effects.restore(el, props);
+		if (mode == "show" && jQuery.browser.msie) this.style.removeAttribute('filter'); 
+			if(o.callback) o.callback.apply(this, arguments);
+			el.dequeue();
+		}});
+		
+	});
+	
+};
+
+})(jQuery);
+/*
+ * jQuery UI Effects Pulsate
+ *
+ * Copyright (c) 2008 Aaron Eisenberger (aaronchi@gmail.com)
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ * 
+ * http://docs.jquery.com/UI/Effects/Pulsate
+ *
+ * Depends:
+ *	effects.core.js
+ */
+(function($) {
+
+$.effects.pulsate = function(o) {
+
+	return this.queue(function() {
+		
+		// Create element
+		var el = $(this);
+		
+		// Set options
+		var mode = $.effects.setMode(el, o.options.mode || 'show'); // Set Mode
+		var times = o.options.times || 5; // Default # of times
+		
+		// Adjust
+		if (mode == 'hide') times--;
+		if (el.is(':hidden')) { // Show fadeIn
+			el.css('opacity', 0);
+			el.show(); // Show
+			el.animate({opacity: 1}, o.duration / 2, o.options.easing);
+			times = times-2;
+		}
+		
+		// Animate
+		for (var i = 0; i < times; i++) { // Pulsate
+			el.animate({opacity: 0}, o.duration / 2, o.options.easing).animate({opacity: 1}, o.duration / 2, o.options.easing);
+		};
+		if (mode == 'hide') { // Last Pulse
+			el.animate({opacity: 0}, o.duration / 2, o.options.easing, function(){
+				el.hide(); // Hide
+				if(o.callback) o.callback.apply(this, arguments); // Callback
+			});
+		} else {
+			el.animate({opacity: 0}, o.duration / 2, o.options.easing).animate({opacity: 1}, o.duration / 2, o.options.easing, function(){
+				if(o.callback) o.callback.apply(this, arguments); // Callback
+			});
+		};
+		el.queue('fx', function() { el.dequeue(); });
+		el.dequeue();
+	});
+	
+};
+
+})(jQuery);
+/*
+ * jQuery UI Effects Scale
+ *
+ * Copyright (c) 2008 Aaron Eisenberger (aaronchi@gmail.com)
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ * 
+ * http://docs.jquery.com/UI/Effects/Scale
+ *
+ * Depends:
+ *	effects.core.js
+ */
+(function($) {
+
+$.effects.puff = function(o) {
+
+	return this.queue(function() {
+
+		// Create element
+		var el = $(this);
+	
+		// Set options
+		var options = $.extend(true, {}, o.options);
+		var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode
+		var percent = parseInt(o.options.percent) || 150; // Set default puff percent
+		options.fade = true; // It's not a puff if it doesn't fade! :)
+		var original = {height: el.height(), width: el.width()}; // Save original
+	
+		// Adjust
+		var factor = percent / 100;
+		el.from = (mode == 'hide') ? original : {height: original.height * factor, width: original.width * factor};
+	
+		// Animation
+		options.from = el.from;
+		options.percent = (mode == 'hide') ? percent : 100;
+		options.mode = mode;
+	
+		// Animate
+		el.effect('scale', options, o.duration, o.callback);
+		el.dequeue();
+	});
+	
+};
+
+$.effects.scale = function(o) {
+	
+	return this.queue(function() {
+	
+		// Create element
+		var el = $(this);
+
+		// Set options
+		var options = $.extend(true, {}, o.options);
+		var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode
+		var percent = parseInt(o.options.percent) || (parseInt(o.options.percent) == 0 ? 0 : (mode == 'hide' ? 0 : 100)); // Set default scaling percent
+		var direction = o.options.direction || 'both'; // Set default axis
+		var origin = o.options.origin; // The origin of the scaling
+		if (mode != 'effect') { // Set default origin and restore for show/hide
+			options.origin = origin || ['middle','center'];
+			options.restore = true;
+		}
+		var original = {height: el.height(), width: el.width()}; // Save original
+		el.from = o.options.from || (mode == 'show' ? {height: 0, width: 0} : original); // Default from state
+	
+		// Adjust
+		var factor = { // Set scaling factor
+			y: direction != 'horizontal' ? (percent / 100) : 1,
+			x: direction != 'vertical' ? (percent / 100) : 1
+		};
+		el.to = {height: original.height * factor.y, width: original.width * factor.x}; // Set to state
+		
+		if (o.options.fade) { // Fade option to support puff
+			if (mode == 'show') {el.from.opacity = 0; el.to.opacity = 1;};
+			if (mode == 'hide') {el.from.opacity = 1; el.to.opacity = 0;};
+		};
+	
+		// Animation
+		options.from = el.from; options.to = el.to; options.mode = mode;
+	
+		// Animate
+		el.effect('size', options, o.duration, o.callback);
+		el.dequeue();
+	});
+	
+};
+
+$.effects.size = function(o) {
+
+	return this.queue(function() {
+		
+		// Create element
+		var el = $(this), props = ['position','top','left','width','height','overflow','opacity'];
+		var props1 = ['position','top','left','overflow','opacity']; // Always restore
+		var props2 = ['width','height','overflow']; // Copy for children
+		var cProps = ['fontSize'];
+		var vProps = ['borderTopWidth', 'borderBottomWidth', 'paddingTop', 'paddingBottom'];
+		var hProps = ['borderLeftWidth', 'borderRightWidth', 'paddingLeft', 'paddingRight'];
+		
+		// Set options
+		var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode
+		var restore = o.options.restore || false; // Default restore
+		var scale = o.options.scale || 'both'; // Default scale mode
+		var origin = o.options.origin; // The origin of the sizing
+		var original = {height: el.height(), width: el.width()}; // Save original
+		el.from = o.options.from || original; // Default from state
+		el.to = o.options.to || original; // Default to state
+		// Adjust
+		if (origin) { // Calculate baseline shifts
+			var baseline = $.effects.getBaseline(origin, original);
+			el.from.top = (original.height - el.from.height) * baseline.y;
+			el.from.left = (original.width - el.from.width) * baseline.x;
+			el.to.top = (original.height - el.to.height) * baseline.y;
+			el.to.left = (original.width - el.to.width) * baseline.x;
+		};
+		var factor = { // Set scaling factor
+			from: {y: el.from.height / original.height, x: el.from.width / original.width},
+			to: {y: el.to.height / original.height, x: el.to.width / original.width}
+		};
+		if (scale == 'box' || scale == 'both') { // Scale the css box
+			if (factor.from.y != factor.to.y) { // Vertical props scaling
+				props = props.concat(vProps);
+				el.from = $.effects.setTransition(el, vProps, factor.from.y, el.from);
+				el.to = $.effects.setTransition(el, vProps, factor.to.y, el.to);
+			};
+			if (factor.from.x != factor.to.x) { // Horizontal props scaling
+				props = props.concat(hProps);
+				el.from = $.effects.setTransition(el, hProps, factor.from.x, el.from);
+				el.to = $.effects.setTransition(el, hProps, factor.to.x, el.to);
+			};
+		};
+		if (scale == 'content' || scale == 'both') { // Scale the content
+			if (factor.from.y != factor.to.y) { // Vertical props scaling
+				props = props.concat(cProps);
+				el.from = $.effects.setTransition(el, cProps, factor.from.y, el.from);
+				el.to = $.effects.setTransition(el, cProps, factor.to.y, el.to);
+			};
+		};
+		$.effects.save(el, restore ? props : props1); el.show(); // Save & Show
+		$.effects.createWrapper(el); // Create Wrapper
+		el.css('overflow','hidden').css(el.from); // Shift
+		
+		// Animate
+		if (scale == 'content' || scale == 'both') { // Scale the children
+			vProps = vProps.concat(['marginTop','marginBottom']).concat(cProps); // Add margins/font-size
+			hProps = hProps.concat(['marginLeft','marginRight']); // Add margins
+			props2 = props.concat(vProps).concat(hProps); // Concat
+			el.find("*[width]").each(function(){
+				child = $(this);
+				if (restore) $.effects.save(child, props2);
+				var c_original = {height: child.height(), width: child.width()}; // Save original
+				child.from = {height: c_original.height * factor.from.y, width: c_original.width * factor.from.x};
+				child.to = {height: c_original.height * factor.to.y, width: c_original.width * factor.to.x};
+				if (factor.from.y != factor.to.y) { // Vertical props scaling
+					child.from = $.effects.setTransition(child, vProps, factor.from.y, child.from);
+					child.to = $.effects.setTransition(child, vProps, factor.to.y, child.to);
+				};
+				if (factor.from.x != factor.to.x) { // Horizontal props scaling
+					child.from = $.effects.setTransition(child, hProps, factor.from.x, child.from);
+					child.to = $.effects.setTransition(child, hProps, factor.to.x, child.to);
+				};
+				child.css(child.from); // Shift children
+				child.animate(child.to, o.duration, o.options.easing, function(){
+					if (restore) $.effects.restore(child, props2); // Restore children
+				}); // Animate children
+			});
+		};
+		
+		// Animate
+		el.animate(el.to, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
+			if(mode == 'hide') el.hide(); // Hide
+			$.effects.restore(el, restore ? props : props1); $.effects.removeWrapper(el); // Restore
+			if(o.callback) o.callback.apply(this, arguments); // Callback
+			el.dequeue();
+		}}); 
+		
+	});
+
+};
+
+})(jQuery);
+/*
+ * jQuery UI Effects Shake
+ *
+ * Copyright (c) 2008 Aaron Eisenberger (aaronchi@gmail.com)
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ * 
+ * http://docs.jquery.com/UI/Effects/Shake
+ *
+ * Depends:
+ *	effects.core.js
+ */
+(function($) {
+
+$.effects.shake = function(o) {
+
+	return this.queue(function() {
+
+		// Create element
+		var el = $(this), props = ['position','top','left'];
+		
+		// Set options
+		var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode
+		var direction = o.options.direction || 'left'; // Default direction
+		var distance = o.options.distance || 20; // Default distance
+		var times = o.options.times || 3; // Default # of times
+		var speed = o.duration || o.options.duration || 140; // Default speed per shake
+		
+		// Adjust
+		$.effects.save(el, props); el.show(); // Save & Show
+		$.effects.createWrapper(el); // Create Wrapper
+		var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left';
+		var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';
+		
+		// Animation
+		var animation = {}, animation1 = {}, animation2 = {};
+		animation[ref] = (motion == 'pos' ? '-=' : '+=')  + distance;
+		animation1[ref] = (motion == 'pos' ? '+=' : '-=')  + distance * 2;
+		animation2[ref] = (motion == 'pos' ? '-=' : '+=')  + distance * 2;
+		
+		// Animate
+		el.animate(animation, speed, o.options.easing);
+		for (var i = 1; i < times; i++) { // Shakes
+			el.animate(animation1, speed, o.options.easing).animate(animation2, speed, o.options.easing);
+		};
+		el.animate(animation1, speed, o.options.easing).
+		animate(animation, speed / 2, o.options.easing, function(){ // Last shake
+			$.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
+			if(o.callback) o.callback.apply(this, arguments); // Callback
+		});
+		el.queue('fx', function() { el.dequeue(); });
+		el.dequeue();
+	});
+	
+};
+
+})(jQuery);
+/*
+ * jQuery UI Effects Slide
+ *
+ * Copyright (c) 2008 Aaron Eisenberger (aaronchi@gmail.com)
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ * 
+ * http://docs.jquery.com/UI/Effects/Slide
+ *
+ * Depends:
+ *	effects.core.js
+ */
+(function($) {
+
+$.effects.slide = function(o) {
+
+	return this.queue(function() {
+
+		// Create element
+		var el = $(this), props = ['position','top','left'];
+		
+		// Set options
+		var mode = $.effects.setMode(el, o.options.mode || 'show'); // Set Mode
+		var direction = o.options.direction || 'left'; // Default Direction
+		
+		// Adjust
+		$.effects.save(el, props); el.show(); // Save & Show
+		$.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper
+		var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left';
+		var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';
+		var distance = o.options.distance || (ref == 'top' ? el.outerHeight({margin:true}) : el.outerWidth({margin:true}));
+		if (mode == 'show') el.css(ref, motion == 'pos' ? -distance : distance); // Shift
+		
+		// Animation
+		var animation = {};
+		animation[ref] = (mode == 'show' ? (motion == 'pos' ? '+=' : '-=') : (motion == 'pos' ? '-=' : '+=')) + distance;
+		
+		// Animate
+		el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
+			if(mode == 'hide') el.hide(); // Hide
+			$.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
+			if(o.callback) o.callback.apply(this, arguments); // Callback
+			el.dequeue();
+		}});
+		
+	});
+	
+};
+
+})(jQuery);
+/*
+ * jQuery UI Effects Transfer
+ *
+ * Copyright (c) 2008 Aaron Eisenberger (aaronchi@gmail.com)
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ * 
+ * http://docs.jquery.com/UI/Effects/Transfer
+ *
+ * Depends:
+ *	effects.core.js
+ */
+(function($) {
+
+$.effects.transfer = function(o) {
+
+	return this.queue(function() {
+
+		// Create element
+		var el = $(this);
+		
+		// Set options
+		var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode
+		var target = $(o.options.to); // Find Target
+		var position = el.offset();
+		var transfer = $('<div class="ui-effects-transfer"></div>').appendTo(document.body);
+		if(o.options.className) transfer.addClass(o.options.className);
+		
+		// Set target css
+		transfer.addClass(o.options.className);
+		transfer.css({
+			top: position.top,
+			left: position.left,
+			height: el.outerHeight() - parseInt(transfer.css('borderTopWidth')) - parseInt(transfer.css('borderBottomWidth')),
+			width: el.outerWidth() - parseInt(transfer.css('borderLeftWidth')) - parseInt(transfer.css('borderRightWidth')),
+			position: 'absolute'
+		});
+		
+		// Animation
+		position = target.offset();
+		animation = {
+			top: position.top,
+			left: position.left,
+			height: target.outerHeight() - parseInt(transfer.css('borderTopWidth')) - parseInt(transfer.css('borderBottomWidth')),
+			width: target.outerWidth() - parseInt(transfer.css('borderLeftWidth')) - parseInt(transfer.css('borderRightWidth'))
+		};
+		
+		// Animate
+		transfer.animate(animation, o.duration, o.options.easing, function() {
+			transfer.remove(); // Remove div
+			if(o.callback) o.callback.apply(el[0], arguments); // Callback
+			el.dequeue();
+		}); 
+		
+	});
+	
+};
+
+})(jQuery);
+/*
+ * jQuery UI Accordion
+ * 
+ * Copyright (c) 2007, 2008 Jörn Zaefferer
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ *
+ * http://docs.jquery.com/UI/Accordion
+ *
+ * Depends:
+ *	ui.core.js
+ */
+(function($) {
+
+$.widget("ui.accordion", {
+	init: function() {
+		var options = this.options;
+
+		if ( options.navigation ) {
+			var current = this.element.find("a").filter(options.navigationFilter);
+			if ( current.length ) {
+				if ( current.filter(options.header).length ) {
+					options.active = current;
+				} else {
+					options.active = current.parent().parent().prev();
+					current.addClass("current");
+				}
+			}
+		}
+
+		// calculate active if not specified, using the first header
+		options.headers = this.element.find(options.header);
+		options.active = findActive(options.headers, options.active);
+
+		// IE7-/Win - Extra vertical space in Lists fixed
+		if ($.browser.msie) {
+			this.element.find('a').css('zoom', '1');
+		}
+
+		if (!this.element.hasClass("ui-accordion")) {
+			this.element.addClass("ui-accordion");
+			$("<span class='ui-accordion-left'/>").insertBefore(options.headers);
+			$("<span class='ui-accordion-right'/>").appendTo(options.headers);
+			options.headers.addClass("ui-accordion-header").attr("tabindex", "0");
+		}
+
+		this.size();
+
+		options.headers
+			.not(options.active || "")
+			.next()
+			.hide();
+		options.active.parent().andSelf().addClass(options.selectedClass);
+
+		if (options.event) {
+			this.element.bind((options.event) + ".accordion", clickHandler);
+		}
+	},
+	activate: function(index) {
+		// call clickHandler with custom event
+		clickHandler.call(this.element[0], {
+			target: findActive( this.options.headers, index )[0]
+		});
+	},
+	destroy: function() {
+		this.options.headers.next().css("display", "");
+		if ( this.options.fillSpace || this.options.autoHeight ) {
+			this.options.headers.next().css("height", "");
+		}
+		$.removeData(this.element[0], "accordion");
+		this.element.removeClass("ui-accordion").unbind(".accordion");
+	}
+,	size: function () {
+		var options = this.options;
+		var maxHeight = 0, maxPadding = 0;
+		if ( options.fillSpace ) {
+			maxHeight = this.element.parent().height();
+			options.headers.each(function() {
+				maxHeight -= $(this).outerHeight();
+			});
+			options.headers.next().each(function() {
+				maxPadding = Math.max(maxPadding, $(this).innerHeight() - $(this).height());
+			}).height(maxHeight - maxPadding);
+		} else if ( options.autoHeight ) {
+			options.headers.next().each(function() {
+				maxHeight = Math.max(maxHeight, $(this).outerHeight());
+			}).height(maxHeight);
+		}
+	}
+});
+
+function scopeCallback(callback, scope) {
+	return function() {
+		return callback.apply(scope, arguments);
+	};
+};
+
+function completed(cancel) {
+	// if removed while animated data can be empty
+	if (!$.data(this, "accordion")) {
+		return;
+	}
+	
+	var instance = $.data(this, "accordion");
+	var options = instance.options;
+	options.running = cancel ? 0 : --options.running;
+	if ( options.running ) {
+		return;
+	}
+	if ( options.clearStyle ) {
+		options.toShow.add(options.toHide).css({
+			height: "",
+			overflow: ""
+		});
+	}
+	$(this).triggerHandler("accordionchange", [$.event.fix({type: 'accordionchange', target: instance.element[0]}), options.data], options.change);
+}
+
+function toggle(toShow, toHide, data, clickedActive, down) {
+	var options = $.data(this, "accordion").options;
+	options.toShow = toShow;
+	options.toHide = toHide;
+	options.data = data;
+	var complete = scopeCallback(completed, this);
+	
+	// count elements to animate
+	options.running = toHide.size() === 0 ? toShow.size() : toHide.size();
+	
+	if ( options.animated ) {
+		if ( !options.alwaysOpen && clickedActive ) {
+			$.ui.accordion.animations[options.animated]({
+				toShow: jQuery([]),
+				toHide: toHide,
+				complete: complete,
+				down: down,
+				autoHeight: options.autoHeight
+			});
+		} else {
+			$.ui.accordion.animations[options.animated]({
+				toShow: toShow,
+				toHide: toHide,
+				complete: complete,
+				down: down,
+				autoHeight: options.autoHeight
+			});
+		}
+	} else {
+		if ( !options.alwaysOpen && clickedActive ) {
+			toShow.toggle();
+		} else {
+			toHide.hide();
+			toShow.show();
+		}
+		complete(true);
+	}
+}
+
+function clickHandler(event) {
+	var options = $.data(this, "accordion").options;
+	if (options.disabled) {
+		return false;
+	}
+	
+	// called only when using activate(false) to close all parts programmatically
+	if ( !event.target && !options.alwaysOpen ) {
+		options.active.parent().andSelf().toggleClass(options.selectedClass);
+		var toHide = options.active.next(),
+			data = {
+				options: options,
+				newHeader: jQuery([]),
+				oldHeader: options.active,
+				newContent: jQuery([]),
+				oldContent: toHide
+			},
+			toShow = (options.active = $([]));
+		toggle.call(this, toShow, toHide, data );
+		return false;
+	}
+	// get the click target
+	var clicked = $(event.target);
+	
+	// due to the event delegation model, we have to check if one
+	// of the parent elements is our actual header, and find that
+	// otherwise stick with the initial target
+	clicked = $( clicked.parents(options.header)[0] || clicked );
+	
+	var clickedActive = clicked[0] == options.active[0];
+	
+	// if animations are still active, or the active header is the target, ignore click
+	if (options.running || (options.alwaysOpen && clickedActive)) {
+		return false;
+	}
+	if (!clicked.is(options.header)) {
+		return;
+	}
+	
+	// switch classes
+	options.active.parent().andSelf().toggleClass(options.selectedClass);
+	if ( !clickedActive ) {
+		clicked.parent().andSelf().addClass(options.selectedClass);
+	}
+	
+	// find elements to show and hide
+	var toShow = clicked.next(),
+		toHide = options.active.next(),
+		//data = [clicked, options.active, toShow, toHide],
+		data = {
+			options: options,
+			newHeader: clicked,
+			oldHeader: options.active,
+			newContent: toShow,
+			oldContent: toHide
+		},
+		down = options.headers.index( options.active[0] ) > options.headers.index( clicked[0] );
+	
+	options.active = clickedActive ? $([]) : clicked;
+	toggle.call(this, toShow, toHide, data, clickedActive, down );
+
+	return false;
+};
+
+function findActive(headers, selector) {
+	return selector != undefined
+		? typeof selector == "number"
+			? headers.filter(":eq(" + selector + ")")
+			: headers.not(headers.not(selector))
+		: selector === false
+			? $([])
+			: headers.filter(":eq(0)");
+}
+
+$.extend($.ui.accordion, {
+	defaults: {
+		selectedClass: "selected",
+		alwaysOpen: true,
+		animated: 'slide',
+		event: "click",
+		header: "a",
+		autoHeight: true,
+		running: 0,
+		navigationFilter: function() {
+			return this.href.toLowerCase() == location.href.toLowerCase();
+		}
+	},
+	animations: {
+		slide: function(options, additions) {
+			options = $.extend({
+				easing: "swing",
+				duration: 300
+			}, options, additions);
+			if ( !options.toHide.size() ) {
+				options.toShow.animate({height: "show"}, options);
+				return;
+			}
+			var hideHeight = options.toHide.height(),
+				showHeight = options.toShow.height(),
+				difference = showHeight / hideHeight;
+			options.toShow.css({ height: 0, overflow: 'hidden' }).show();
+			options.toHide.filter(":hidden").each(options.complete).end().filter(":visible").animate({height:"hide"},{
+				step: function(now) {
+					var current = (hideHeight - now) * difference;
+					if ($.browser.msie || $.browser.opera) {
+						current = Math.ceil(current);
+					}
+					options.toShow.height( current );
+				},
+				duration: options.duration,
+				easing: options.easing,
+				complete: function() {
+					if ( !options.autoHeight ) {
+						options.toShow.css("height", "auto");
+					}
+					options.complete();
+				}
+			});
+		},
+		bounceslide: function(options) {
+			this.slide(options, {
+				easing: options.down ? "bounceout" : "swing",
+				duration: options.down ? 1000 : 200
+			});
+		},
+		easeslide: function(options) {
+			this.slide(options, {
+				easing: "easeinout",
+				duration: 700
+			});
+		}
+	}
+});
+
+// deprecated, use accordion("activate", index) instead
+$.fn.activate = function(index) {
+	return this.accordion("activate", index);
+};
+
+})(jQuery);
+/*
+ * jQuery UI Datepicker
+ *
+ * Copyright (c) 2006, 2007, 2008 Marc Grabanski
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ * 
+ * http://docs.jquery.com/UI/Datepicker
+ *
+ * Depends:
+ *	ui.core.js
+ *
+ * Marc Grabanski (m@marcgrabanski.com) and Keith Wood (kbwood@virginbroadband.com.au).
+ */
+   
+(function($) { // hide the namespace
+
+var PROP_NAME = 'datepicker';
+
+/* Date picker manager.
+   Use the singleton instance of this class, $.datepicker, to interact with the date picker.
+   Settings for (groups of) date pickers are maintained in an instance object,
+   allowing multiple different settings on the same page. */
+
+function Datepicker() {
+	this.debug = false; // Change this to true to start debugging
+	this._curInst = null; // The current instance in use
+	this._disabledInputs = []; // List of date picker inputs that have been disabled
+	this._datepickerShowing = false; // True if the popup picker is showing , false if not
+	this._inDialog = false; // True if showing within a "dialog", false if not
+	this._mainDivId = 'ui-datepicker-div'; // The ID of the main datepicker division
+	this._appendClass = 'ui-datepicker-append'; // The name of the append marker class
+	this._triggerClass = 'ui-datepicker-trigger'; // The name of the trigger marker class
+	this._dialogClass = 'ui-datepicker-dialog'; // The name of the dialog marker class
+	this._promptClass = 'ui-datepicker-prompt'; // The name of the dialog prompt marker class
+	this._unselectableClass = 'ui-datepicker-unselectable'; // The name of the unselectable cell marker class
+	this._currentClass = 'ui-datepicker-current-day'; // The name of the current day marker class
+	this.regional = []; // Available regional settings, indexed by language code
+	this.regional[''] = { // Default regional settings
+		clearText: 'Clear', // Display text for clear link
+		clearStatus: 'Erase the current date', // Status text for clear link
+		closeText: 'Close', // Display text for close link
+		closeStatus: 'Close without change', // Status text for close link
+		prevText: '&#x3c;Prev', // Display text for previous month link
+		prevStatus: 'Show the previous month', // Status text for previous month link
+		nextText: 'Next&#x3e;', // Display text for next month link
+		nextStatus: 'Show the next month', // Status text for next month link
+		currentText: 'Today', // Display text for current month link
+		currentStatus: 'Show the current month', // Status text for current month link
+		monthNames: ['January','February','March','April','May','June',
+			'July','August','September','October','November','December'], // Names of months for drop-down and formatting
+		monthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], // For formatting
+		monthStatus: 'Show a different month', // Status text for selecting a month
+		yearStatus: 'Show a different year', // Status text for selecting a year
+		weekHeader: 'Wk', // Header for the week of the year column
+		weekStatus: 'Week of the year', // Status text for the week of the year column
+		dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], // For formatting
+		dayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], // For formatting
+		dayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'], // Column headings for days starting at Sunday
+		dayStatus: 'Set DD as first week day', // Status text for the day of the week selection
+		dateStatus: 'Select DD, M d', // Status text for the date selection
+		dateFormat: 'mm/dd/yy', // See format options on parseDate
+		firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...
+		initStatus: 'Select a date', // Initial Status text on opening
+		isRTL: false // True if right-to-left language, false if left-to-right
+	};
+	this._defaults = { // Global defaults for all the date picker instances
+		showOn: 'focus', // 'focus' for popup on focus,
+			// 'button' for trigger button, or 'both' for either
+		showAnim: 'show', // Name of jQuery animation for popup
+		showOptions: {}, // Options for enhanced animations
+		defaultDate: null, // Used when field is blank: actual date,
+			// +/-number for offset from today, null for today
+		appendText: '', // Display text following the input box, e.g. showing the format
+		buttonText: '...', // Text for trigger button
+		buttonImage: '', // URL for trigger button image
+		buttonImageOnly: false, // True if the image appears alone, false if it appears on a button
+		closeAtTop: true, // True to have the clear/close at the top,
+			// false to have them at the bottom
+		mandatory: false, // True to hide the Clear link, false to include it
+		hideIfNoPrevNext: false, // True to hide next/previous month links
+			// if not applicable, false to just disable them
+		navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links
+		gotoCurrent: false, // True if today link goes back to current selection instead
+		changeMonth: true, // True if month can be selected directly, false if only prev/next
+		changeYear: true, // True if year can be selected directly, false if only prev/next
+		yearRange: '-10:+10', // Range of years to display in drop-down,
+			// either relative to current year (-nn:+nn) or absolute (nnnn:nnnn)
+		changeFirstDay: true, // True to click on day name to change, false to remain as set
+		highlightWeek: false, // True to highlight the selected week
+		showOtherMonths: false, // True to show dates in other months, false to leave blank
+		showWeeks: false, // True to show week of the year, false to omit
+		calculateWeek: this.iso8601Week, // How to calculate the week of the year,
+			// takes a Date and returns the number of the week for it
+		shortYearCutoff: '+10', // Short year values < this are in the current century,
+			// > this are in the previous century, 
+			// string value starting with '+' for current year + value
+		showStatus: false, // True to show status bar at bottom, false to not show it
+		statusForDate: this.dateStatus, // Function to provide status text for a date -
+			// takes date and instance as parameters, returns display text
+		minDate: null, // The earliest selectable date, or null for no limit
+		maxDate: null, // The latest selectable date, or null for no limit
+		duration: 'normal', // Duration of display/closure
+		beforeShowDay: null, // Function that takes a date and returns an array with
+			// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or '', 
+			// [2] = cell title (optional), e.g. $.datepicker.noWeekends
+		beforeShow: null, // Function that takes an input field and
+			// returns a set of custom settings for the date picker
+		onSelect: null, // Define a callback function when a date is selected
+		onChangeMonthYear: null, // Define a callback function when the month or year is changed
+		onClose: null, // Define a callback function when the datepicker is closed
+		numberOfMonths: 1, // Number of months to show at a time
+		stepMonths: 1, // Number of months to step back/forward
+		rangeSelect: false, // Allows for selecting a date range on one date picker
+		rangeSeparator: ' - ', // Text between two dates in a range
+		altField: '', // Selector for an alternate field to store selected dates into
+		altFormat: '' // The date format to use for the alternate field
+	};
+	$.extend(this._defaults, this.regional['']);
+	this.dpDiv = $('<div id="' + this._mainDivId + '" style="display: none;"></div>');
+}
+
+$.extend(Datepicker.prototype, {
+	/* Class name added to elements to indicate already configured with a date picker. */
+	markerClassName: 'hasDatepicker',
+
+	/* Debug logging (if enabled). */
+	log: function () {
+		if (this.debug)
+			console.log.apply('', arguments);
+	},
+	
+	/* Override the default settings for all instances of the date picker. 
+	   @param  settings  object - the new settings to use as defaults (anonymous object)
+	   @return the manager object */
+	setDefaults: function(settings) {
+		extendRemove(this._defaults, settings || {});
+		return this;
+	},
+
+	/* Attach the date picker to a jQuery selection.
+	   @param  target    element - the target input field or division or span
+	   @param  settings  object - the new settings to use for this date picker instance (anonymous) */
+	_attachDatepicker: function(target, settings) {
+		// check for settings on the control itself - in namespace 'date:'
+		var inlineSettings = null;
+		for (attrName in this._defaults) {
+			var attrValue = target.getAttribute('date:' + attrName);
+			if (attrValue) {
+				inlineSettings = inlineSettings || {};
+				try {
+					inlineSettings[attrName] = eval(attrValue);
+				} catch (err) {
+					inlineSettings[attrName] = attrValue;
+				}
+			}
+		}
+		var nodeName = target.nodeName.toLowerCase();
+		var inline = (nodeName == 'div' || nodeName == 'span');
+		if (!target.id)
+			target.id = 'dp' + new Date().getTime();
+		var inst = this._newInst($(target), inline);
+		inst.settings = $.extend({}, settings || {}, inlineSettings || {}); 
+		if (nodeName == 'input') {
+			this._connectDatepicker(target, inst);
+		} else if (inline) {
+			this._inlineDatepicker(target, inst);
+		}
+	},
+
+	/* Create a new instance object. */
+	_newInst: function(target, inline) {
+		return {id: target[0].id, input: target, // associated target
+			selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection
+			drawMonth: 0, drawYear: 0, // month being drawn
+			inline: inline, // is datepicker inline or not
+			dpDiv: (!inline ? this.dpDiv : // presentation div
+			$('<div class="ui-datepicker-inline"></div>'))};
+	},
+
+	/* Attach the date picker to an input field. */
+	_connectDatepicker: function(target, inst) {
+		var input = $(target);
+		if (input.hasClass(this.markerClassName))
+			return;
+		var appendText = this._get(inst, 'appendText');
+		var isRTL = this._get(inst, 'isRTL');
+		if (appendText)
+			input[isRTL ? 'before' : 'after']('<span class="' + this._appendClass + '">' + appendText + '</span>');
+		var showOn = this._get(inst, 'showOn');
+		if (showOn == 'focus' || showOn == 'both') // pop-up date picker when in the marked field
+			input.focus(this._showDatepicker);
+		if (showOn == 'button' || showOn == 'both') { // pop-up date picker when button clicked
+			var buttonText = this._get(inst, 'buttonText');
+			var buttonImage = this._get(inst, 'buttonImage');
+			var trigger = $(this._get(inst, 'buttonImageOnly') ? 
+				$('<img/>').addClass(this._triggerClass).
+					attr({ src: buttonImage, alt: buttonText, title: buttonText }) :
+				$('<button type="button"></button>').addClass(this._triggerClass).
+					html(buttonImage == '' ? buttonText : $('<img/>').attr(
+					{ src:buttonImage, alt:buttonText, title:buttonText })));
+			input[isRTL ? 'before' : 'after'](trigger);
+			trigger.click(function() {
+				if ($.datepicker._datepickerShowing && $.datepicker._lastInput == target)
+					$.datepicker._hideDatepicker();
+				else
+					$.datepicker._showDatepicker(target);
+				return false;
+			});
+		}
+		input.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).
+			bind("setData.datepicker", function(event, key, value) {
+				inst.settings[key] = value;
+			}).bind("getData.datepicker", function(event, key) {
+				return this._get(inst, key);
+			});
+		$.data(target, PROP_NAME, inst);
+	},
+
+	/* Attach an inline date picker to a div. */
+	_inlineDatepicker: function(target, inst) {
+		var input = $(target);
+		if (input.hasClass(this.markerClassName))
+			return;
+		input.addClass(this.markerClassName).append(inst.dpDiv).
+			bind("setData.datepicker", function(event, key, value){
+				inst.settings[key] = value;
+			}).bind("getData.datepicker", function(event, key){
+				return this._get(inst, key);
+			});
+		$.data(target, PROP_NAME, inst);
+		this._setDate(inst, this._getDefaultDate(inst));
+		this._updateDatepicker(inst);
+	},
+
+	/* Tidy up after displaying the date picker. */
+	_inlineShow: function(inst) {
+		var numMonths = this._getNumberOfMonths(inst); // fix width for dynamic number of date pickers
+		inst.dpDiv.width(numMonths[1] * $('.ui-datepicker', inst.dpDiv[0]).width());
+	}, 
+
+	/* Pop-up the date picker in a "dialog" box.
+	   @param  input     element - ignored
+	   @param  dateText  string - the initial date to display (in the current format)
+	   @param  onSelect  function - the function(dateText) to call when a date is selected
+	   @param  settings  object - update the dialog date picker instance's settings (anonymous object)
+	   @param  pos       int[2] - coordinates for the dialog's position within the screen or
+	                     event - with x/y coordinates or
+	                     leave empty for default (screen centre)
+	   @return the manager object */
+	_dialogDatepicker: function(input, dateText, onSelect, settings, pos) {
+		var inst = this._dialogInst; // internal instance
+		if (!inst) {
+			var id = 'dp' + new Date().getTime();
+			this._dialogInput = $('<input type="text" id="' + id +
+				'" size="1" style="position: absolute; top: -100px;"/>');
+			this._dialogInput.keydown(this._doKeyDown);
+			$('body').append(this._dialogInput);
+			inst = this._dialogInst = this._newInst(this._dialogInput, false);
+			inst.settings = {};
+			$.data(this._dialogInput[0], PROP_NAME, inst);
+		}
+		extendRemove(inst.settings, settings || {});
+		this._dialogInput.val(dateText);
+
+		this._pos = (pos ? (pos.length ? pos : [pos.pageX, pos.pageY]) : null);
+		if (!this._pos) {
+			var browserWidth = window.innerWidth || document.documentElement.clientWidth ||	document.body.clientWidth;
+			var browserHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
+			var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
+			var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
+			this._pos = // should use actual width/height below
+				[(browserWidth / 2) - 100 + scrollX, (browserHeight / 2) - 150 + scrollY];
+		}
+
+		// move input on screen for focus, but hidden behind dialog
+		this._dialogInput.css('left', this._pos[0] + 'px').css('top', this._pos[1] + 'px');
+		inst.settings.onSelect = onSelect;
+		this._inDialog = true;
+		this.dpDiv.addClass(this._dialogClass);
+		this._showDatepicker(this._dialogInput[0]);
+		if ($.blockUI)
+			$.blockUI(this.dpDiv);
+		$.data(this._dialogInput[0], PROP_NAME, inst);
+		return this;
+	},
+
+	/* Detach a datepicker from its control.
+	   @param  target    element - the target input field or division or span */
+	_destroyDatepicker: function(target) {
+		var nodeName = target.nodeName.toLowerCase();
+		var $target = $(target);
+		$.removeData(target, PROP_NAME);
+		if (nodeName == 'input') {
+			$target.siblings('.' + this._appendClass).remove().end().
+				siblings('.' + this._triggerClass).remove().end().
+				removeClass(this.markerClassName).
+				unbind('focus', this._showDatepicker).
+				unbind('keydown', this._doKeyDown).
+				unbind('keypress', this._doKeyPress);
+		} else if (nodeName == 'div' || nodeName == 'span')
+			$target.removeClass(this.markerClassName).empty();
+	},
+
+	/* Enable the date picker to a jQuery selection.
+	   @param  target    element - the target input field or division or span */
+	_enableDatepicker: function(target) {
+		target.disabled = false;
+		$(target).siblings('button.' + this._triggerClass).each(function() { this.disabled = false; }).end().
+			siblings('img.' + this._triggerClass).css({opacity: '1.0', cursor: ''});
+		this._disabledInputs = $.map(this._disabledInputs,
+			function(value) { return (value == target ? null : value); }); // delete entry
+	},
+
+	/* Disable the date picker to a jQuery selection.
+	   @param  target    element - the target input field or division or span */
+	_disableDatepicker: function(target) {
+		target.disabled = true;
+		$(target).siblings('button.' + this._triggerClass).each(function() { this.disabled = true; }).end().
+			siblings('img.' + this._triggerClass).css({opacity: '0.5', cursor: 'default'});
+		this._disabledInputs = $.map(this._disabledInputs,
+			function(value) { return (value == target ? null : value); }); // delete entry
+		this._disabledInputs[this._disabledInputs.length] = target;
+	},
+
+	/* Is the first field in a jQuery collection disabled as a datepicker?
+	   @param  target    element - the target input field or division or span
+	   @return boolean - true if disabled, false if enabled */
+	_isDisabledDatepicker: function(target) {
+		if (!target)
+			return false;
+		for (var i = 0; i < this._disabledInputs.length; i++) {
+			if (this._disabledInputs[i] == target)
+				return true;
+		}
+		return false;
+	},
+
+	/* Update the settings for a date picker attached to an input field or division.
+	   @param  target  element - the target input field or division or span
+	   @param  name    object - the new settings to update or
+	                   string - the name of the setting to change or
+	   @param  value   any - the new value for the setting (omit if above is an object) */
+	_changeDatepicker: function(target, name, value) {
+		var settings = name || {};
+		if (typeof name == 'string') {
+			settings = {};
+			settings[name] = value;
+		}
+		if (inst = $.data(target, PROP_NAME)) {
+			extendRemove(inst.settings, settings);
+			this._updateDatepicker(inst);
+		}
+	},
+
+	/* Set the dates for a jQuery selection.
+	   @param  target   element - the target input field or division or span
+	   @param  date     Date - the new date
+	   @param  endDate  Date - the new end date for a range (optional) */
+	_setDateDatepicker: function(target, date, endDate) {
+		var inst = $.data(target, PROP_NAME);
+		if (inst) {
+			this._setDate(inst, date, endDate);
+			this._updateDatepicker(inst);
+		}
+	},
+
+	/* Get the date(s) for the first entry in a jQuery selection.
+	   @param  target  element - the target input field or division or span
+	   @return Date - the current date or
+	           Date[2] - the current dates for a range */
+	_getDateDatepicker: function(target) {
+		var inst = $.data(target, PROP_NAME);
+		if (inst)
+			this._setDateFromField(inst); 
+		return (inst ? this._getDate(inst) : null);
+	},
+
+	/* Handle keystrokes. */
+	_doKeyDown: function(e) {
+		var inst = $.data(e.target, PROP_NAME);
+		var handled = true;
+		if ($.datepicker._datepickerShowing)
+			switch (e.keyCode) {
+				case 9:  $.datepicker._hideDatepicker(null, '');
+						break; // hide on tab out
+				case 13: $.datepicker._selectDay(e.target, inst.selectedMonth, inst.selectedYear,
+							$('td.ui-datepicker-days-cell-over', inst.dpDiv)[0]);
+						return false; // don't submit the form
+						break; // select the value on enter
+				case 27: $.datepicker._hideDatepicker(null, $.datepicker._get(inst, 'duration'));
+						break; // hide on escape
+				case 33: $.datepicker._adjustDate(e.target, (e.ctrlKey ? -1 :
+							-$.datepicker._get(inst, 'stepMonths')), (e.ctrlKey ? 'Y' : 'M'));
+						break; // previous month/year on page up/+ ctrl
+				case 34: $.datepicker._adjustDate(e.target, (e.ctrlKey ? +1 :
+							+$.datepicker._get(inst, 'stepMonths')), (e.ctrlKey ? 'Y' : 'M'));
+						break; // next month/year on page down/+ ctrl
+				case 35: if (e.ctrlKey) $.datepicker._clearDate(e.target);
+						break; // clear on ctrl+end
+				case 36: if (e.ctrlKey) $.datepicker._gotoToday(e.target);
+						break; // current on ctrl+home
+				case 37: if (e.ctrlKey) $.datepicker._adjustDate(e.target, -1, 'D');
+						break; // -1 day on ctrl+left
+				case 38: if (e.ctrlKey) $.datepicker._adjustDate(e.target, -7, 'D');
+						break; // -1 week on ctrl+up
+				case 39: if (e.ctrlKey) $.datepicker._adjustDate(e.target, +1, 'D');
+						break; // +1 day on ctrl+right
+				case 40: if (e.ctrlKey) $.datepicker._adjustDate(e.target, +7, 'D');
+						break; // +1 week on ctrl+down
+				default: handled = false;
+			}
+		else if (e.keyCode == 36 && e.ctrlKey) // display the date picker on ctrl+home
+			$.datepicker._showDatepicker(this);
+		else
+			handled = false;
+		if (handled) {
+			e.preventDefault();
+			e.stopPropagation();
+		}
+	},
+
+	/* Filter entered characters - based on date format. */
+	_doKeyPress: function(e) {
+		var inst = $.data(e.target, PROP_NAME);
+		var chars = $.datepicker._possibleChars($.datepicker._get(inst, 'dateFormat'));
+		var chr = String.fromCharCode(e.charCode == undefined ? e.keyCode : e.charCode);
+		return e.ctrlKey || (chr < ' ' || !chars || chars.indexOf(chr) > -1);
+	},
+
+	/* Pop-up the date picker for a given input field.
+	   @param  input  element - the input field attached to the date picker or
+	                  event - if triggered by focus */
+	_showDatepicker: function(input) {
+		input = input.target || input;
+		if (input.nodeName.toLowerCase() != 'input') // find from button/image trigger
+			input = $('input', input.parentNode)[0];
+		if ($.datepicker._isDisabledDatepicker(input) || $.datepicker._lastInput == input) // already here
+			return;
+		var inst = $.data(input, PROP_NAME);
+		var beforeShow = $.datepicker._get(inst, 'beforeShow');
+		extendRemove(inst.settings, (beforeShow ? beforeShow.apply(input, [input, inst]) : {}));
+		$.datepicker._hideDatepicker(null, '');
+		$.datepicker._lastInput = input;
+		$.datepicker._setDateFromField(inst);
+		if ($.datepicker._inDialog) // hide cursor
+			input.value = '';
+		if (!$.datepicker._pos) { // position below input
+			$.datepicker._pos = $.datepicker._findPos(input);
+			$.datepicker._pos[1] += input.offsetHeight; // add the height
+		}
+		var isFixed = false;
+		$(input).parents().each(function() {
+			isFixed |= $(this).css('position') == 'fixed';
+			return !isFixed;
+		});
+		if (isFixed && $.browser.opera) { // correction for Opera when fixed and scrolled
+			$.datepicker._pos[0] -= document.documentElement.scrollLeft;
+			$.datepicker._pos[1] -= document.documentElement.scrollTop;
+		}
+		var offset = {left: $.datepicker._pos[0], top: $.datepicker._pos[1]};
+		$.datepicker._pos = null;
+		inst.rangeStart = null;
+		// determine sizing offscreen
+		inst.dpDiv.css({position: 'absolute', display: 'block', top: '-1000px'});
+		$.datepicker._updateDatepicker(inst);
+		// fix width for dynamic number of date pickers
+		inst.dpDiv.width($.datepicker._getNumberOfMonths(inst)[1] *
+			$('.ui-datepicker', inst.dpDiv[0])[0].offsetWidth);
+		// and adjust position before showing
+		offset = $.datepicker._checkOffset(inst, offset, isFixed);
+		inst.dpDiv.css({position: ($.datepicker._inDialog && $.blockUI ?
+			'static' : (isFixed ? 'fixed' : 'absolute')), display: 'none',
+			left: offset.left + 'px', top: offset.top + 'px'});
+		if (!inst.inline) {
+			var showAnim = $.datepicker._get(inst, 'showAnim') || 'show';
+			var duration = $.datepicker._get(inst, 'duration');
+			var postProcess = function() {
+				$.datepicker._datepickerShowing = true;
+				if ($.browser.msie && parseInt($.browser.version) < 7) // fix IE < 7 select problems
+					$('iframe.ui-datepicker-cover').css({width: inst.dpDiv.width() + 4,
+						height: inst.dpDiv.height() + 4});
+			};
+			if ($.effects && $.effects[showAnim])
+				inst.dpDiv.show(showAnim, $.datepicker._get(inst, 'showOptions'), duration, postProcess);
+			else
+				inst.dpDiv[showAnim](duration, postProcess);
+			if (duration == '')
+				postProcess();
+			if (inst.input[0].type != 'hidden')
+				inst.input[0].focus();
+			$.datepicker._curInst = inst;
+		}
+	},
+
+	/* Generate the date picker content. */
+	_updateDatepicker: function(inst) {
+		var dims = {width: inst.dpDiv.width() + 4,
+			height: inst.dpDiv.height() + 4};
+		inst.dpDiv.empty().append(this._generateDatepicker(inst)).
+			find('iframe.ui-datepicker-cover').
+			css({width: dims.width, height: dims.height});
+		var numMonths = this._getNumberOfMonths(inst);
+		inst.dpDiv[(numMonths[0] != 1 || numMonths[1] != 1 ? 'add' : 'remove') +
+			'Class']('ui-datepicker-multi');
+		inst.dpDiv[(this._get(inst, 'isRTL') ? 'add' : 'remove') +
+			'Class']('ui-datepicker-rtl');
+		if (inst.input && inst.input[0].type != 'hidden')
+			$(inst.input[0]).focus();
+	},
+
+	/* Check positioning to remain on screen. */
+	_checkOffset: function(inst, offset, isFixed) {
+		var pos = inst.input ? this._findPos(inst.input[0]) : null;
+		var browserWidth = window.innerWidth || document.documentElement.clientWidth;
+		var browserHeight = window.innerHeight || document.documentElement.clientHeight;
+		var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
+		var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
+		// reposition date picker horizontally if outside the browser window
+		if (this._get(inst, 'isRTL') || (offset.left + inst.dpDiv.width() - scrollX) > browserWidth)
+			offset.left = Math.max((isFixed ? 0 : scrollX),
+				pos[0] + (inst.input ? inst.input.width() : 0) - (isFixed ? scrollX : 0) - inst.dpDiv.width() -
+				(isFixed && $.browser.opera ? document.documentElement.scrollLeft : 0));
+		else
+			offset.left -= (isFixed ? scrollX : 0);
+		// reposition date picker vertically if outside the browser window
+		if ((offset.top + inst.dpDiv.height() - scrollY) > browserHeight)
+			offset.top = Math.max((isFixed ? 0 : scrollY),
+				pos[1] - (isFixed ? scrollY : 0) - (this._inDialog ? 0 : inst.dpDiv.height()) -
+				(isFixed && $.browser.opera ? document.documentElement.scrollTop : 0));
+		else
+			offset.top -= (isFixed ? scrollY : 0);
+		return offset;
+	},
+	
+	/* Find an object's position on the screen. */
+	_findPos: function(obj) {
+        while (obj && (obj.type == 'hidden' || obj.nodeType != 1)) {
+            obj = obj.nextSibling;
+        }
+        var position = $(obj).offset();
+	    return [position.left, position.top];
+	},
+
+	/* Hide the date picker from view.
+	   @param  input  element - the input field attached to the date picker
+	   @param  duration  string - the duration over which to close the date picker */
+	_hideDatepicker: function(input, duration) {
+		var inst = this._curInst;
+		if (!inst)
+			return;
+		var rangeSelect = this._get(inst, 'rangeSelect');
+		if (rangeSelect && this._stayOpen)
+			this._selectDate('#' + inst.id, this._formatDate(inst,
+				inst.currentDay, inst.currentMonth, inst.currentYear));
+		this._stayOpen = false;
+		if (this._datepickerShowing) {
+			duration = (duration != null ? duration : this._get(inst, 'duration'));
+			var showAnim = this._get(inst, 'showAnim');
+			var postProcess = function() {
+				$.datepicker._tidyDialog(inst);
+			};
+			if (duration != '' && $.effects && $.effects[showAnim])
+				inst.dpDiv.hide(showAnim, $.datepicker._get(inst, 'showOptions'),
+					duration, postProcess);
+			else
+				inst.dpDiv[(duration == '' ? 'hide' : (showAnim == 'slideDown' ? 'slideUp' :
+					(showAnim == 'fadeIn' ? 'fadeOut' : 'hide')))](duration, postProcess);
+			if (duration == '')
+				this._tidyDialog(inst);
+			var onClose = this._get(inst, 'onClose');
+			if (onClose)
+				onClose.apply((inst.input ? inst.input[0] : null),
+					[this._getDate(inst), inst]);  // trigger custom callback
+			this._datepickerShowing = false;
+			this._lastInput = null;
+			inst.settings.prompt = null;
+			if (this._inDialog) {
+				this._dialogInput.css({ position: 'absolute', left: '0', top: '-100px' });
+				if ($.blockUI) {
+					$.unblockUI();
+					$('body').append(this.dpDiv);
+				}
+			}
+			this._inDialog = false;
+		}
+		this._curInst = null;
+	},
+
+	/* Tidy up after a dialog display. */
+	_tidyDialog: function(inst) {
+		inst.dpDiv.removeClass(this._dialogClass).unbind('.ui-datepicker');
+		$('.' + this._promptClass, inst.dpDiv).remove();
+	},
+
+	/* Close date picker if clicked elsewhere. */
+	_checkExternalClick: function(event) {
+		if (!$.datepicker._curInst)
+			return;
+		var $target = $(event.target);
+		if (($target.parents('#' + $.datepicker._mainDivId).length == 0) &&
+				!$target.hasClass($.datepicker.markerClassName) &&
+				!$target.hasClass($.datepicker._triggerClass) &&
+				$.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI))
+			$.datepicker._hideDatepicker(null, '');
+	},
+
+	/* Adjust one of the date sub-fields. */
+	_adjustDate: function(id, offset, period) {
+		var target = $(id);
+		var inst = $.data(target[0], PROP_NAME);
+		this._adjustInstDate(inst, offset, period);
+		this._updateDatepicker(inst);
+	},
+
+	/* Action for current link. */
+	_gotoToday: function(id) {
+		var target = $(id);
+		var inst = $.data(target[0], PROP_NAME);
+		if (this._get(inst, 'gotoCurrent') && inst.currentDay) {
+			inst.selectedDay = inst.currentDay;
+			inst.drawMonth = inst.selectedMonth = inst.currentMonth;
+			inst.drawYear = inst.selectedYear = inst.currentYear;
+		}
+		else {
+		var date = new Date();
+		inst.selectedDay = date.getDate();
+		inst.drawMonth = inst.selectedMonth = date.getMonth();
+		inst.drawYear = inst.selectedYear = date.getFullYear();
+		}
+		this._adjustDate(target);
+		this._notifyChange(inst);
+	},
+
+	/* Action for selecting a new month/year. */
+	_selectMonthYear: function(id, select, period) {
+		var target = $(id);
+		var inst = $.data(target[0], PROP_NAME);
+		inst._selectingMonthYear = false;
+		inst[period == 'M' ? 'drawMonth' : 'drawYear'] =
+			select.options[select.selectedIndex].value - 0;
+		this._adjustDate(target);
+		this._notifyChange(inst);
+	},
+
+	/* Restore input focus after not changing month/year. */
+	_clickMonthYear: function(id) {
+		var target = $(id);
+		var inst = $.data(target[0], PROP_NAME);
+		if (inst.input && inst._selectingMonthYear && !$.browser.msie)
+			inst.input[0].focus();
+		inst._selectingMonthYear = !inst._selectingMonthYear;
+	},
+
+	/* Action for changing the first week day. */
+	_changeFirstDay: function(id, day) {
+		var target = $(id);
+		var inst = $.data(target[0], PROP_NAME);
+		inst.settings.firstDay = day;
+		this._updateDatepicker(inst);
+	},
+
+	/* Action for selecting a day. */
+	_selectDay: function(id, month, year, td) {
+		if ($(td).hasClass(this._unselectableClass))
+			return;
+		var target = $(id);
+		var inst = $.data(target[0], PROP_NAME);
+		var rangeSelect = this._get(inst, 'rangeSelect');
+		if (rangeSelect) {
+			this._stayOpen = !this._stayOpen;
+			if (this._stayOpen) {
+				$('.ui-datepicker td').removeClass(this._currentClass);
+				$(td).addClass(this._currentClass);
+			} 
+		}
+		inst.selectedDay = inst.currentDay = $('a', td).html();
+		inst.selectedMonth = inst.currentMonth = month;
+		inst.selectedYear = inst.currentYear = year;
+		if (this._stayOpen) {
+			inst.endDay = inst.endMonth = inst.endYear = null;
+		}
+		else if (rangeSelect) {
+			inst.endDay = inst.currentDay;
+			inst.endMonth = inst.currentMonth;
+			inst.endYear = inst.currentYear;
+		}
+		this._selectDate(id, this._formatDate(inst,
+			inst.currentDay, inst.currentMonth, inst.currentYear));
+		if (this._stayOpen) {
+			inst.rangeStart = new Date(inst.currentYear, inst.currentMonth, inst.currentDay);
+			this._updateDatepicker(inst);
+		}
+		else if (rangeSelect) {
+			inst.selectedDay = inst.currentDay = inst.rangeStart.getDate();
+			inst.selectedMonth = inst.currentMonth = inst.rangeStart.getMonth();
+			inst.selectedYear = inst.currentYear = inst.rangeStart.getFullYear();
+			inst.rangeStart = null;
+			if (inst.inline)
+				this._updateDatepicker(inst);
+		}
+	},
+
+	/* Erase the input field and hide the date picker. */
+	_clearDate: function(id) {
+		var target = $(id);
+		var inst = $.data(target[0], PROP_NAME);
+		if (this._get(inst, 'mandatory'))
+			return;
+		this._stayOpen = false;
+		inst.endDay = inst.endMonth = inst.endYear = inst.rangeStart = null;
+		this._selectDate(target, '');
+	},
+
+	/* Update the input field with the selected date. */
+	_selectDate: function(id, dateStr) {
+		var target = $(id);
+		var inst = $.data(target[0], PROP_NAME);
+		dateStr = (dateStr != null ? dateStr : this._formatDate(inst));
+		if (this._get(inst, 'rangeSelect') && dateStr)
+			dateStr = (inst.rangeStart ? this._formatDate(inst, inst.rangeStart) :
+				dateStr) + this._get(inst, 'rangeSeparator') + dateStr;
+		if (inst.input)
+			inst.input.val(dateStr);
+		this._updateAlternate(inst);
+		var onSelect = this._get(inst, 'onSelect');
+		if (onSelect)
+			onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]);  // trigger custom callback
+		else if (inst.input)
+			inst.input.trigger('change'); // fire the change event
+		if (inst.inline)
+			this._updateDatepicker(inst);
+		else if (!this._stayOpen) {
+			this._hideDatepicker(null, this._get(inst, 'duration'));
+			this._lastInput = inst.input[0];
+			if (typeof(inst.input[0]) != 'object')
+				inst.input[0].focus(); // restore focus
+			this._lastInput = null;
+		}
+	},
+	
+	/* Update any alternate field to synchronise with the main field. */
+	_updateAlternate: function(inst) {
+		var altField = this._get(inst, 'altField');
+		if (altField) { // update alternate field too
+			var altFormat = this._get(inst, 'altFormat');
+			var date = this._getDate(inst);
+			dateStr = (isArray(date) ? (!date[0] && !date[1] ? '' :
+				this.formatDate(altFormat, date[0], this._getFormatConfig(inst)) +
+				this._get(inst, 'rangeSeparator') + this.formatDate(
+				altFormat, date[1] || date[0], this._getFormatConfig(inst))) :
+				this.formatDate(altFormat, date, this._getFormatConfig(inst)));
+			$(altField).each(function() { $(this).val(dateStr); });
+		}
+	},
+
+	/* Set as beforeShowDay function to prevent selection of weekends.
+	   @param  date  Date - the date to customise
+	   @return [boolean, string] - is this date selectable?, what is its CSS class? */
+	noWeekends: function(date) {
+		var day = date.getDay();
+		return [(day > 0 && day < 6), ''];
+	},
+	
+	/* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition.
+	   @param  date  Date - the date to get the week for
+	   @return  number - the number of the week within the year that contains this date */
+	iso8601Week: function(date) {
+		var checkDate = new Date(date.getFullYear(), date.getMonth(), date.getDate(), (date.getTimezoneOffset() / -60));
+		var firstMon = new Date(checkDate.getFullYear(), 1 - 1, 4); // First week always contains 4 Jan
+		var firstDay = firstMon.getDay() || 7; // Day of week: Mon = 1, ..., Sun = 7
+		firstMon.setDate(firstMon.getDate() + 1 - firstDay); // Preceding Monday
+		if (firstDay < 4 && checkDate < firstMon) { // Adjust first three days in year if necessary
+			checkDate.setDate(checkDate.getDate() - 3); // Generate for previous year
+			return $.datepicker.iso8601Week(checkDate);
+		} else if (checkDate > new Date(checkDate.getFullYear(), 12 - 1, 28)) { // Check last three days in year
+			firstDay = new Date(checkDate.getFullYear() + 1, 1 - 1, 4).getDay() || 7;
+			if (firstDay > 4 && (checkDate.getDay() || 7) < firstDay - 3) { // Adjust if necessary
+				checkDate.setDate(checkDate.getDate() + 3); // Generate for next year
+				return $.datepicker.iso8601Week(checkDate);
+			}
+		}
+		return Math.floor(((checkDate - firstMon) / 86400000) / 7) + 1; // Weeks to given date
+	},
+	
+	/* Provide status text for a particular date.
+	   @param  date  the date to get the status for
+	   @param  inst  the current datepicker instance
+	   @return  the status display text for this date */
+	dateStatus: function(date, inst) {
+		return $.datepicker.formatDate($.datepicker._get(inst, 'dateStatus'),
+			date, $.datepicker._getFormatConfig(inst));
+	},
+
+	/* Parse a string value into a date object.
+	   See formatDate below for the possible formats.
+
+	   @param  format    string - the expected format of the date
+	   @param  value     string - the date in the above format
+	   @param  settings  Object - attributes include:
+	                     shortYearCutoff  number - the cutoff year for determining the century (optional)
+	                     dayNamesShort    string[7] - abbreviated names of the days from Sunday (optional)
+	                     dayNames         string[7] - names of the days from Sunday (optional)
+	                     monthNamesShort  string[12] - abbreviated names of the months (optional)
+	                     monthNames       string[12] - names of the months (optional)
+	   @return  Date - the extracted date value or null if value is blank */
+	parseDate: function (format, value, settings) {
+		if (format == null || value == null)
+			throw 'Invalid arguments';
+		value = (typeof value == 'object' ? value.toString() : value + '');
+		if (value == '')
+			return null;
+		var shortYearCutoff = (settings ? settings.shortYearCutoff : null) || this._defaults.shortYearCutoff;
+		var dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort;
+		var dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames;
+		var monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort;
+		var monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames;
+		var year = -1;
+		var month = -1;
+		var day = -1;
+		var literal = false;
+		// Check whether a format character is doubled
+		var lookAhead = function(match) {
+			var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match);
+			if (matches)
+				iFormat++;
+			return matches;	
+		};
+		// Extract a number from the string value
+		var getNumber = function(match) {
+			lookAhead(match);
+			var origSize = (match == '@' ? 14 : (match == 'y' ? 4 : 2));
+			var size = origSize;
+			var num = 0;
+			while (size > 0 && iValue < value.length &&
+					value.charAt(iValue) >= '0' && value.charAt(iValue) <= '9') {
+				num = num * 10 + (value.charAt(iValue++) - 0);
+				size--;
+			}
+			if (size == origSize)
+				throw 'Missing number at position ' + iValue;
+			return num;
+		};
+		// Extract a name from the string value and convert to an index
+		var getName = function(match, shortNames, longNames) {
+			var names = (lookAhead(match) ? longNames : shortNames);
+			var size = 0;
+			for (var j = 0; j < names.length; j++)
+				size = Math.max(size, names[j].length);
+			var name = '';
+			var iInit = iValue;
+			while (size > 0 && iValue < value.length) {
+				name += value.charAt(iValue++);
+				for (var i = 0; i < names.length; i++)
+					if (name == names[i])
+						return i + 1;
+				size--;
+			}
+			throw 'Unknown name at position ' + iInit;
+		};
+		// Confirm that a literal character matches the string value
+		var checkLiteral = function() {
+			if (value.charAt(iValue) != format.charAt(iFormat))
+				throw 'Unexpected literal at position ' + iValue;
+			iValue++;
+		};
+		var iValue = 0;
+		for (var iFormat = 0; iFormat < format.length; iFormat++) {
+			if (literal)
+				if (format.charAt(iFormat) == "'" && !lookAhead("'"))
+					literal = false;
+				else
+					checkLiteral();
+			else
+				switch (format.charAt(iFormat)) {
+					case 'd':
+						day = getNumber('d');
+						break;
+					case 'D': 
+						getName('D', dayNamesShort, dayNames);
+						break;
+					case 'm': 
+						month = getNumber('m');
+						break;
+					case 'M':
+						month = getName('M', monthNamesShort, monthNames); 
+						break;
+					case 'y':
+						year = getNumber('y');
+						break;
+					case '@':
+						var date = new Date(getNumber('@'));
+						year = date.getFullYear();
+						month = date.getMonth() + 1;
+						day = date.getDate();
+						break;
+					case "'":
+						if (lookAhead("'"))
+							checkLiteral();
+						else
+							literal = true;
+						break;
+					default:
+						checkLiteral();
+				}
+		}
+		if (year < 100)
+			year += new Date().getFullYear() - new Date().getFullYear() % 100 +
+				(year <= shortYearCutoff ? 0 : -100);
+		var date = new Date(year, month - 1, day);
+		if (date.getFullYear() != year || date.getMonth() + 1 != month || date.getDate() != day)
+			throw 'Invalid date'; // E.g. 31/02/*
+		return date;
+	},
+
+	/* Standard date formats. */
+	ATOM: 'yy-mm-dd', // RFC 3339 (ISO 8601)
+	COOKIE: 'D, dd M yy',
+	ISO_8601: 'yy-mm-dd',
+	RFC_822: 'D, d M y',
+	RFC_850: 'DD, dd-M-y',
+	RFC_1036: 'D, d M y',
+	RFC_1123: 'D, d M yy',
+	RFC_2822: 'D, d M yy',
+	RSS: 'D, d M y', // RFC 822
+	TIMESTAMP: '@',
+	W3C: 'yy-mm-dd', // ISO 8601
+
+	/* Format a date object into a string value.
+	   The format can be combinations of the following:
+	   d  - day of month (no leading zero)
+	   dd - day of month (two digit)
+	   D  - day name short
+	   DD - day name long
+	   m  - month of year (no leading zero)
+	   mm - month of year (two digit)
+	   M  - month name short
+	   MM - month name long
+	   y  - year (two digit)
+	   yy - year (four digit)
+	   @ - Unix timestamp (ms since 01/01/1970)
+	   '...' - literal text
+	   '' - single quote
+
+	   @param  format    string - the desired format of the date
+	   @param  date      Date - the date value to format
+	   @param  settings  Object - attributes include:
+	                     dayNamesShort    string[7] - abbreviated names of the days from Sunday (optional)
+	                     dayNames         string[7] - names of the days from Sunday (optional)
+	                     monthNamesShort  string[12] - abbreviated names of the months (optional)
+	                     monthNames       string[12] - names of the months (optional)
+	   @return  string - the date in the above format */
+	formatDate: function (format, date, settings) {
+		if (!date)
+			return '';
+		var dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort;
+		var dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames;
+		var monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort;
+		var monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames;
+		// Check whether a format character is doubled
+		var lookAhead = function(match) {
+			var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match);
+			if (matches)
+				iFormat++;
+			return matches;	
+		};
+		// Format a number, with leading zero if necessary
+		var formatNumber = function(match, value) {
+			return (lookAhead(match) && value < 10 ? '0' : '') + value;
+		};
+		// Format a name, short or long as requested
+		var formatName = function(match, value, shortNames, longNames) {
+			return (lookAhead(match) ? longNames[value] : shortNames[value]);
+		};
+		var output = '';
+		var literal = false;
+		if (date)
+			for (var iFormat = 0; iFormat < format.length; iFormat++) {
+				if (literal)
+					if (format.charAt(iFormat) == "'" && !lookAhead("'"))
+						literal = false;
+					else
+						output += format.charAt(iFormat);
+				else
+					switch (format.charAt(iFormat)) {
+						case 'd':
+							output += formatNumber('d', date.getDate()); 
+							break;
+						case 'D': 
+							output += formatName('D', date.getDay(), dayNamesShort, dayNames);
+							break;
+						case 'm': 
+							output += formatNumber('m', date.getMonth() + 1); 
+							break;
+						case 'M':
+							output += formatName('M', date.getMonth(), monthNamesShort, monthNames); 
+							break;
+						case 'y':
+							output += (lookAhead('y') ? date.getFullYear() : 
+								(date.getYear() % 100 < 10 ? '0' : '') + date.getYear() % 100);
+							break;
+						case '@':
+							output += date.getTime(); 
+							break;
+						case "'":
+							if (lookAhead("'"))
+								output += "'";
+							else
+								literal = true;
+							break;
+						default:
+							output += format.charAt(iFormat);
+					}
+			}
+		return output;
+	},
+
+	/* Extract all possible characters from the date format. */
+	_possibleChars: function (format) {
+		var chars = '';
+		var literal = false;
+		for (var iFormat = 0; iFormat < format.length; iFormat++)
+			if (literal)
+				if (format.charAt(iFormat) == "'" && !lookAhead("'"))
+					literal = false;
+				else
+					chars += format.charAt(iFormat);
+			else
+				switch (format.charAt(iFormat)) {
+					case 'd': case 'm': case 'y': case '@':
+						chars += '0123456789'; 
+						break;
+					case 'D': case 'M':
+						return null; // Accept anything
+					case "'":
+						if (lookAhead("'"))
+							chars += "'";
+						else
+							literal = true;
+						break;
+					default:
+						chars += format.charAt(iFormat);
+				}
+		return chars;
+	},
+
+	/* Get a setting value, defaulting if necessary. */
+	_get: function(inst, name) {
+		return inst.settings[name] !== undefined ?
+			inst.settings[name] : this._defaults[name];
+	},
+
+	/* Parse existing date and initialise date picker. */
+	_setDateFromField: function(inst) {
+		var dateFormat = this._get(inst, 'dateFormat');
+		var dates = inst.input ? inst.input.val().split(this._get(inst, 'rangeSeparator')) : null; 
+		inst.endDay = inst.endMonth = inst.endYear = null;
+		var date = defaultDate = this._getDefaultDate(inst);
+		if (dates.length > 0) {
+			var settings = this._getFormatConfig(inst);
+			if (dates.length > 1) {
+				date = this.parseDate(dateFormat, dates[1], settings) || defaultDate;
+				inst.endDay = date.getDate();
+				inst.endMonth = date.getMonth();
+				inst.endYear = date.getFullYear();
+			}
+			try {
+				date = this.parseDate(dateFormat, dates[0], settings) || defaultDate;
+			} catch (e) {
+				this.log(e);
+				date = defaultDate;
+			}
+		}
+		inst.selectedDay = date.getDate();
+		inst.drawMonth = inst.selectedMonth = date.getMonth();
+		inst.drawYear = inst.selectedYear = date.getFullYear();
+		inst.currentDay = (dates[0] ? date.getDate() : 0);
+		inst.currentMonth = (dates[0] ? date.getMonth() : 0);
+		inst.currentYear = (dates[0] ? date.getFullYear() : 0);
+		this._adjustInstDate(inst);
+	},
+	
+	/* Retrieve the default date shown on opening. */
+	_getDefaultDate: function(inst) {
+		var date = this._determineDate(this._get(inst, 'defaultDate'), new Date());
+		var minDate = this._getMinMaxDate(inst, 'min', true);
+		var maxDate = this._getMinMaxDate(inst, 'max');
+		date = (minDate && date < minDate ? minDate : date);
+		date = (maxDate && date > maxDate ? maxDate : date);
+		return date;
+	},
+
+	/* A date may be specified as an exact value or a relative one. */
+	_determineDate: function(date, defaultDate) {
+		var offsetNumeric = function(offset) {
+			var date = new Date();
+			date.setUTCDate(date.getUTCDate() + offset);
+			return date;
+		};
+		var offsetString = function(offset, getDaysInMonth) {
+			var date = new Date();
+			var year = date.getFullYear();
+			var month = date.getMonth();
+			var day = date.getDate();
+			var pattern = /([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g;
+			var matches = pattern.exec(offset);
+			while (matches) {
+				switch (matches[2] || 'd') {
+					case 'd' : case 'D' :
+						day += (matches[1] - 0); break;
+					case 'w' : case 'W' :
+						day += (matches[1] * 7); break;
+					case 'm' : case 'M' :
+						month += (matches[1] - 0); 
+						day = Math.min(day, getDaysInMonth(year, month));
+						break;
+					case 'y': case 'Y' :
+						year += (matches[1] - 0);
+						day = Math.min(day, getDaysInMonth(year, month));
+						break;
+				}
+				matches = pattern.exec(offset);
+			}
+			return new Date(year, month, day);
+		};
+		return (date == null ? defaultDate :
+			(typeof date == 'string' ? offsetString(date, this._getDaysInMonth) :
+			(typeof date == 'number' ? offsetNumeric(date) : date)));
+	},
+
+	/* Set the date(s) directly. */
+	_setDate: function(inst, date, endDate) {
+		var clear = !(date);
+		date = this._determineDate(date, new Date());
+		inst.selectedDay = inst.currentDay = date.getDate();
+		inst.drawMonth = inst.selectedMonth = inst.currentMonth = date.getMonth();
+		inst.drawYear = inst.selectedYear = inst.currentYear = date.getFullYear();
+		if (this._get(inst, 'rangeSelect')) {
+			if (endDate) {
+				endDate = this._determineDate(endDate, null);
+				inst.endDay = endDate.getDate();
+				inst.endMonth = endDate.getMonth();
+				inst.endYear = endDate.getFullYear();
+			} else {
+				inst.endDay = inst.currentDay;
+				inst.endMonth = inst.currentMonth;
+				inst.endYear = inst.currentYear;
+			}
+		}
+		this._adjustInstDate(inst);
+		if (inst.input)
+			inst.input.val(clear ? '' : this._formatDate(inst) +
+				(!this._get(inst, 'rangeSelect') ? '' : this._get(inst, 'rangeSeparator') +
+				this._formatDate(inst, inst.endDay, inst.endMonth, inst.endYear)));
+	},
+
+	/* Retrieve the date(s) directly. */
+	_getDate: function(inst) {
+		var startDate = (!inst.currentYear || (inst.input && inst.input.val() == '') ? null :
+			new Date(inst.currentYear, inst.currentMonth, inst.currentDay));
+		if (this._get(inst, 'rangeSelect')) {
+			return [inst.rangeStart || startDate, (!inst.endYear ? null :
+				new Date(inst.endYear, inst.endMonth, inst.endDay))];
+		} else
+			return startDate;
+	},
+
+	/* Generate the HTML for the current state of the date picker. */
+	_generateDatepicker: function(inst) {
+		var today = new Date();
+		today = new Date(today.getFullYear(), today.getMonth(), today.getDate()); // clear time
+		var showStatus = this._get(inst, 'showStatus');
+		var isRTL = this._get(inst, 'isRTL');
+		// build the date picker HTML
+		var clear = (this._get(inst, 'mandatory') ? '' :
+			'<div class="ui-datepicker-clear"><a onclick="jQuery.datepicker._clearDate(\'#' + inst.id + '\');"' +
+			(showStatus ? this._addStatus(inst, this._get(inst, 'clearStatus') || '&#xa0;') : '') + '>' +
+			this._get(inst, 'clearText') + '</a></div>');
+		var controls = '<div class="ui-datepicker-control">' + (isRTL ? '' : clear) +
+			'<div class="ui-datepicker-close"><a onclick="jQuery.datepicker._hideDatepicker();"' +
+			(showStatus ? this._addStatus(inst, this._get(inst, 'closeStatus') || '&#xa0;') : '') + '>' +
+			this._get(inst, 'closeText') + '</a></div>' + (isRTL ? clear : '')  + '</div>';
+		var prompt = this._get(inst, 'prompt');
+		var closeAtTop = this._get(inst, 'closeAtTop');
+		var hideIfNoPrevNext = this._get(inst, 'hideIfNoPrevNext');
+		var navigationAsDateFormat = this._get(inst, 'navigationAsDateFormat');
+		var numMonths = this._getNumberOfMonths(inst);
+		var stepMonths = this._get(inst, 'stepMonths');
+		var isMultiMonth = (numMonths[0] != 1 || numMonths[1] != 1);
+		var currentDate = (!inst.currentDay ? new Date(9999, 9, 9) :
+			new Date(inst.currentYear, inst.currentMonth, inst.currentDay));
+		var minDate = this._getMinMaxDate(inst, 'min', true);
+		var maxDate = this._getMinMaxDate(inst, 'max');
+		var drawMonth = inst.drawMonth;
+		var drawYear = inst.drawYear;
+		if (maxDate) {
+			var maxDraw = new Date(maxDate.getFullYear(),
+				maxDate.getMonth() - numMonths[1] + 1, maxDate.getDate());
+			maxDraw = (minDate && maxDraw < minDate ? minDate : maxDraw);
+			while (new Date(drawYear, drawMonth, 1) > maxDraw) {
+				drawMonth--;
+				if (drawMonth < 0) {
+					drawMonth = 11;
+					drawYear--;
+				}
+			}
+		}
+		// controls and links
+		var prevText = this._get(inst, 'prevText');
+		prevText = (!navigationAsDateFormat ? prevText : this.formatDate(
+			prevText, new Date(drawYear, drawMonth - stepMonths, 1), this._getFormatConfig(inst)));
+		var prev = '<div class="ui-datepicker-prev">' + (this._canAdjustMonth(inst, -1, drawYear, drawMonth) ? 
+			'<a onclick="jQuery.datepicker._adjustDate(\'#' + inst.id + '\', -' + stepMonths + ', \'M\');"' +
+			(showStatus ? this._addStatus(inst, this._get(inst, 'prevStatus') || '&#xa0;') : '') + '>' + prevText + '</a>' :
+			(hideIfNoPrevNext ? '' : '<label>' + prevText + '</label>')) + '</div>';
+		var nextText = this._get(inst, 'nextText');
+		nextText = (!navigationAsDateFormat ? nextText : this.formatDate(
+			nextText, new Date(drawYear, drawMonth + stepMonths, 1), this._getFormatConfig(inst)));
+		var next = '<div class="ui-datepicker-next">' + (this._canAdjustMonth(inst, +1, drawYear, drawMonth) ?
+			'<a onclick="jQuery.datepicker._adjustDate(\'#' + inst.id + '\', +' + stepMonths + ', \'M\');"' +
+			(showStatus ? this._addStatus(inst, this._get(inst, 'nextStatus') || '&#xa0;') : '') + '>' + nextText + '</a>' :
+			(hideIfNoPrevNext ? '' : '<label>' + nextText + '</label>')) + '</div>';
+		var currentText = this._get(inst, 'currentText');
+		currentText = (!navigationAsDateFormat ? currentText: this.formatDate(
+			currentText, today, this._getFormatConfig(inst)));
+		var html = (prompt ? '<div class="' + this._promptClass + '">' + prompt + '</div>' : '') +
+			(closeAtTop && !inst.inline ? controls : '') +
+			'<div class="ui-datepicker-links">' + (isRTL ? next : prev) +
+			(this._isInRange(inst, (this._get(inst, 'gotoCurrent') && inst.currentDay ?
+			currentDate : today)) ? '<div class="ui-datepicker-current">' +
+			'<a onclick="jQuery.datepicker._gotoToday(\'#' + inst.id + '\');"' +
+			(showStatus ? this._addStatus(inst, this._get(inst, 'currentStatus') || '&#xa0;') : '') + '>' +
+			currentText + '</a></div>' : '') + (isRTL ? prev : next) + '</div>';
+		var firstDay = this._get(inst, 'firstDay');
+		var changeFirstDay = this._get(inst, 'changeFirstDay');
+		var dayNames = this._get(inst, 'dayNames');
+		var dayNamesShort = this._get(inst, 'dayNamesShort');
+		var dayNamesMin = this._get(inst, 'dayNamesMin');
+		var monthNames = this._get(inst, 'monthNames');
+		var beforeShowDay = this._get(inst, 'beforeShowDay');
+		var highlightWeek = this._get(inst, 'highlightWeek');
+		var showOtherMonths = this._get(inst, 'showOtherMonths');
+		var showWeeks = this._get(inst, 'showWeeks');
+		var calculateWeek = this._get(inst, 'calculateWeek') || this.iso8601Week;
+		var status = (showStatus ? this._get(inst, 'dayStatus') || '&#xa0;' : '');
+		var dateStatus = this._get(inst, 'statusForDate') || this.dateStatus;
+		var endDate = inst.endDay ? new Date(inst.endYear, inst.endMonth, inst.endDay) : currentDate;
+		for (var row = 0; row < numMonths[0]; row++)
+			for (var col = 0; col < numMonths[1]; col++) {
+				var selectedDate = new Date(drawYear, drawMonth, inst.selectedDay);
+				html += '<div class="ui-datepicker-one-month' + (col == 0 ? ' ui-datepicker-new-row' : '') + '">' +
+					this._generateMonthYearHeader(inst, drawMonth, drawYear, minDate, maxDate,
+					selectedDate, row > 0 || col > 0, showStatus, monthNames) + // draw month headers
+					'<table class="ui-datepicker" cellpadding="0" cellspacing="0"><thead>' + 
+					'<tr class="ui-datepicker-title-row">' +
+					(showWeeks ? '<td>' + this._get(inst, 'weekHeader') + '</td>' : '');
+				for (var dow = 0; dow < 7; dow++) { // days of the week
+					var day = (dow + firstDay) % 7;
+					var dayStatus = (status.indexOf('DD') > -1 ? status.replace(/DD/, dayNames[day]) :
+						status.replace(/D/, dayNamesShort[day]));
+					html += '<td' + ((dow + firstDay + 6) % 7 >= 5 ? ' class="ui-datepicker-week-end-cell"' : '') + '>' +
+						(!changeFirstDay ? '<span' :
+						'<a onclick="jQuery.datepicker._changeFirstDay(\'#' + inst.id + '\', ' + day + ');"') + 
+						(showStatus ? this._addStatus(inst, dayStatus) : '') + ' title="' + dayNames[day] + '">' +
+						dayNamesMin[day] + (changeFirstDay ? '</a>' : '</span>') + '</td>';
+				}
+				html += '</tr></thead><tbody>';
+				var daysInMonth = this._getDaysInMonth(drawYear, drawMonth);
+				if (drawYear == inst.selectedYear && drawMonth == inst.selectedMonth)
+					inst.selectedDay = Math.min(inst.selectedDay, daysInMonth);
+				var leadDays = (this._getFirstDayOfMonth(drawYear, drawMonth) - firstDay + 7) % 7;
+				var printDate = new Date(drawYear, drawMonth, 1 - leadDays);
+				var numRows = (isMultiMonth ? 6 : Math.ceil((leadDays + daysInMonth) / 7)); // calculate the number of rows to generate
+				for (var dRow = 0; dRow < numRows; dRow++) { // create date picker rows
+					html += '<tr class="ui-datepicker-days-row">' +
+						(showWeeks ? '<td class="ui-datepicker-week-col">' + calculateWeek(printDate) + '</td>' : '');
+					for (var dow = 0; dow < 7; dow++) { // create date picker days
+						var daySettings = (beforeShowDay ?
+							beforeShowDay.apply((inst.input ? inst.input[0] : null), [printDate]) : [true, '']);
+						var otherMonth = (printDate.getMonth() != drawMonth);
+						var unselectable = otherMonth || !daySettings[0] ||
+							(minDate && printDate < minDate) || (maxDate && printDate > maxDate);
+						html += '<td class="ui-datepicker-days-cell' +
+							((dow + firstDay + 6) % 7 >= 5 ? ' ui-datepicker-week-end-cell' : '') + // highlight weekends
+							(otherMonth ? ' ui-datepicker-otherMonth' : '') + // highlight days from other months
+							(printDate.getTime() == selectedDate.getTime() && drawMonth == inst.selectedMonth ?
+							' ui-datepicker-days-cell-over' : '') + // highlight selected day
+							(unselectable ? ' ' + this._unselectableClass : '') +  // highlight unselectable days
+							(otherMonth && !showOtherMonths ? '' : ' ' + daySettings[1] + // highlight custom dates
+							(printDate.getTime() >= currentDate.getTime() && printDate.getTime() <= endDate.getTime() ?  // in current range
+							' ' + this._currentClass : '') + // highlight selected day
+							(printDate.getTime() == today.getTime() ? ' ui-datepicker-today' : '')) + '"' + // highlight today (if different)
+							((!otherMonth || showOtherMonths) && daySettings[2] ? ' title="' + daySettings[2] + '"' : '') + // cell title
+							(unselectable ? (highlightWeek ? ' onmouseover="jQuery(this).parent().addClass(\'ui-datepicker-week-over\');"' + // highlight selection week
+							' onmouseout="jQuery(this).parent().removeClass(\'ui-datepicker-week-over\');"' : '') : // unhighlight selection week
+							' onmouseover="jQuery(this).addClass(\'ui-datepicker-days-cell-over\')' + // highlight selection
+							(highlightWeek ? '.parent().addClass(\'ui-datepicker-week-over\')' : '') + ';' + // highlight selection week
+							(!showStatus || (otherMonth && !showOtherMonths) ? '' : 'jQuery(\'#ui-datepicker-status-' +
+							inst.id + '\').html(\'' + (dateStatus.apply((inst.input ? inst.input[0] : null),
+							[printDate, inst]) || '&#xa0;') +'\');') + '"' +
+							' onmouseout="jQuery(this).removeClass(\'ui-datepicker-days-cell-over\')' + // unhighlight selection
+							(highlightWeek ? '.parent().removeClass(\'ui-datepicker-week-over\')' : '') + ';' + // unhighlight selection week
+							(!showStatus || (otherMonth && !showOtherMonths) ? '' : 'jQuery(\'#ui-datepicker-status-' +
+							inst.id + '\').html(\'&#xa0;\');') + '" onclick="jQuery.datepicker._selectDay(\'#' +
+							inst.id + '\',' + drawMonth + ',' + drawYear + ', this);"') + '>' + // actions
+							(otherMonth ? (showOtherMonths ? printDate.getDate() : '&#xa0;') : // display for other months
+							(unselectable ? printDate.getDate() : '<a>' + printDate.getDate() + '</a>')) + '</td>'; // display for this month
+						printDate.setUTCDate(printDate.getUTCDate() + 1);
+					}
+					html += '</tr>';
+				}
+				drawMonth++;
+				if (drawMonth > 11) {
+					drawMonth = 0;
+					drawYear++;
+				}
+				html += '</tbody></table></div>';
+			}
+		html += (showStatus ? '<div style="clear: both;"></div><div id="ui-datepicker-status-' + inst.id + 
+			'" class="ui-datepicker-status">' + (this._get(inst, 'initStatus') || '&#xa0;') + '</div>' : '') +
+			(!closeAtTop && !inst.inline ? controls : '') +
+			'<div style="clear: both;"></div>' + 
+			($.browser.msie && parseInt($.browser.version) < 7 && !inst.inline ? 
+			'<iframe src="javascript:false;" class="ui-datepicker-cover"></iframe>' : '');
+		return html;
+	},
+	
+	/* Generate the month and year header. */
+	_generateMonthYearHeader: function(inst, drawMonth, drawYear, minDate, maxDate,
+			selectedDate, secondary, showStatus, monthNames) {
+		minDate = (inst.rangeStart && minDate && selectedDate < minDate ? selectedDate : minDate);
+		var html = '<div class="ui-datepicker-header">';
+		// month selection
+		if (secondary || !this._get(inst, 'changeMonth'))
+			html += monthNames[drawMonth] + '&#xa0;';
+		else {
+			var inMinYear = (minDate && minDate.getFullYear() == drawYear);
+			var inMaxYear = (maxDate && maxDate.getFullYear() == drawYear);
+			html += '<select class="ui-datepicker-new-month" ' +
+				'onchange="jQuery.datepicker._selectMonthYear(\'#' + inst.id + '\', this, \'M\');" ' +
+				'onclick="jQuery.datepicker._clickMonthYear(\'#' + inst.id + '\');"' +
+				(showStatus ? this._addStatus(inst, this._get(inst, 'monthStatus') || '&#xa0;') : '') + '>';
+			for (var month = 0; month < 12; month++) {
+				if ((!inMinYear || month >= minDate.getMonth()) &&
+						(!inMaxYear || month <= maxDate.getMonth()))
+					html += '<option value="' + month + '"' +
+						(month == drawMonth ? ' selected="selected"' : '') +
+						'>' + monthNames[month] + '</option>';
+			}
+			html += '</select>';
+		}
+		// year selection
+		if (secondary || !this._get(inst, 'changeYear'))
+			html += drawYear;
+		else {
+			// determine range of years to display
+			var years = this._get(inst, 'yearRange').split(':');
+			var year = 0;
+			var endYear = 0;
+			if (years.length != 2) {
+				year = drawYear - 10;
+				endYear = drawYear + 10;
+			} else if (years[0].charAt(0) == '+' || years[0].charAt(0) == '-') {
+				year = endYear = new Date().getFullYear();
+				year += parseInt(years[0], 10);
+				endYear += parseInt(years[1], 10);
+			} else {
+				year = parseInt(years[0], 10);
+				endYear = parseInt(years[1], 10);
+			}
+			year = (minDate ? Math.max(year, minDate.getFullYear()) : year);
+			endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear);
+			html += '<select class="ui-datepicker-new-year" ' +
+				'onchange="jQuery.datepicker._selectMonthYear(\'#' + inst.id + '\', this, \'Y\');" ' +
+				'onclick="jQuery.datepicker._clickMonthYear(\'#' + inst.id + '\');"' +
+				(showStatus ? this._addStatus(inst, this._get(inst, 'yearStatus') || '&#xa0;') : '') + '>';
+			for (; year <= endYear; year++) {
+				html += '<option value="' + year + '"' +
+					(year == drawYear ? ' selected="selected"' : '') +
+					'>' + year + '</option>';
+			}
+			html += '</select>';
+		}
+		html += '</div>'; // Close datepicker_header
+		return html;
+	},
+
+	/* Provide code to set and clear the status panel. */
+	_addStatus: function(inst, text) {
+		return ' onmouseover="jQuery(\'#ui-datepicker-status-' + inst.id + '\').html(\'' + text + '\');" ' +
+			'onmouseout="jQuery(\'#ui-datepicker-status-' + inst.id + '\').html(\'&#xa0;\');"';
+	},
+
+	/* Adjust one of the date sub-fields. */
+	_adjustInstDate: function(inst, offset, period) {
+		var year = inst.drawYear + (period == 'Y' ? offset : 0);
+		var month = inst.drawMonth + (period == 'M' ? offset : 0);
+		var day = Math.min(inst.selectedDay, this._getDaysInMonth(year, month)) +
+			(period == 'D' ? offset : 0);
+		var date = new Date(year, month, day);
+		// ensure it is within the bounds set
+		var minDate = this._getMinMaxDate(inst, 'min', true);
+		var maxDate = this._getMinMaxDate(inst, 'max');
+		date = (minDate && date < minDate ? minDate : date);
+		date = (maxDate && date > maxDate ? maxDate : date);
+		inst.selectedDay = date.getDate();
+		inst.drawMonth = inst.selectedMonth = date.getMonth();
+		inst.drawYear = inst.selectedYear = date.getFullYear();
+		if (period == 'M' || period == 'Y')
+			this._notifyChange(inst);
+	},
+
+	/* Notify change of month/year. */
+	_notifyChange: function(inst) {
+		var onChange = this._get(inst, 'onChangeMonthYear');
+		if (onChange)
+			onChange.apply((inst.input ? inst.input[0] : null),
+				[new Date(inst.selectedYear, inst.selectedMonth, 1), inst]);
+	},
+	
+	/* Determine the number of months to show. */
+	_getNumberOfMonths: function(inst) {
+		var numMonths = this._get(inst, 'numberOfMonths');
+		return (numMonths == null ? [1, 1] : (typeof numMonths == 'number' ? [1, numMonths] : numMonths));
+	},
+
+	/* Determine the current maximum date - ensure no time components are set - may be overridden for a range. */
+	_getMinMaxDate: function(inst, minMax, checkRange) {
+		var date = this._determineDate(this._get(inst, minMax + 'Date'), null);
+		if (date) {
+			date.setHours(0);
+			date.setMinutes(0);
+			date.setSeconds(0);
+			date.setMilliseconds(0);
+		}
+		return (!checkRange || !inst.rangeStart ? date :
+			(!date || inst.rangeStart > date ? inst.rangeStart : date));
+	},
+
+	/* Find the number of days in a given month. */
+	_getDaysInMonth: function(year, month) {
+		return 32 - new Date(year, month, 32).getDate();
+	},
+
+	/* Find the day of the week of the first of a month. */
+	_getFirstDayOfMonth: function(year, month) {
+		return new Date(year, month, 1).getDay();
+	},
+
+	/* Determines if we should allow a "next/prev" month display change. */
+	_canAdjustMonth: function(inst, offset, curYear, curMonth) {
+		var numMonths = this._getNumberOfMonths(inst);
+		var date = new Date(curYear, curMonth + (offset < 0 ? offset : numMonths[1]), 1);
+		if (offset < 0)
+			date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth()));
+		return this._isInRange(inst, date);
+	},
+
+	/* Is the given date in the accepted range? */
+	_isInRange: function(inst, date) {
+		// during range selection, use minimum of selected date and range start
+		var newMinDate = (!inst.rangeStart ? null :
+			new Date(inst.selectedYear, inst.selectedMonth, inst.selectedDay));
+		newMinDate = (newMinDate && inst.rangeStart < newMinDate ? inst.rangeStart : newMinDate);
+		var minDate = newMinDate || this._getMinMaxDate(inst, 'min');
+		var maxDate = this._getMinMaxDate(inst, 'max');
+		return ((!minDate || date >= minDate) && (!maxDate || date <= maxDate));
+	},
+	
+	/* Provide the configuration settings for formatting/parsing. */
+	_getFormatConfig: function(inst) {
+		var shortYearCutoff = this._get(inst, 'shortYearCutoff');
+		shortYearCutoff = (typeof shortYearCutoff != 'string' ? shortYearCutoff :
+			new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10));
+		return {shortYearCutoff: shortYearCutoff,
+			dayNamesShort: this._get(inst, 'dayNamesShort'), dayNames: this._get(inst, 'dayNames'),
+			monthNamesShort: this._get(inst, 'monthNamesShort'), monthNames: this._get(inst, 'monthNames')};
+	},
+
+	/* Format the given date for display. */
+	_formatDate: function(inst, day, month, year) {
+		if (!day) {
+			inst.currentDay = inst.selectedDay;
+			inst.currentMonth = inst.selectedMonth;
+			inst.currentYear = inst.selectedYear;
+		}
+		var date = (day ? (typeof day == 'object' ? day : new Date(year, month, day)) :
+			new Date(inst.currentYear, inst.currentMonth, inst.currentDay));
+		return this.formatDate(this._get(inst, 'dateFormat'), date, this._getFormatConfig(inst));
+	}
+});
+
+/* jQuery extend now ignores nulls! */
+function extendRemove(target, props) {
+	$.extend(target, props);
+	for (var name in props)
+		if (props[name] == null || props[name] == undefined)
+			target[name] = props[name];
+	return target;
+};
+
+/* Determine whether an object is an array. */
+function isArray(a) {
+	return (a && (($.browser.safari && typeof a == 'object' && a.length) ||
+		(a.constructor && a.constructor.toString().match(/\Array\(\)/))));
+};
+
+/* Invoke the datepicker functionality.
+   @param  options  string - a command, optionally followed by additional parameters or
+                    Object - settings for attaching new datepicker functionality
+   @return  jQuery object */
+$.fn.datepicker = function(options){
+	var otherArgs = Array.prototype.slice.call(arguments, 1);
+	if (typeof options == 'string' && (options == 'isDisabled' || options == 'getDate'))
+		return $.datepicker['_' + options + 'Datepicker'].
+			apply($.datepicker, [this[0]].concat(otherArgs));
+	return this.each(function() {
+		typeof options == 'string' ?
+			$.datepicker['_' + options + 'Datepicker'].
+				apply($.datepicker, [this].concat(otherArgs)) :
+			$.datepicker._attachDatepicker(this, options);
+	});
+};
+
+$.datepicker = new Datepicker(); // singleton instance
+	
+/* Initialise the date picker. */
+$(document).ready(function() {
+	$(document.body).append($.datepicker.dpDiv).
+		mousedown($.datepicker._checkExternalClick);
+});
+
+})(jQuery);
+/*
+ * jQuery UI Dialog
+ *
+ * Copyright (c) 2008 Richard D. Worth (rdworth.org)
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ * 
+ * http://docs.jquery.com/UI/Dialog
+ *
+ * Depends:
+ *	ui.core.js
+ *	ui.draggable.js
+ *	ui.resizable.js
+ */
+(function($) {
+
+var setDataSwitch = {
+	dragStart: "start.draggable",
+	drag: "drag.draggable",
+	dragStop: "stop.draggable",
+	maxHeight: "maxHeight.resizable",
+	minHeight: "minHeight.resizable",
+	maxWidth: "maxWidth.resizable",
+	minWidth: "minWidth.resizable",
+	resizeStart: "start.resizable",
+	resize: "drag.resizable",
+	resizeStop: "stop.resizable"
+};
+
+$.widget("ui.dialog", {
+	init: function() {
+		var self = this,
+			options = this.options,
+			resizeHandles = typeof options.resizable == 'string'
+				? options.resizable
+				: 'n,e,s,w,se,sw,ne,nw',
+			
+			uiDialogContent = this.element
+				.addClass('ui-dialog-content')
+				.wrap('<div/>')
+				.wrap('<div/>'),
+			
+			uiDialogContainer = (this.uiDialogContainer = uiDialogContent.parent()
+				.addClass('ui-dialog-container')
+				.css({position: 'relative', width: '100%', height: '100%'})),
+			
+			title = options.title || uiDialogContent.attr('title') || '',
+			uiDialogTitlebar = (this.uiDialogTitlebar =
+				$('<div class="ui-dialog-titlebar"/>'))
+				.append('<span class="ui-dialog-title">' + title + '</span>')
+				.append('<a href="#" class="ui-dialog-titlebar-close"><span>X</span></a>')
+				.prependTo(uiDialogContainer),
+			
+			uiDialog = (this.uiDialog = uiDialogContainer.parent())
+				.appendTo(document.body)
+				.hide()
+				.addClass('ui-dialog')
+				.addClass(options.dialogClass)
+				// add content classes to dialog
+				// to inherit theme at top level of element
+				.addClass(uiDialogContent.attr('className'))
+					.removeClass('ui-dialog-content')
+				.css({
+					position: 'absolute',
+					width: options.width,
+					height: options.height,
+					overflow: 'hidden',
+					zIndex: options.zIndex
+				})
+				// setting tabIndex makes the div focusable
+				// setting outline to 0 prevents a border on focus in Mozilla
+				.attr('tabIndex', -1).css('outline', 0).keydown(function(ev) {
+					if (options.closeOnEscape) {
+						var ESC = 27;
+						(ev.keyCode && ev.keyCode == ESC && self.close());
+					}
+				})
+				.mousedown(function() {
+					self.moveToTop();
+				}),
+			
+			uiDialogButtonPane = (this.uiDialogButtonPane = $('<div/>'))
+				.addClass('ui-dialog-buttonpane').css({ position: 'absolute', bottom: 0 })
+				.appendTo(uiDialog);
+		
+		this.uiDialogTitlebarClose = $('.ui-dialog-titlebar-close', uiDialogTitlebar)
+			.hover(
+				function() {
+					$(this).addClass('ui-dialog-titlebar-close-hover');
+				},
+				function() {
+					$(this).removeClass('ui-dialog-titlebar-close-hover');
+				}
+			)
+			.mousedown(function(ev) {
+				ev.stopPropagation();
+			})
+			.click(function() {
+				self.close();
+				return false;
+			});
+
+		this.uiDialogTitlebar.find("*").add(this.uiDialogTitlebar).each(function() {
+			$.ui.disableSelection(this);
+		});
+
+		if ($.fn.draggable) {
+			uiDialog.draggable({
+				cancel: '.ui-dialog-content',
+				helper: options.dragHelper,
+				handle: '.ui-dialog-titlebar',
+				start: function(e, ui) {
+					self.moveToTop();
+					(options.dragStart && options.dragStart.apply(self.element[0], arguments));
+				},
+				drag: function(e, ui) {
+					(options.drag && options.drag.apply(self.element[0], arguments));
+				},
+				stop: function(e, ui) {
+					(options.dragStop && options.dragStop.apply(self.element[0], arguments));
+					$.ui.dialog.overlay.resize();
+				}
+			});
+			(options.draggable || uiDialog.draggable('disable'));
+		}
+		
+		if ($.fn.resizable) {
+			uiDialog.resizable({
+				cancel: '.ui-dialog-content',
+				helper: options.resizeHelper,
+				maxWidth: options.maxWidth,
+				maxHeight: options.maxHeight,
+				minWidth: options.minWidth,
+				minHeight: options.minHeight,
+				start: function() {
+					(options.resizeStart && options.resizeStart.apply(self.element[0], arguments));
+				},
+				resize: function(e, ui) {
+					(options.autoResize && self.size.apply(self));
+					(options.resize && options.resize.apply(self.element[0], arguments));
+				},
+				handles: resizeHandles,
+				stop: function(e, ui) {
+					(options.autoResize && self.size.apply(self));
+					(options.resizeStop && options.resizeStop.apply(self.element[0], arguments));
+					$.ui.dialog.overlay.resize();
+				}
+			});
+			(options.resizable || uiDialog.resizable('disable'));
+		}
+		
+		this.createButtons(options.buttons);
+		this.isOpen = false;
+		
+		(options.bgiframe && $.fn.bgiframe && uiDialog.bgiframe());
+		(options.autoOpen && this.open());
+	},
+	
+	setData: function(key, value){
+		(setDataSwitch[key] && this.uiDialog.data(setDataSwitch[key], value));
+		switch (key) {
+			case "buttons":
+				this.createButtons(value);
+				break;
+			case "draggable":
+				this.uiDialog.draggable(value ? 'enable' : 'disable');
+				break;
+			case "height":
+				this.uiDialog.height(value);
+				break;
+			case "position":
+				this.position(value);
+				break;
+			case "resizable":
+				(typeof value == 'string' && this.uiDialog.data('handles.resizable', value));
+				this.uiDialog.resizable(value ? 'enable' : 'disable');
+				break;
+			case "title":
+				$(".ui-dialog-title", this.uiDialogTitlebar).text(value);
+				break;
+			case "width":
+				this.uiDialog.width(value);
+				break;
+		}
+		
+		$.widget.prototype.setData.apply(this, arguments);
+	},
+	
+	position: function(pos) {
+		var wnd = $(window), doc = $(document),
+			pTop = doc.scrollTop(), pLeft = doc.scrollLeft(),
+			minTop = pTop;
+		
+		if ($.inArray(pos, ['center','top','right','bottom','left']) >= 0) {
+			pos = [
+				pos == 'right' || pos == 'left' ? pos : 'center',
+				pos == 'top' || pos == 'bottom' ? pos : 'middle'
+			];
+		}
+		if (pos.constructor != Array) {
+			pos = ['center', 'middle'];
+		}
+		if (pos[0].constructor == Number) {
+			pLeft += pos[0];
+		} else {
+			switch (pos[0]) {
+				case 'left':
+					pLeft += 0;
+					break;
+				case 'right':
+					pLeft += wnd.width() - this.uiDialog.width();
+					break;
+				default:
+				case 'center':
+					pLeft += (wnd.width() - this.uiDialog.width()) / 2;
+			}
+		}
+		if (pos[1].constructor == Number) {
+			pTop += pos[1];
+		} else {
+			switch (pos[1]) {
+				case 'top':
+					pTop += 0;
+					break;
+				case 'bottom':
+					pTop += wnd.height() - this.uiDialog.height();
+					break;
+				default:
+				case 'middle':
+					pTop += (wnd.height() - this.uiDialog.height()) / 2;
+			}
+		}
+		
+		// prevent the dialog from being too high (make sure the titlebar
+		// is accessible)
+		pTop = Math.max(pTop, minTop);
+		this.uiDialog.css({top: pTop, left: pLeft});
+	},
+
+	size: function() {
+		var container = this.uiDialogContainer,
+			titlebar = this.uiDialogTitlebar,
+			content = this.element,
+			tbMargin = parseInt(content.css('margin-top'),10) + parseInt(content.css('margin-bottom'),10),
+			lrMargin = parseInt(content.css('margin-left'),10) + parseInt(content.css('margin-right'),10);
+		content.height(container.height() - titlebar.outerHeight() - tbMargin);
+		content.width(container.width() - lrMargin);
+	},
+	
+	open: function() {
+		if (this.isOpen) { return; }
+		
+		this.overlay = this.options.modal ? new $.ui.dialog.overlay(this) : null;
+		(this.uiDialog.next().length > 0) && this.uiDialog.appendTo('body');
+		this.position(this.options.position);
+		this.uiDialog.show(this.options.show);
+		this.options.autoResize && this.size();
+		this.moveToTop(true);
+		
+		// CALLBACK: open
+		var openEV = null;
+		var openUI = {
+			options: this.options
+		};
+		this.uiDialogTitlebarClose.focus();
+		this.element.triggerHandler("dialogopen", [openEV, openUI], this.options.open);
+		
+		this.isOpen = true;
+	},
+	
+	// the force parameter allows us to move modal dialogs to their correct
+	// position on open
+	moveToTop: function(force) {
+		if ((this.options.modal && !force)
+			|| (!this.options.stack && !this.options.modal)) { return this.element.triggerHandler("dialogfocus", [null, { options: this.options }], this.options.focus); }
+		
+		var maxZ = this.options.zIndex, options = this.options;
+		$('.ui-dialog:visible').each(function() {
+			maxZ = Math.max(maxZ, parseInt($(this).css('z-index'), 10) || options.zIndex);
+		});
+		(this.overlay && this.overlay.$el.css('z-index', ++maxZ));
+		this.uiDialog.css('z-index', ++maxZ);
+		
+		this.element.triggerHandler("dialogfocus", [null, { options: this.options }], this.options.focus);
+	},
+	
+	close: function() {
+		(this.overlay && this.overlay.destroy());
+		this.uiDialog.hide(this.options.hide);
+
+		// CALLBACK: close
+		var closeEV = null;
+		var closeUI = {
+			options: this.options
+		};
+		this.element.triggerHandler("dialogclose", [closeEV, closeUI], this.options.close);
+		$.ui.dialog.overlay.resize();
+		
+		this.isOpen = false;
+	},
+	
+	destroy: function() {
+		(this.overlay && this.overlay.destroy());
+		this.uiDialog.hide();
+		this.element
+			.unbind('.dialog')
+			.removeData('dialog')
+			.removeClass('ui-dialog-content')
+			.hide().appendTo('body');
+		this.uiDialog.remove();
+	},
+	
+	createButtons: function(buttons) {
+		var self = this,
+			hasButtons = false,
+			uiDialogButtonPane = this.uiDialogButtonPane;
+		
+		// remove any existing buttons
+		uiDialogButtonPane.empty().hide();
+		
+		$.each(buttons, function() { return !(hasButtons = true); });
+		if (hasButtons) {
+			uiDialogButtonPane.show();
+			$.each(buttons, function(name, fn) {
+				$('<button/>')
+					.text(name)
+					.click(function() { fn.apply(self.element[0], arguments); })
+					.appendTo(uiDialogButtonPane);
+			});
+		}
+	}
+});
+
+$.extend($.ui.dialog, {
+	defaults: {
+		autoOpen: true,
+		autoResize: true,
+		bgiframe: false,
+		buttons: {},
+		closeOnEscape: true,
+		draggable: true,
+		height: 200,
+		minHeight: 100,
+		minWidth: 150,
+		modal: false,
+		overlay: {},
+		position: 'center',
+		resizable: true,
+		stack: true,
+		width: 300,
+		zIndex: 1000
+	},
+	
+	overlay: function(dialog) {
+		this.$el = $.ui.dialog.overlay.create(dialog);
+	}
+});
+
+$.extend($.ui.dialog.overlay, {
+	instances: [],
+	events: $.map('focus,mousedown,mouseup,keydown,keypress,click'.split(','),
+		function(e) { return e + '.dialog-overlay'; }).join(' '),
+	create: function(dialog) {
+		if (this.instances.length === 0) {
+			// prevent use of anchors and inputs
+			// we use a setTimeout in case the overlay is created from an
+			// event that we're going to be cancelling (see #2804)
+			setTimeout(function() {
+				$('a, :input').bind($.ui.dialog.overlay.events, function() {
+					// allow use of the element if inside a dialog and
+					// - there are no modal dialogs
+					// - there are modal dialogs, but we are in front of the topmost modal
+					var allow = false;
+					var $dialog = $(this).parents('.ui-dialog');
+					if ($dialog.length) {
+						var $overlays = $('.ui-dialog-overlay');
+						if ($overlays.length) {
+							var maxZ = parseInt($overlays.css('z-index'), 10);
+							$overlays.each(function() {
+								maxZ = Math.max(maxZ, parseInt($(this).css('z-index'), 10));
+							});
+							allow = parseInt($dialog.css('z-index'), 10) > maxZ;
+						} else {
+							allow = true;
+						}
+					}
+					return allow;
+				});
+			}, 1);
+			
+			// allow closing by pressing the escape key
+			$(document).bind('keydown.dialog-overlay', function(e) {
+				var ESC = 27;
+				(e.keyCode && e.keyCode == ESC && dialog.close()); 
+			});
+			
+			// handle window resize
+			$(window).bind('resize.dialog-overlay', $.ui.dialog.overlay.resize);
+		}
+		
+		var $el = $('<div/>').appendTo(document.body)
+			.addClass('ui-dialog-overlay').css($.extend({
+				borderWidth: 0, margin: 0, padding: 0,
+				position: 'absolute', top: 0, left: 0,
+				width: this.width(),
+				height: this.height()
+			}, dialog.options.overlay));
+		
+		(dialog.options.bgiframe && $.fn.bgiframe && $el.bgiframe());
+		
+		this.instances.push($el);
+		return $el;
+	},
+	
+	destroy: function($el) {
+		this.instances.splice($.inArray(this.instances, $el), 1);
+		
+		if (this.instances.length === 0) {
+			$('a, :input').add([document, window]).unbind('.dialog-overlay');
+		}
+		
+		$el.remove();
+	},
+	
+	height: function() {
+		if ($.browser.msie && $.browser.version < 7) {
+			var scrollHeight = Math.max(
+				document.documentElement.scrollHeight,
+				document.body.scrollHeight
+			);
+			var offsetHeight = Math.max(
+				document.documentElement.offsetHeight,
+				document.body.offsetHeight
+			);
+			
+			if (scrollHeight < offsetHeight) {
+				return $(window).height() + 'px';
+			} else {
+				return scrollHeight + 'px';
+			}
+		} else {
+			return $(document).height() + 'px';
+		}
+	},
+	
+	width: function() {
+		if ($.browser.msie && $.browser.version < 7) {
+			var scrollWidth = Math.max(
+				document.documentElement.scrollWidth,
+				document.body.scrollWidth
+			);
+			var offsetWidth = Math.max(
+				document.documentElement.offsetWidth,
+				document.body.offsetWidth
+			);
+			
+			if (scrollWidth < offsetWidth) {
+				return $(window).width() + 'px';
+			} else {
+				return scrollWidth + 'px';
+			}
+		} else {
+			return $(document).width() + 'px';
+		}
+	},
+	
+	resize: function() {
+		/* If the dialog is draggable and the user drags it past the
+		 * right edge of the window, the document becomes wider so we
+		 * need to stretch the overlay. If the user then drags the
+		 * dialog back to the left, the document will become narrower,
+		 * so we need to shrink the overlay to the appropriate size.
+		 * This is handled by shrinking the overlay before setting it
+		 * to the full document size.
+		 */
+		var $overlays = $([]);
+		$.each($.ui.dialog.overlay.instances, function() {
+			$overlays = $overlays.add(this);
+		});
+		
+		$overlays.css({
+			width: 0,
+			height: 0
+		}).css({
+			width: $.ui.dialog.overlay.width(),
+			height: $.ui.dialog.overlay.height()
+		});
+	}
+});
+
+$.extend($.ui.dialog.overlay.prototype, {
+	destroy: function() {
+		$.ui.dialog.overlay.destroy(this.$el);
+	}
+});
+
+})(jQuery);
+/*
+ * jQuery UI Slider
+ *
+ * Copyright (c) 2008 Paul Bakaus
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ * 
+ * http://docs.jquery.com/UI/Slider
+ *
+ * Depends:
+ *	ui.core.js
+ */
+(function($) {
+
+$.fn.unwrap = $.fn.unwrap || function(expr) {
+  return this.each(function(){
+     $(this).parents(expr).eq(0).after(this).remove();
+  });
+};
+
+$.widget("ui.slider", {
+	plugins: {},
+	ui: function(e) {
+		return {
+			options: this.options,
+			handle: this.currentHandle,
+			value: this.options.axis != "both" || !this.options.axis ? Math.round(this.value(null,this.options.axis == "vertical" ? "y" : "x")) : {
+				x: Math.round(this.value(null,"x")),
+				y: Math.round(this.value(null,"y"))
+			},
+			range: this.getRange()
+		};
+	},
+	propagate: function(n,e) {
+		$.ui.plugin.call(this, n, [e, this.ui()]);
+		this.element.triggerHandler(n == "slide" ? n : "slide"+n, [e, this.ui()], this.options[n]);
+	},
+	destroy: function() {
+		
+		this.element
+			.removeClass("ui-slider ui-slider-disabled")
+			.removeData("slider")
+			.unbind(".slider");
+		
+		if(this.handle && this.handle.length) {
+			this.handle
+				.unwrap("a");
+			this.handle.each(function() {
+				$(this).data("mouse").mouseDestroy();
+			});
+		}
+		
+		this.generated && this.generated.remove();
+		
+	},
+	setData: function(key, value) {
+		$.widget.prototype.setData.apply(this, arguments);
+		if (/min|max|steps/.test(key)) {
+			this.initBoundaries();
+		}
+		
+		if(key == "range") {
+			value ? this.handle.length == 2 && this.createRange() : this.removeRange();
+		}
+		
+	},
+
+	init: function() {
+		
+		var self = this;
+		this.element.addClass("ui-slider");
+		this.initBoundaries();
+		
+		// Initialize mouse and key events for interaction
+		this.handle = $(this.options.handle, this.element);
+		if (!this.handle.length) {
+			self.handle = self.generated = $(self.options.handles || [0]).map(function() {
+				var handle = $("<div/>").addClass("ui-slider-handle").appendTo(self.element);
+				if (this.id)
+					handle.attr("id", this.id);
+				return handle[0];
+			});
+		}
+		
+		
+		var handleclass = function(el) {
+			this.element = $(el);
+			this.element.data("mouse", this);
+			this.options = self.options;
+			
+			this.element.bind("mousedown", function() {
+				if(self.currentHandle) this.blur(self.currentHandle);
+				self.focus(this,1);
+			});
+			
+			this.mouseInit();
+		};
+		
+		$.extend(handleclass.prototype, $.ui.mouse, {
+			mouseStart: function(e) { return self.start.call(self, e, this.element[0]); },
+			mouseStop: function(e) { return self.stop.call(self, e, this.element[0]); },
+			mouseDrag: function(e) { return self.drag.call(self, e, this.element[0]); },
+			mouseCapture: function() { return true; },
+			trigger: function(e) { this.mouseDown(e); }
+		});
+		
+		
+		$(this.handle)
+			.each(function() {
+				new handleclass(this);
+			})
+			.wrap('<a href="javascript:void(0)" style="outline:none;border:none;"></a>')
+			.parent()
+				.bind('focus', function(e) { self.focus(this.firstChild); })
+				.bind('blur', function(e) { self.blur(this.firstChild); })
+				.bind('keydown', function(e) { if(!self.options.noKeyboard) self.keydown(e.keyCode, this.firstChild); })
+		;
+		
+		// Bind the click to the slider itself
+		this.element.bind('mousedown.slider', function(e) {
+			self.click.apply(self, [e]);
+			self.currentHandle.data("mouse").trigger(e);
+			self.firstValue = self.firstValue + 1; //This is for always triggering the change event
+		});
+		
+		// Move the first handle to the startValue
+		$.each(this.options.handles || [], function(index, handle) {
+			self.moveTo(handle.start, index, true);
+		});
+		if (!isNaN(this.options.startValue))
+			this.moveTo(this.options.startValue, 0, true);
+
+		this.previousHandle = $(this.handle[0]); //set the previous handle to the first to allow clicking before selecting the handle
+		if(this.handle.length == 2 && this.options.range) this.createRange();
+	},
+	initBoundaries: function() {
+		
+		var element = this.element[0], o = this.options;
+		this.actualSize = { width: this.element.outerWidth() , height: this.element.outerHeight() };			
+		
+		$.extend(o, {
+			axis: o.axis || (element.offsetWidth < element.offsetHeight ? 'vertical' : 'horizontal'),
+			max: !isNaN(parseInt(o.max,10)) ? { x: parseInt(o.max, 10), y: parseInt(o.max, 10) } : ({ x: o.max && o.max.x || 100, y: o.max && o.max.y || 100 }),
+			min: !isNaN(parseInt(o.min,10)) ? { x: parseInt(o.min, 10), y: parseInt(o.min, 10) } : ({ x: o.min && o.min.x || 0, y: o.min && o.min.y || 0 })
+		});
+		//Prepare the real maxValue
+		o.realMax = {
+			x: o.max.x - o.min.x,
+			y: o.max.y - o.min.y
+		};
+		//Calculate stepping based on steps
+		o.stepping = {
+			x: o.stepping && o.stepping.x || parseInt(o.stepping, 10) || (o.steps ? o.realMax.x/(o.steps.x || parseInt(o.steps, 10) || o.realMax.x) : 0),
+			y: o.stepping && o.stepping.y || parseInt(o.stepping, 10) || (o.steps ? o.realMax.y/(o.steps.y || parseInt(o.steps, 10) || o.realMax.y) : 0)
+		};
+	},
+
+	
+	keydown: function(keyCode, handle) {
+		if(/(37|38|39|40)/.test(keyCode)) {
+			this.moveTo({
+				x: /(37|39)/.test(keyCode) ? (keyCode == 37 ? '-' : '+') + '=' + this.oneStep("x") : 0,
+				y: /(38|40)/.test(keyCode) ? (keyCode == 38 ? '-' : '+') + '=' + this.oneStep("y") : 0
+			}, handle);
+		}
+	},
+	focus: function(handle,hard) {
+		this.currentHandle = $(handle).addClass('ui-slider-handle-active');
+		if (hard)
+			this.currentHandle.parent()[0].focus();
+	},
+	blur: function(handle) {
+		$(handle).removeClass('ui-slider-handle-active');
+		if(this.currentHandle && this.currentHandle[0] == handle) { this.previousHandle = this.currentHandle; this.currentHandle = null; };
+	},
+	click: function(e) {
+		// This method is only used if:
+		// - The user didn't click a handle
+		// - The Slider is not disabled
+		// - There is a current, or previous selected handle (otherwise we wouldn't know which one to move)
+		
+		var pointer = [e.pageX,e.pageY];
+		
+		var clickedHandle = false;
+		this.handle.each(function() {
+			if(this == e.target)
+				clickedHandle = true;
+		});
+		if (clickedHandle || this.options.disabled || !(this.currentHandle || this.previousHandle))
+			return;
+
+		// If a previous handle was focussed, focus it again
+		if (!this.currentHandle && this.previousHandle)
+			this.focus(this.previousHandle, true);
+		
+		// propagate only for distance > 0, otherwise propagation is done my drag
+		this.offset = this.element.offset();
+
+		this.moveTo({
+			y: this.convertValue(e.pageY - this.offset.top - this.currentHandle[0].offsetHeight/2, "y"),
+			x: this.convertValue(e.pageX - this.offset.left - this.currentHandle[0].offsetWidth/2, "x")
+		}, null, !this.options.distance);
+	},
+	
+
+
+	createRange: function() {
+		if(this.rangeElement) return;
+		this.rangeElement = $('<div></div>')
+			.addClass('ui-slider-range')
+			.css({ position: 'absolute' })
+			.appendTo(this.element);
+		this.updateRange();
+	},
+	removeRange: function() {
+		this.rangeElement.remove();
+		this.rangeElement = null;
+	},
+	updateRange: function() {
+			var prop = this.options.axis == "vertical" ? "top" : "left";
+			var size = this.options.axis == "vertical" ? "height" : "width";
+			this.rangeElement.css(prop, (parseInt($(this.handle[0]).css(prop),10) || 0) + this.handleSize(0, this.options.axis == "vertical" ? "y" : "x")/2);
+			this.rangeElement.css(size, (parseInt($(this.handle[1]).css(prop),10) || 0) - (parseInt($(this.handle[0]).css(prop),10) || 0));
+	},
+	getRange: function() {
+		return this.rangeElement ? this.convertValue(parseInt(this.rangeElement.css(this.options.axis == "vertical" ? "height" : "width"),10), this.options.axis == "vertical" ? "y" : "x") : null;
+	},
+
+	handleIndex: function() {
+		return this.handle.index(this.currentHandle[0]);
+	},
+	value: function(handle, axis) {
+		if(this.handle.length == 1) this.currentHandle = this.handle;
+		if(!axis) axis = this.options.axis == "vertical" ? "y" : "x";
+
+		var curHandle = $(handle != undefined && handle !== null ? this.handle[handle] || handle : this.currentHandle);
+		
+		if(curHandle.data("mouse").sliderValue) {
+			return parseInt(curHandle.data("mouse").sliderValue[axis],10);
+		} else {
+			return parseInt(((parseInt(curHandle.css(axis == "x" ? "left" : "top"),10) / (this.actualSize[axis == "x" ? "width" : "height"] - this.handleSize(handle,axis))) * this.options.realMax[axis]) + this.options.min[axis],10);
+		}
+
+	},
+	convertValue: function(value,axis) {
+		return this.options.min[axis] + (value / (this.actualSize[axis == "x" ? "width" : "height"] - this.handleSize(null,axis))) * this.options.realMax[axis];
+	},
+	
+	translateValue: function(value,axis) {
+		return ((value - this.options.min[axis]) / this.options.realMax[axis]) * (this.actualSize[axis == "x" ? "width" : "height"] - this.handleSize(null,axis));
+	},
+	translateRange: function(value,axis) {
+		if (this.rangeElement) {
+			if (this.currentHandle[0] == this.handle[0] && value >= this.translateValue(this.value(1),axis))
+				value = this.translateValue(this.value(1,axis) - this.oneStep(axis), axis);
+			if (this.currentHandle[0] == this.handle[1] && value <= this.translateValue(this.value(0),axis))
+				value = this.translateValue(this.value(0,axis) + this.oneStep(axis), axis);
+		}
+		if (this.options.handles) {
+			var handle = this.options.handles[this.handleIndex()];
+			if (value < this.translateValue(handle.min,axis)) {
+				value = this.translateValue(handle.min,axis);
+			} else if (value > this.translateValue(handle.max,axis)) {
+				value = this.translateValue(handle.max,axis);
+			}
+		}
+		return value;
+	},
+	translateLimits: function(value,axis) {
+		if (value >= this.actualSize[axis == "x" ? "width" : "height"] - this.handleSize(null,axis))
+			value = this.actualSize[axis == "x" ? "width" : "height"] - this.handleSize(null,axis);
+		if (value <= 0)
+			value = 0;
+		return value;
+	},
+	handleSize: function(handle,axis) {
+		return $(handle != undefined && handle !== null ? this.handle[handle] : this.currentHandle)[0]["offset"+(axis == "x" ? "Width" : "Height")];	
+	},
+	oneStep: function(axis) {
+		return this.options.stepping[axis] || 1;
+	},
+
+
+	start: function(e, handle) {
+	
+		var o = this.options;
+		if(o.disabled) return false;
+
+		// Prepare the outer size
+		this.actualSize = { width: this.element.outerWidth() , height: this.element.outerHeight() };
+	
+		// This is a especially ugly fix for strange blur events happening on mousemove events
+		if (!this.currentHandle)
+			this.focus(this.previousHandle, true); 
+
+		this.offset = this.element.offset();
+		
+		this.handleOffset = this.currentHandle.offset();
+		this.clickOffset = { top: e.pageY - this.handleOffset.top, left: e.pageX - this.handleOffset.left };
+		
+		this.firstValue = this.value();
+		
+		this.propagate('start', e);
+		this.drag(e, handle);
+		return true;
+					
+	},
+	stop: function(e) {
+		this.propagate('stop', e);
+		if (this.firstValue != this.value())
+			this.propagate('change', e);
+		// This is a especially ugly fix for strange blur events happening on mousemove events
+		this.focus(this.currentHandle, true);
+		return false;
+	},
+	drag: function(e, handle) {
+
+		var o = this.options;
+		var position = { top: e.pageY - this.offset.top - this.clickOffset.top, left: e.pageX - this.offset.left - this.clickOffset.left};
+		if(!this.currentHandle) this.focus(this.previousHandle, true); //This is a especially ugly fix for strange blur events happening on mousemove events
+
+		position.left = this.translateLimits(position.left, "x");
+		position.top = this.translateLimits(position.top, "y");
+		
+		if (o.stepping.x) {
+			var value = this.convertValue(position.left, "x");
+			value = Math.round(value / o.stepping.x) * o.stepping.x;
+			position.left = this.translateValue(value, "x");	
+		}
+		if (o.stepping.y) {
+			var value = this.convertValue(position.top, "y");
+			value = Math.round(value / o.stepping.y) * o.stepping.y;
+			position.top = this.translateValue(value, "y");	
+		}
+		
+		position.left = this.translateRange(position.left, "x");
+		position.top = this.translateRange(position.top, "y");
+
+		if(o.axis != "vertical") this.currentHandle.css({ left: position.left });
+		if(o.axis != "horizontal") this.currentHandle.css({ top: position.top });
+		
+		//Store the slider's value
+		this.currentHandle.data("mouse").sliderValue = {
+			x: Math.round(this.convertValue(position.left, "x")) || 0,
+			y: Math.round(this.convertValue(position.top, "y")) || 0
+		};
+		
+		if (this.rangeElement)
+			this.updateRange();
+		this.propagate('slide', e);
+		return false;
+	},
+	
+	moveTo: function(value, handle, noPropagation) {
+
+		var o = this.options;
+
+		// Prepare the outer size
+		this.actualSize = { width: this.element.outerWidth() , height: this.element.outerHeight() };
+
+		//If no handle has been passed, no current handle is available and we have multiple handles, return false
+		if (handle == undefined && !this.currentHandle && this.handle.length != 1)
+			return false; 
+		
+		//If only one handle is available, use it
+		if (handle == undefined && !this.currentHandle)
+			handle = 0;
+		
+		if (handle != undefined)
+			this.currentHandle = this.previousHandle = $(this.handle[handle] || handle);
+
+
+		if(value.x !== undefined && value.y !== undefined) {
+			var x = value.x, y = value.y;
+		} else {
+			var x = value, y = value;
+		}
+
+		if(x !== undefined && x.constructor != Number) {
+			var me = /^\-\=/.test(x), pe = /^\+\=/.test(x);
+			if(me || pe) {
+				x = this.value(null, "x") + parseInt(x.replace(me ? '=' : '+=', ''), 10);
+			} else {
+				x = isNaN(parseInt(x, 10)) ? undefined : parseInt(x, 10);
+			}
+		}
+		
+		if(y !== undefined && y.constructor != Number) {
+			var me = /^\-\=/.test(y), pe = /^\+\=/.test(y);
+			if(me || pe) {
+				y = this.value(null, "y") + parseInt(y.replace(me ? '=' : '+=', ''), 10);
+			} else {
+				y = isNaN(parseInt(y, 10)) ? undefined : parseInt(y, 10);
+			}
+		}
+
+		if(o.axis != "vertical" && x !== undefined) {
+			if(o.stepping.x) x = Math.round(x / o.stepping.x) * o.stepping.x;
+			x = this.translateValue(x, "x");
+			x = this.translateLimits(x, "x");
+			x = this.translateRange(x, "x");
+
+			o.animate ? this.currentHandle.stop().animate({ left: x }, (Math.abs(parseInt(this.currentHandle.css("left")) - x)) * (!isNaN(parseInt(o.animate)) ? o.animate : 5)) : this.currentHandle.css({ left: x });
+		}
+
+		if(o.axis != "horizontal" && y !== undefined) {
+			if(o.stepping.y) y = Math.round(y / o.stepping.y) * o.stepping.y;
+			y = this.translateValue(y, "y");
+			y = this.translateLimits(y, "y");
+			y = this.translateRange(y, "y");
+			o.animate ? this.currentHandle.stop().animate({ top: y }, (Math.abs(parseInt(this.currentHandle.css("top")) - y)) * (!isNaN(parseInt(o.animate)) ? o.animate : 5)) : this.currentHandle.css({ top: y });
+		}
+		
+		if (this.rangeElement)
+			this.updateRange();
+			
+		//Store the slider's value
+		this.currentHandle.data("mouse").sliderValue = {
+			x: Math.round(this.convertValue(x, "x")) || 0,
+			y: Math.round(this.convertValue(y, "y")) || 0
+		};
+	
+		if (!noPropagation) {
+			this.propagate('start', null);
+			this.propagate('stop', null);
+			this.propagate('change', null);
+			this.propagate("slide", null);
+		}
+	}
+});
+
+$.ui.slider.getter = "value";
+
+$.ui.slider.defaults = {
+	handle: ".ui-slider-handle",
+	distance: 1,
+	animate: false
+};
+
+})(jQuery);
+/*
+ * jQuery UI Tabs
+ *
+ * Copyright (c) 2007, 2008 Klaus Hartl (stilbuero.de)
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ *
+ * http://docs.jquery.com/UI/Tabs
+ *
+ * Depends:
+ *	ui.core.js
+ */
+(function($) {
+
+$.widget("ui.tabs", {
+	init: function() {
+		this.options.event += '.tabs'; // namespace event
+		
+		// create tabs
+		this.tabify(true);
+	},
+	setData: function(key, value) {
+		if ((/^selected/).test(key))
+			this.select(value);
+		else {
+			this.options[key] = value;
+			this.tabify();
+		}
+	},
+	length: function() {
+		return this.$tabs.length;
+	},
+	tabId: function(a) {
+		return a.title && a.title.replace(/\s/g, '_').replace(/[^A-Za-z0-9\-_:\.]/g, '')
+			|| this.options.idPrefix + $.data(a);
+	},
+	ui: function(tab, panel) {
+		return {
+			options: this.options,
+			tab: tab,
+			panel: panel,
+			index: this.$tabs.index(tab)
+		};
+	},
+	tabify: function(init) {
+
+		this.$lis = $('li:has(a[href])', this.element);
+		this.$tabs = this.$lis.map(function() { return $('a', this)[0]; });
+		this.$panels = $([]);
+
+		var self = this, o = this.options;
+
+		this.$tabs.each(function(i, a) {
+			// inline tab
+			if (a.hash && a.hash.replace('#', '')) // Safari 2 reports '#' for an empty hash
+				self.$panels = self.$panels.add(a.hash);
+			// remote tab
+			else if ($(a).attr('href') != '#') { // prevent loading the page itself if href is just "#"
+				$.data(a, 'href.tabs', a.href); // required for restore on destroy
+				$.data(a, 'load.tabs', a.href); // mutable
+				var id = self.tabId(a);
+				a.href = '#' + id;
+				var $panel = $('#' + id);
+				if (!$panel.length) {
+					$panel = $(o.panelTemplate).attr('id', id).addClass(o.panelClass)
+						.insertAfter( self.$panels[i - 1] || self.element );
+					$panel.data('destroy.tabs', true);
+				}
+				self.$panels = self.$panels.add( $panel );
+			}
+			// invalid tab href
+			else
+				o.disabled.push(i + 1);
+		});
+
+		if (init) {
+
+			// attach necessary classes for styling if not present
+			this.element.addClass(o.navClass);
+			this.$panels.each(function() {
+				var $this = $(this);
+				$this.addClass(o.panelClass);
+			});
+
+			// Selected tab
+			// use "selected" option or try to retrieve:
+			// 1. from fragment identifier in url
+			// 2. from cookie
+			// 3. from selected class attribute on <li>
+			if (o.selected === undefined) {
+				if (location.hash) {
+					this.$tabs.each(function(i, a) {
+						if (a.hash == location.hash) {
+							o.selected = i;
+							// prevent page scroll to fragment
+							if ($.browser.msie || $.browser.opera) { // && !o.remote
+								var $toShow = $(location.hash), toShowId = $toShow.attr('id');
+								$toShow.attr('id', '');
+								setTimeout(function() {
+									$toShow.attr('id', toShowId); // restore id
+								}, 500);
+							}
+							scrollTo(0, 0);
+							return false; // break
+						}
+					});
+				}
+				else if (o.cookie) {
+					var index = parseInt($.cookie('ui-tabs' + $.data(self.element)),10);
+					if (index && self.$tabs[index])
+						o.selected = index;
+				}
+				else if (self.$lis.filter('.' + o.selectedClass).length)
+					o.selected = self.$lis.index( self.$lis.filter('.' + o.selectedClass)[0] );
+			}
+			o.selected = o.selected === null || o.selected !== undefined ? o.selected : 0; // first tab selected by default
+
+			// Take disabling tabs via class attribute from HTML
+			// into account and update option properly.
+			// A selected tab cannot become disabled.
+			o.disabled = $.unique(o.disabled.concat(
+				$.map(this.$lis.filter('.' + o.disabledClass),
+					function(n, i) { return self.$lis.index(n); } )
+			)).sort();
+			if ($.inArray(o.selected, o.disabled) != -1)
+				o.disabled.splice($.inArray(o.selected, o.disabled), 1);
+			
+			// highlight selected tab
+			this.$panels.addClass(o.hideClass);
+			this.$lis.removeClass(o.selectedClass);
+			if (o.selected !== null) {
+				this.$panels.eq(o.selected).show().removeClass(o.hideClass); // use show and remove class to show in any case no matter how it has been hidden before
+				this.$lis.eq(o.selected).addClass(o.selectedClass);
+				
+				// seems to be expected behavior that the show callback is fired
+				var onShow = function() {
+					$(self.element).triggerHandler('tabsshow',
+						[self.fakeEvent('tabsshow'), self.ui(self.$tabs[o.selected], self.$panels[o.selected])], o.show);
+				}; 
+
+				// load if remote tab
+				if ($.data(this.$tabs[o.selected], 'load.tabs'))
+					this.load(o.selected, onShow);
+				// just trigger show event
+				else
+					onShow();
+				
+			}
+			
+			// clean up to avoid memory leaks in certain versions of IE 6
+			$(window).bind('unload', function() {
+				self.$tabs.unbind('.tabs');
+				self.$lis = self.$tabs = self.$panels = null;
+			});
+
+		}
+
+		// disable tabs
+		for (var i = 0, li; li = this.$lis[i]; i++)
+			$(li)[$.inArray(i, o.disabled) != -1 && !$(li).hasClass(o.selectedClass) ? 'addClass' : 'removeClass'](o.disabledClass);
+
+		// reset cache if switching from cached to not cached
+		if (o.cache === false)
+			this.$tabs.removeData('cache.tabs');
+		
+		// set up animations
+		var hideFx, showFx, baseFx = { 'min-width': 0, duration: 1 }, baseDuration = 'normal';
+		if (o.fx && o.fx.constructor == Array)
+			hideFx = o.fx[0] || baseFx, showFx = o.fx[1] || baseFx;
+		else
+			hideFx = showFx = o.fx || baseFx;
+
+		// reset some styles to maintain print style sheets etc.
+		var resetCSS = { display: '', overflow: '', height: '' };
+		if (!$.browser.msie) // not in IE to prevent ClearType font issue
+			resetCSS.opacity = '';
+
+		// Hide a tab, animation prevents browser scrolling to fragment,
+		// $show is optional.
+		function hideTab(clicked, $hide, $show) {
+			$hide.animate(hideFx, hideFx.duration || baseDuration, function() { //
+				$hide.addClass(o.hideClass).css(resetCSS); // maintain flexible height and accessibility in print etc.
+				if ($.browser.msie && hideFx.opacity)
+					$hide[0].style.filter = '';
+				if ($show)
+					showTab(clicked, $show, $hide);
+			});
+		}
+
+		// Show a tab, animation prevents browser scrolling to fragment,
+		// $hide is optional.
+		function showTab(clicked, $show, $hide) {
+			if (showFx === baseFx)
+				$show.css('display', 'block'); // prevent occasionally occuring flicker in Firefox cause by gap between showing and hiding the tab panels
+			$show.animate(showFx, showFx.duration || baseDuration, function() {
+				$show.removeClass(o.hideClass).css(resetCSS); // maintain flexible height and accessibility in print etc.
+				if ($.browser.msie && showFx.opacity)
+					$show[0].style.filter = '';
+
+				// callback
+				$(self.element).triggerHandler('tabsshow',
+					[self.fakeEvent('tabsshow'), self.ui(clicked, $show[0])], o.show);
+
+			});
+		}
+
+		// switch a tab
+		function switchTab(clicked, $li, $hide, $show) {
+			/*if (o.bookmarkable && trueClick) { // add to history only if true click occured, not a triggered click
+				$.ajaxHistory.update(clicked.hash);
+			}*/
+			$li.addClass(o.selectedClass)
+				.siblings().removeClass(o.selectedClass);
+			hideTab(clicked, $hide, $show);
+		}
+
+		// attach tab event handler, unbind to avoid duplicates from former tabifying...
+		this.$tabs.unbind('.tabs').bind(o.event, function() {
+
+			//var trueClick = e.clientX; // add to history only if true click occured, not a triggered click
+			var $li = $(this).parents('li:eq(0)'),
+				$hide = self.$panels.filter(':visible'),
+				$show = $(this.hash);
+
+			// If tab is already selected and not unselectable or tab disabled or 
+			// or is already loading or click callback returns false stop here.
+			// Check if click handler returns false last so that it is not executed
+			// for a disabled or loading tab!
+			if (($li.hasClass(o.selectedClass) && !o.unselect)
+				|| $li.hasClass(o.disabledClass) 
+				|| $(this).hasClass(o.loadingClass)
+				|| $(self.element).triggerHandler('tabsselect', [self.fakeEvent('tabsselect'), self.ui(this, $show[0])], o.select) === false
+				) {
+				this.blur();
+				return false;
+			}
+
+			self.options.selected = self.$tabs.index(this);
+
+			// if tab may be closed
+			if (o.unselect) {
+				if ($li.hasClass(o.selectedClass)) {
+					self.options.selected = null;
+					$li.removeClass(o.selectedClass);
+					self.$panels.stop();
+					hideTab(this, $hide);
+					this.blur();
+					return false;
+				} else if (!$hide.length) {
+					self.$panels.stop();
+					var a = this;
+					self.load(self.$tabs.index(this), function() {
+						$li.addClass(o.selectedClass).addClass(o.unselectClass);
+						showTab(a, $show);
+					});
+					this.blur();
+					return false;
+				}
+			}
+
+			if (o.cookie)
+				$.cookie('ui-tabs' + $.data(self.element), self.options.selected, o.cookie);
+
+			// stop possibly running animations
+			self.$panels.stop();
+
+			// show new tab
+			if ($show.length) {
+
+				// prevent scrollbar scrolling to 0 and than back in IE7, happens only if bookmarking/history is enabled
+				/*if ($.browser.msie && o.bookmarkable) {
+					var showId = this.hash.replace('#', '');
+					$show.attr('id', '');
+					setTimeout(function() {
+						$show.attr('id', showId); // restore id
+					}, 0);
+				}*/
+
+				var a = this;
+				self.load(self.$tabs.index(this), $hide.length ? 
+					function() {
+						switchTab(a, $li, $hide, $show);
+					} :
+					function() {
+						$li.addClass(o.selectedClass);
+						showTab(a, $show);
+					}
+				);
+
+				// Set scrollbar to saved position - need to use timeout with 0 to prevent browser scroll to target of hash
+				/*var scrollX = window.pageXOffset || document.documentElement && document.documentElement.scrollLeft || document.body.scrollLeft || 0;
+				var scrollY = window.pageYOffset || document.documentElement && document.documentElement.scrollTop || document.body.scrollTop || 0;
+				setTimeout(function() {
+					scrollTo(scrollX, scrollY);
+				}, 0);*/
+
+			} else
+				throw 'jQuery UI Tabs: Mismatching fragment identifier.';
+
+			// Prevent IE from keeping other link focussed when using the back button
+			// and remove dotted border from clicked link. This is controlled in modern
+			// browsers via CSS, also blur removes focus from address bar in Firefox
+			// which can become a usability and annoying problem with tabsRotate.
+			if ($.browser.msie)
+				this.blur();
+
+			//return o.bookmarkable && !!trueClick; // convert trueClick == undefined to Boolean required in IE
+			return false;
+
+		});
+
+		// disable click if event is configured to something else
+		if (!(/^click/).test(o.event))
+			this.$tabs.bind('click.tabs', function() { return false; });
+
+	},
+	add: function(url, label, index) {
+		if (index == undefined) 
+			index = this.$tabs.length; // append by default
+
+		var o = this.options;
+		var $li = $(o.tabTemplate.replace(/#\{href\}/g, url).replace(/#\{label\}/g, label));
+		$li.data('destroy.tabs', true);
+
+		var id = url.indexOf('#') == 0 ? url.replace('#', '') : this.tabId( $('a:first-child', $li)[0] );
+
+		// try to find an existing element before creating a new one
+		var $panel = $('#' + id);
+		if (!$panel.length) {
+			$panel = $(o.panelTemplate).attr('id', id)
+				.addClass(o.hideClass)
+				.data('destroy.tabs', true);
+		}
+		$panel.addClass(o.panelClass);
+		if (index >= this.$lis.length) {
+			$li.appendTo(this.element);
+			$panel.appendTo(this.element[0].parentNode);
+		} else {
+			$li.insertBefore(this.$lis[index]);
+			$panel.insertBefore(this.$panels[index]);
+		}
+		
+		o.disabled = $.map(o.disabled,
+			function(n, i) { return n >= index ? ++n : n });
+			
+		this.tabify();
+
+		if (this.$tabs.length == 1) {
+			$li.addClass(o.selectedClass);
+			$panel.removeClass(o.hideClass);
+			var href = $.data(this.$tabs[0], 'load.tabs');
+			if (href)
+				this.load(index, href);
+		}
+
+		// callback
+		this.element.triggerHandler('tabsadd',
+			[this.fakeEvent('tabsadd'), this.ui(this.$tabs[index], this.$panels[index])], o.add
+		);
+	},
+	remove: function(index) {
+		var o = this.options, $li = this.$lis.eq(index).remove(),
+			$panel = this.$panels.eq(index).remove();
+
+		// If selected tab was removed focus tab to the right or
+		// in case the last tab was removed the tab to the left.
+		if ($li.hasClass(o.selectedClass) && this.$tabs.length > 1)
+			this.select(index + (index + 1 < this.$tabs.length ? 1 : -1));
+
+		o.disabled = $.map($.grep(o.disabled, function(n, i) { return n != index; }),
+			function(n, i) { return n >= index ? --n : n });
+
+		this.tabify();
+
+		// callback
+		this.element.triggerHandler('tabsremove',
+			[this.fakeEvent('tabsremove'), this.ui($li.find('a')[0], $panel[0])], o.remove
+		);
+	},
+	enable: function(index) {
+		var o = this.options;
+		if ($.inArray(index, o.disabled) == -1)
+			return;
+			
+		var $li = this.$lis.eq(index).removeClass(o.disabledClass);
+		if ($.browser.safari) { // fix disappearing tab (that used opacity indicating disabling) after enabling in Safari 2...
+			$li.css('display', 'inline-block');
+			setTimeout(function() {
+				$li.css('display', 'block');
+			}, 0);
+		}
+
+		o.disabled = $.grep(o.disabled, function(n, i) { return n != index; });
+
+		// callback
+		this.element.triggerHandler('tabsenable',
+			[this.fakeEvent('tabsenable'), this.ui(this.$tabs[index], this.$panels[index])], o.enable
+		);
+
+	},
+	disable: function(index) {
+		var self = this, o = this.options;
+		if (index != o.selected) { // cannot disable already selected tab
+			this.$lis.eq(index).addClass(o.disabledClass);
+
+			o.disabled.push(index);
+			o.disabled.sort();
+
+			// callback
+			this.element.triggerHandler('tabsdisable',
+				[this.fakeEvent('tabsdisable'), this.ui(this.$tabs[index], this.$panels[index])], o.disable
+			);
+		}
+	},
+	select: function(index) {
+		if (typeof index == 'string')
+			index = this.$tabs.index( this.$tabs.filter('[href$=' + index + ']')[0] );
+		this.$tabs.eq(index).trigger(this.options.event);
+	},
+	load: function(index, callback) { // callback is for internal usage only
+		
+		var self = this, o = this.options, $a = this.$tabs.eq(index), a = $a[0],
+				bypassCache = callback == undefined || callback === false, url = $a.data('load.tabs');
+
+		callback = callback || function() {};
+		
+		// no remote or from cache - just finish with callback
+		if (!url || !bypassCache && $.data(a, 'cache.tabs')) {
+			callback();
+			return;
+		}
+
+		// load remote from here on
+		
+		var inner = function(parent) {
+			var $parent = $(parent), $inner = $parent.find('*:last');
+			return $inner.length && $inner.is(':not(img)') && $inner || $parent;
+		};
+		var cleanup = function() {
+			self.$tabs.filter('.' + o.loadingClass).removeClass(o.loadingClass)
+						.each(function() {
+							if (o.spinner)
+								inner(this).parent().html(inner(this).data('label.tabs'));
+						});
+			self.xhr = null;
+		};
+		
+		if (o.spinner) {
+			var label = inner(a).html();
+			inner(a).wrapInner('<em></em>')
+				.find('em').data('label.tabs', label).html(o.spinner);
+		}
+
+		var ajaxOptions = $.extend({}, o.ajaxOptions, {
+			url: url,
+			success: function(r, s) {
+				$(a.hash).html(r);
+				cleanup();
+				
+				if (o.cache)
+					$.data(a, 'cache.tabs', true); // if loaded once do not load them again
+
+				// callbacks
+				$(self.element).triggerHandler('tabsload',
+					[self.fakeEvent('tabsload'), self.ui(self.$tabs[index], self.$panels[index])], o.load
+				);
+				o.ajaxOptions.success && o.ajaxOptions.success(r, s);
+				
+				// This callback is required because the switch has to take
+				// place after loading has completed. Call last in order to 
+				// fire load before show callback...
+				callback();
+			}
+		});
+		if (this.xhr) {
+			// terminate pending requests from other tabs and restore tab label
+			this.xhr.abort();
+			cleanup();
+		}
+		$a.addClass(o.loadingClass);
+		setTimeout(function() { // timeout is again required in IE, "wait" for id being restored
+			self.xhr = $.ajax(ajaxOptions);
+		}, 0);
+
+	},
+	url: function(index, url) {
+		this.$tabs.eq(index).removeData('cache.tabs').data('load.tabs', url);
+	},
+	destroy: function() {
+		var o = this.options;
+		this.element.unbind('.tabs')
+			.removeClass(o.navClass).removeData('tabs');
+		this.$tabs.each(function() {
+			var href = $.data(this, 'href.tabs');
+			if (href)
+				this.href = href;
+			var $this = $(this).unbind('.tabs');
+			$.each(['href', 'load', 'cache'], function(i, prefix) {
+				$this.removeData(prefix + '.tabs');
+			});
+		});
+		this.$lis.add(this.$panels).each(function() {
+			if ($.data(this, 'destroy.tabs'))
+				$(this).remove();
+			else
+				$(this).removeClass([o.selectedClass, o.unselectClass,
+					o.disabledClass, o.panelClass, o.hideClass].join(' '));
+		});
+	},
+	fakeEvent: function(type) {
+		return $.event.fix({
+			type: type,
+			target: this.element[0]
+		});
+	}
+});
+
+$.ui.tabs.defaults = {
+	// basic setup
+	unselect: false,
+	event: 'click',
+	disabled: [],
+	cookie: null, // e.g. { expires: 7, path: '/', domain: 'jquery.com', secure: true }
+	// TODO history: false,
+
+	// Ajax
+	spinner: 'Loading&#8230;',
+	cache: false,
+	idPrefix: 'ui-tabs-',
+	ajaxOptions: {},
+
+	// animations
+	fx: null, // e.g. { height: 'toggle', opacity: 'toggle', duration: 200 }
+
+	// templates
+	tabTemplate: '<li><a href="#{href}"><span>#{label}</span></a></li>',
+	panelTemplate: '<div></div>',
+
+	// CSS classes
+	navClass: 'ui-tabs-nav',
+	selectedClass: 'ui-tabs-selected',
+	unselectClass: 'ui-tabs-unselect',
+	disabledClass: 'ui-tabs-disabled',
+	panelClass: 'ui-tabs-panel',
+	hideClass: 'ui-tabs-hide',
+	loadingClass: 'ui-tabs-loading'
+};
+
+$.ui.tabs.getter = "length";
+
+/*
+ * Tabs Extensions
+ */
+
+/*
+ * Rotate
+ */
+$.extend($.ui.tabs.prototype, {
+	rotation: null,
+	rotate: function(ms, continuing) {
+		
+		continuing = continuing || false;
+		
+		var self = this, t = this.options.selected;
+		
+		function start() {
+			self.rotation = setInterval(function() {
+				t = ++t < self.$tabs.length ? t : 0;
+				self.select(t);
+			}, ms); 
+		}
+		
+		function stop(e) {
+			if (!e || e.clientX) { // only in case of a true click
+				clearInterval(self.rotation);
+			}
+		}
+		
+		// start interval
+		if (ms) {
+			start();
+			if (!continuing)
+				this.$tabs.bind(this.options.event, stop);
+			else
+				this.$tabs.bind(this.options.event, function() {
+					stop();
+					t = self.options.selected;
+					start();
+				});
+		}
+		// stop interval
+		else {
+			stop();
+			this.$tabs.unbind(this.options.event, stop);
+		}
+	}
+});
+
+})(jQuery);
+ static/layout/nested.html view
@@ -0,0 +1,150 @@+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head> 
+	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
+
+	<title>Nested Layouts</title> 
+
+	<script type="text/javascript" src="jquery.js"></script> 
+	<script type="text/javascript" src="jquery.layout.js"></script> 
+	<script type="text/javascript" src="jquery.ui.all.js"></script> 
+
+	<script> 
+
+	var outerLayout, middleLayout, innerLayout; 
+
+	$(document).ready(function () { 
+
+		outerLayout = $('body').layout({ 
+			center__paneSelector:	".outer-center" 
+		,	west__paneSelector:		".outer-west" 
+		,	east__paneSelector:		".outer-east" 
+		,	west__size:				125 
+		,	east__size:				125 
+		,	spacing_open:			8 // ALL panes
+		,	spacing_closed:			12 // ALL panes
+		,	north__spacing_open:	0
+		,	south__spacing_open:	0
+		,	center__onresize:		"middleLayout.resizeAll" 
+		}); 
+
+		middleLayout = $('div.outer-center').layout({ 
+			center__paneSelector:	".middle-center" 
+		,	west__paneSelector:		".middle-west" 
+		,	east__paneSelector:		".middle-east" 
+		,	west__size:				100 
+		,	east__size:				100 
+		,	spacing_open:			8  // ALL panes
+		,	spacing_closed:			12 // ALL panes
+		,	center__onresize:		"innerLayout.resizeAll" 
+		}); 
+
+		innerLayout = $('div.middle-center').layout({ 
+			center__paneSelector:	".inner-center" 
+		,	west__paneSelector:		".inner-west" 
+		,	east__paneSelector:		".inner-east" 
+		,	west__size:				75 
+		,	east__size:				75 
+		,	spacing_open:			8  // ALL panes
+		,	spacing_closed:			8  // ALL panes
+		,	west__spacing_closed:	12
+		,	east__spacing_closed:	12
+		}); 
+
+	}); 
+
+
+	</script> 
+
+	<style type="text/css"> 
+
+	.ui-layout-pane { /* all 'panes' */ 
+		padding: 10px; 
+		background: #FFF; 
+		border-top: 1px solid #BBB;
+		border-bottom: 1px solid #BBB;
+		}
+		.ui-layout-pane-north ,
+		.ui-layout-pane-south {
+			border: 1px solid #BBB;
+		} 
+		.ui-layout-pane-west {
+			border-left: 1px solid #BBB;
+		} 
+		.ui-layout-pane-east {
+			border-right: 1px solid #BBB;
+		} 
+		.ui-layout-pane-center {
+			border-left: 0;
+			border-right: 0;
+			} 
+			.inner-center {
+				border: 1px solid #BBB;
+			} 
+
+		.outer-west ,
+		.outer-east {
+			background-color: #EEE;
+		}
+		.middle-west ,
+		.middle-east {
+			background-color: #F8F8F8;
+		}
+
+	.ui-layout-resizer { /* all 'resizer-bars' */ 
+		background: #DDD; 
+		}
+		.ui-layout-resizer:hover { /* all 'resizer-bars' */ 
+			background: #FED; 
+		}
+		.ui-layout-resizer-west {
+			border-left: 1px solid #BBB;
+		}
+		.ui-layout-resizer-east {
+			border-right: 1px solid #BBB;
+		}
+
+	.ui-layout-toggler { /* all 'toggler-buttons' */ 
+		background: #AAA; 
+		} 
+		.ui-layout-toggler:hover { /* all 'toggler-buttons' */ 
+			background: #FC3; 
+		} 
+
+	.outer-center ,
+	.middle-center {
+		/* center pane that are 'containers' for a nested layout */ 
+		padding: 0; 
+		border: 0; 
+	} 
+
+	</style> 
+
+</head> 
+<body> 
+
+<div class="outer-center">
+
+	<div class="middle-center">
+
+		<div class="inner-center">Inner Center</div> 
+		<div class="inner-west">Inner West</div> 
+		<div class="inner-east">Inner East</div>
+		<div class="ui-layout-north">Inner North</div> 
+		<div class="ui-layout-south">Inner South</div> 
+
+	</div> 
+	<div class="middle-west">Middle West</div> 
+	<div class="middle-east">Middle East</div> 
+
+</div> 
+
+<div class="outer-west">Outer West</div> 
+<div class="outer-east">Outer East</div> 
+
+<div class="ui-layout-north">Outer North</div> 
+<div class="ui-layout-south">Outer South</div> 
+
+</body> 
+</html> 
+
+ static/layout/simple.html view
@@ -0,0 +1,201 @@+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+
+	<title>Simple Layout Demo</title>
+
+	<script type="text/javascript" src="jquery.js"></script>
+	<script type="text/javascript" src="jquery.ui.all.js"></script>
+	<script type="text/javascript" src="jquery.layout.js"></script>
+
+	<script type="text/javascript" src="js/complex.js"></script>
+
+	<script type="text/javascript">
+
+	var myLayout; // a var is required because this page utilizes: myLayout.allowOverflow() method
+
+	$(document).ready(function () {
+		myLayout = $('body').layout({
+			// enable showOverflow on west-pane so popups will overlap north pane
+			west__showOverflowOnHover: true
+
+		//,	west__fxSettings_open: { easing: "easeOutBounce", duration: 750 }
+		});
+ 	});
+
+	</script>
+
+
+	<style type="text/css">
+	/**
+	 *	Basic Layout Theme
+	 * 
+	 *	This theme uses the default layout class-names for all classes
+	 *	Add any 'custom class-names', from options: paneClass, resizerClass, togglerClass
+	 */
+
+	.ui-layout-pane { /* all 'panes' */ 
+		background: #FFF; 
+		border: 1px solid #BBB; 
+		padding: 10px; 
+		overflow: auto;
+	} 
+
+	.ui-layout-resizer { /* all 'resizer-bars' */ 
+		background: #DDD; 
+	} 
+
+	.ui-layout-toggler { /* all 'toggler-buttons' */ 
+		background: #AAA; 
+	} 
+
+
+	</style>
+
+
+	<style type="text/css">
+	/**
+	 *	ALL CSS below is only for cosmetic and demo purposes
+	 *	Nothing here affects the appearance of the layout
+	 */
+
+	body {
+		font-family: Arial, sans-serif;
+		font-size: 0.85em;
+	}
+	p {
+		margin: 1em 0;
+	}
+
+	/*
+	 *	Rules below are for simulated drop-down/pop-up lists
+	 */
+
+	ul {
+		/* rules common to BOTH inner and outer UL */
+		z-index:	100000;
+		margin:		1ex 0;
+		padding:	0;
+		list-style:	none;
+		cursor:		pointer;
+		border:		1px solid Black;
+		/* rules for outer UL only */
+		width:		15ex;
+		position:	relative;
+	}
+	ul li {
+		background-color: #EEE;
+		padding: 0.15em 1em 0.3em 5px;
+	}
+	ul ul {
+		display:	none;
+		position:	absolute;
+		width:		100%;
+		left:		-1px;
+		/* Pop-Up */
+		bottom:		0;
+		margin:		0;
+		margin-bottom: 1.55em;
+	}
+	.ui-layout-north ul ul {
+		/* Drop-Down */
+		bottom:		auto;
+		margin:		0;
+		margin-top:	1.45em;
+	}
+	ul ul li		{ padding: 3px 1em 3px 5px; }
+	ul ul li:hover	{ background-color: #FF9; }
+	ul li:hover ul	{ display:	block; background-color: #EEE; }
+
+	</style>
+
+</head>
+<body>
+
+<!-- manually attach allowOverflow method to pane -->
+<div class="ui-layout-north" onmouseover="myLayout.allowOverflow('north')" onmouseout="myLayout.resetOverflow(this)">
+	This is the north pane, closable, slidable and resizable
+
+	<ul>
+		<li>
+			<ul>
+				<li>one</li>
+				<li>two</li>
+				<li>three</li>
+				<li>four</li>
+				<li>five</li>
+			</ul>
+			Drop-Down <!-- put this below so IE and FF render the same! -->
+		</li>
+	</ul>
+
+</div>
+
+<!-- allowOverflow auto-attached by option: west__showOverflowOnHover = true -->
+<div class="ui-layout-west">
+	This is the west pane, closable, slidable and resizable
+
+	<ul>
+		<li>
+			<ul>
+				<li>one</li>
+				<li>two</li>
+				<li>three</li>
+				<li>four</li>
+				<li>five</li>
+			</ul>
+			Pop-Up <!-- put this below so IE and FF render the same! -->
+		</li>
+	</ul>
+
+	<p><button onclick="myLayout.close('west')">Close Me</button></p>
+
+	<p><a href="#" onClick="showOptions(myLayout,'defaults.fxSettings_open');showOptions(myLayout,'west.fxSettings_close')">Show Options.Defaults</a></p>
+
+</div>
+
+<div class="ui-layout-south">
+	This is the south pane, closable, slidable and resizable &nbsp;
+	<button onclick="myLayout.toggle('north')">Toggle North Pane</button>
+</div>
+
+<div class="ui-layout-east">
+	This is the east pane, closable, slidable and resizable
+
+	<!-- attach allowOverflow method to this specific element -->
+	<ul onmouseover="myLayout.allowOverflow(this)" onmouseout="myLayout.resetOverflow('east')">
+		<li>
+			<ul>
+				<li>one</li>
+				<li>two</li>
+				<li>three</li>
+				<li>four</li>
+				<li>five</li>
+			</ul>
+			Pop-Up <!-- put this below so IE and FF render the same! -->
+		</li>
+	</ul>
+
+	<p><button onclick="myLayout.close('east')">Close Me</button></p>
+
+	<p>...</p><p>...</p><p>...</p><p>...</p><p>...</p><p>...</p><p>...</p><p>...</p><p>...</p>
+	<p>...</p><p>...</p><p>...</p><p>...</p><p>...</p><p>...</p><p>...</p><p>...</p><p>...</p>
+	<p>...</p><p>...</p><p>...</p><p>...</p><p>...</p><p>...</p><p>...</p><p>...</p><p>...</p>
+	<p>...</p><p>...</p><p>...</p><p>...</p><p>...</p><p>...</p><p>...</p><p>...</p><p>...</p>
+</div>
+
+<div class="ui-layout-center">
+	This center pane auto-sizes to fit the space <i>between</i> the 'border-panes'
+	<p>This layout was created with only <b>default options</b> - no customization</p>
+	<p>Only the <b>applyDefaultStyles</b> option was enabled for <i>basic</i> formatting</p>
+	<p>The Pop-Up and Drop-Down lists demonstrate the <b>allowOverflow()</b> utility</p>
+	<p>The Close and Toggle buttons are examples of <b>custom buttons</b></p>
+	<p><a href="http://layout.jquery-dev.net/demos.html">Go to the Demos page</a></p>
+	<p>...</p><p>...</p><p>...</p><p>...</p><p>...</p><p>...</p><p>...</p><p>...</p><p>...</p>
+	<p>...</p><p>...</p><p>...</p><p>...</p><p>...</p><p>...</p><p>...</p><p>...</p><p>...</p>
+	<p>...</p><p>...</p><p>...</p><p>...</p><p>...</p><p>...</p><p>...</p><p>...</p><p>...</p>
+	<p>...</p><p>...</p><p>...</p><p>...</p><p>...</p><p>...</p><p>...</p><p>...</p><p>...</p>
+</div>
+
+</body>
+</html>