diff --git a/build/all.js b/build/all.js index 1d073c1..b322fc1 100644 --- a/build/all.js +++ b/build/all.js @@ -12,6 +12,7 @@ if (options.indexOf('--add-keys') != -1){ var cmds = [ ["build/docs", "core"], ["build/docs", "more"], + ["build/demos", "demos"], ["build/guides", "core"], ["build/guides", "more"], ["build/blog"] diff --git a/build/demos.js b/build/demos.js new file mode 100644 index 0000000..97f2f5c --- /dev/null +++ b/build/demos.js @@ -0,0 +1,96 @@ +"use strict"; + +var fs = require('fs'); +var fse = require('fs-extra'); +var path = require('path'); +var YAML = require('js-yaml'); +var pkg = require('../package.json'); +var compile = require('../lib/compile-md'); +var getFiles = require('../lib/getFiles'); +var HEADER_REGEXP = /\/\*\s*^---([\s\S]+?)^(?:\.\.\.|---)\s*\*\//mg; +var DESC_REGEXP = /...\n?\*\/\n*([\s\S]*)/m; + +var args = process.argv; + +if (args.length < 3){ + console.log('usage: node demos.js "demos"'); + process.exit(1); +} + +var project = args[2]; +var placeholder = ''; // a possible generic text string +var outputDir = path.join(__dirname, "../", pkg._buildOutput, project, "docs"); + +build(project, outputDir); + +function processDetails(chunk){ + var headers = chunk.match(HEADER_REGEXP)[0]; + var html = chunk.match(DESC_REGEXP); + return { + YAML: YAML.load(headers.slice(2, -2)), + HTML: html ? html[1] : placeholder + } +} + +function copy(src, target){ + var folder = path.dirname(target); + var subFolder = path.dirname(folder); + if (!fs.existsSync(subFolder)){ + fs.mkdirSync(subFolder); + } + fs.mkdir(folder + '/', function(err){ + if (err && err.code != 'EEXIST') console.error(err); + src && fse.copy(src, target, function(err){ + if (err) console.error(err); + }); + }); +} + +function build(project, dir){ + var repoPath = path.join(dir, "demos", "demos"); + var demoFolder = fs.readdirSync(repoPath); + var tocDemos = {}; + + demoFolder.forEach(function(demo){ + + var demoPath = path.join(repoPath, demo); + var type = fs.statSync(demoPath); + if (!type.isDirectory()) return; + + var partials = getFiles(demoPath, null); + var jsFiddle = {}; + jsFiddle.highlighted = {}; + var yamlHeader; + + partials.forEach(function(file){ + + var ext = path.extname(file).slice(1); + var content = fs.readFileSync(file, 'utf8'); + + if (!ext.match(/html|css|js|details/)){ + var lastPath = file.split(demo)[1]; + var target = path.join(__dirname, "../", "public", "demos", demo, lastPath); + return copy(file, target); + } + + if (ext == 'details'){ + var details = processDetails(content); + yamlHeader = details.YAML; + content = details.HTML; + } else { + // add tab so the compiler reads as a tabbed .md code block + var preparedContent = '\t' + content.replace(/\n/g, '\n\t'); + jsFiddle.highlighted[ext] = compile(preparedContent).content; + } + + jsFiddle[ext] = content; + }); + + tocDemos[demo] = { + link: '/demos/?demo=' + demo, + description: yamlHeader + } + fs.writeFile(path.join(dir, demo + '.json'), JSON.stringify(jsFiddle, null, 2)); + }); + fs.writeFile(dir + '/toc-demos.json', JSON.stringify(tocDemos, null, 2)); +} diff --git a/build/repositories.js b/build/repositories.js index 497e5a3..b5e8cda 100644 --- a/build/repositories.js +++ b/build/repositories.js @@ -57,8 +57,9 @@ var versions = []; prime.each(projects, function(project, name){ project.versions.forEach(function(version){ + var versionPath = name + (version ? '-' + version : ''); versions.push({ - dir: path.join(__dirname, '../', pkg._buildOutput, name, 'docs', name + '-' + version), + dir: path.join(__dirname, '../', pkg._buildOutput, name, 'docs', versionPath), repository: project.repository, version: version }); diff --git a/demos/index.js b/demos/index.js new file mode 100644 index 0000000..c3d8918 --- /dev/null +++ b/demos/index.js @@ -0,0 +1,10 @@ +"use strict"; + +var project = 'demos'; +var demos = require('../middleware/demos')(project, { + title: "MooTools Demos" +}); + +module.exports = function(app){ + app.get('/demos/', demos); +}; diff --git a/index.js b/index.js index b59ae21..24e757a 100644 --- a/index.js +++ b/index.js @@ -49,6 +49,7 @@ app.use(bodyParser.json()); // fix trailing slashes in path app.use(function(req, res, next){ + if (req.method == 'POST') return next(); if (req.path != '/' && req.path.substr(-1) == '/'){ var query = req.url.slice(req.path.length); res.redirect(301, req.path.slice(0, -1) + query); @@ -62,7 +63,6 @@ if (app.get('env') == 'development'){ app.use(morgan('dev')); app.use(errorhandler()); - app.use(function setJadePretty(req, res, next){ res.locals.pretty = true; res.locals.cache = false; @@ -79,7 +79,7 @@ require('./middleware/build-static')(app, { dirname: __dirname }); -app.use(express.static(__dirname + '/public')); +app.use(express.static(__dirname + '/public', { redirect: false })); // github, twitter & blog feeds var githubEvents = require('./middleware/githubEvents')({ @@ -88,7 +88,7 @@ var githubEvents = require('./middleware/githubEvents')({ var twitter = require('./middleware/twitter')(); var blogData = require('./blog/data'); function getLatestBlog(req, res, next){ - blogData.get(function(err, blog) { + blogData.get(function(err, blog){ if (err) next(err); res.locals.lastBlogPost = blog.posts[0]; next(); @@ -114,6 +114,7 @@ app.get('/search', function(req, res){ require('./core')(app); require('./more')(app); +require('./demos')(app); require('./blog')(app); require('./books')(app); require('./builder')(app); @@ -139,6 +140,13 @@ app.get(/^\/download/i, function(req, res){ res.redirect(301, '/core'); }); +// for demos to echo Requests +app.post('/echo/:type', function(req, res){ + var type = req.params.type; + res.send(req.body[type]); + res.end(); +}); + // handle 404 errors app.get('*', function(req, res, next){ var err = new Error(); diff --git a/lib/compile-md.js b/lib/compile-md.js index a404dac..0acb3ca 100644 --- a/lib/compile-md.js +++ b/lib/compile-md.js @@ -37,6 +37,7 @@ function compile(md, path){ else if (lang == 'shell') lang = 'bash'; } else { if (code.match(/^<\w+[>\s]/)) lang = 'xml'; + else if (code.match(/^[\.#]?\w+[\.#\s]?{/)) lang = 'css'; else lang = 'javascript'; } code = hljs.highlight(lang, code).value.trim(); diff --git a/middleware/demos.js b/middleware/demos.js new file mode 100644 index 0000000..2736fef --- /dev/null +++ b/middleware/demos.js @@ -0,0 +1,97 @@ +"use strict"; + +var fs = require('fs'); +var path = require('path'); +var async = require('async'); +var pkg = require('../package.json'); +var waitForIt = require('../lib/waitForIt'); +var getFiles = require('../lib/getFiles'); +var loadJSON = require('../lib/loadJSON'); +var associate = require('../lib/associate'); +var debounce = require('../lib/debounce'); + + +function filterToc(file, cb){ + cb(!fs.statSync(file).isDirectory() && file.indexOf('toc-demos.json') == -1 && file.slice(-4) == 'json'); +} + +function loadFiles(dir, callback){ + + var addPath = function(files, cb){ + async.map(files, function(fileName, cbMap){ + cbMap(null, path.join(dir, fileName)); + }, cb); + } + var filterFiles = function(files, cb){ + async.filter(files, filterToc, function(filtered){ + // to sort files alphabetically without file extension interfering + var orderedFiles = filtered.map(function(file){ + return file.slice(0, -5); + }).sort().map(function(file){ + return file + '.json'; + }); + cb(null, orderedFiles); + }); + } + var addContent = function(arr, cb){ + async.map(arr, loadJSON, cb); + } + var loadToc = function(filesContent, cb){ + loadJSON(dir + '/toc-demos.json', function(err, data){ + cb(err, !err && { + content: associate(Object.keys(data), filesContent), + toc: data + }); + }); + } + var compiler = async.compose(loadToc, addContent, filterFiles, addPath, fs.readdir); + compiler(dir, callback); +} + +module.exports = function(project, options){ + + if (!project){ + throw new Error("'project' argument is required"); + } + + if (!options) options = {}; + if (!options.title) options.title = project; + + var dir = path.join(__dirname, '..', pkg._buildOutput, project, 'docs'); + var files = async.apply(loadFiles, dir); + var loadDemos = waitForIt(files); + + fs.watch(dir, debounce(function(){ + console.log('resetting ' + dir + ' docs data'); + loadDemos.reset(); + })); + + function send404(next){ + var err404 = new Error(); + err404.status = 404; + next(err404); + } + + return function(req, res, next){ + + loadDemos.get(function(err, results){ + + if (err) return next(err); + var demo = req.query.demo || Object.keys(results.content)[0]; + var toc = results.toc[demo]; + var data = results.content[demo]; + if (!data) return send404(next); + + res.render(project, { + title: options.title, + navigation: 'demos', + content: data, + description: data.details, + demoName: toc.description.name, + dependencies: toc.description.dependencies || 'dependencies/more/', + version: pkg._projects.core.versions[0], + toc: results.toc + }); + }); + }; +}; diff --git a/package.json b/package.json index ec65876..738ac67 100644 --- a/package.json +++ b/package.json @@ -80,6 +80,10 @@ "1.2.5.1", "1.0.2" ] + }, + "demos": { + "repository": "https://github.com/mootools/mootools-demos", + "versions": [""] } } } diff --git a/public/demos/.gitignore b/public/demos/.gitignore new file mode 100644 index 0000000..5c379ea --- /dev/null +++ b/public/demos/.gitignore @@ -0,0 +1,5 @@ +Drag.Scroll/ +Element.Event.Pseudos/ +MouseWheel/ +Request.JSON/ +*.DS_Store diff --git a/public/demos/MooTools-More-1.5.1-compressed.js b/public/demos/MooTools-More-1.5.1-compressed.js new file mode 100644 index 0000000..25c49e3 --- /dev/null +++ b/public/demos/MooTools-More-1.5.1-compressed.js @@ -0,0 +1,5 @@ +/* MooTools: the javascript framework. license: MIT-style license. copyright: Copyright (c) 2006-2014 [Valerio Proietti](http://mad4milk.net/).*/ +MooTools.More={version:"1.5.1",build:"2dd695ba957196ae4b0275a690765d6636a61ccd"},function(){var t={wait:function(t){return this.chain(function(){return this.callChain.delay(null==t?500:t,this),this}.bind(this))}};Chain.implement(t),this.Fx&&Fx.implement(t),this.Element&&Element.implement&&this.Fx&&Element.implement({chains:function(t){return Array.from(t||["tween","morph","reveal"]).each(function(t){t=this.get(t),t&&t.setOptions({link:"chain"})},this),this},pauseFx:function(t,e){return this.chains(e).get(e||"tween").wait(t),this}})}(),Class.Mutators.Binds=function(t){return this.prototype.initialize||this.implement("initialize",function(){}),Array.from(t).concat(this.prototype.Binds||[])},Class.Mutators.initialize=function(t){return function(){return Array.from(this.Binds).each(function(t){var e=this[t];e&&(this[t]=e.bind(this))},this),t.apply(this,arguments)}};var Drag=new Class({Implements:[Events,Options],options:{snap:6,unit:"px",grid:!1,style:!0,limit:!1,handle:!1,invert:!1,preventDefault:!1,stopPropagation:!1,compensateScroll:!1,modifiers:{x:"left",y:"top"}},initialize:function(){var t=Array.link(arguments,{options:Type.isObject,element:function(t){return null!=t}});this.element=document.id(t.element),this.document=this.element.getDocument(),this.setOptions(t.options||{});var e=typeOf(this.options.handle);this.handles=("array"==e||"collection"==e?$$(this.options.handle):document.id(this.options.handle))||this.element,this.mouse={now:{},pos:{}},this.value={start:{},now:{}},this.offsetParent=function(t){var e=t.getOffsetParent(),i=!e||/^(?:body|html)$/i.test(e.tagName);return i?window:document.id(e)}(this.element),this.selection="selectstart"in document?"selectstart":"mousedown",this.compensateScroll={start:{},diff:{},last:{}},!("ondragstart"in document)||"FileReader"in window||Drag.ondragstartFixed||(document.ondragstart=Function.from(!1),Drag.ondragstartFixed=!0),this.bound={start:this.start.bind(this),check:this.check.bind(this),drag:this.drag.bind(this),stop:this.stop.bind(this),cancel:this.cancel.bind(this),eventStop:Function.from(!1),scrollListener:this.scrollListener.bind(this)},this.attach()},attach:function(){return this.handles.addEvent("mousedown",this.bound.start),this.options.compensateScroll&&this.offsetParent.addEvent("scroll",this.bound.scrollListener),this},detach:function(){return this.handles.removeEvent("mousedown",this.bound.start),this.options.compensateScroll&&this.offsetParent.removeEvent("scroll",this.bound.scrollListener),this},scrollListener:function(){if(this.mouse.start){var t=this.offsetParent.getScroll();if("absolute"==this.element.getStyle("position")){var e=this.sumValues(t,this.compensateScroll.last,-1);this.mouse.now=this.sumValues(this.mouse.now,e,1)}else this.compensateScroll.diff=this.sumValues(t,this.compensateScroll.start,-1);this.offsetParent!=window&&(this.compensateScroll.diff=this.sumValues(this.compensateScroll.start,t,-1)),this.compensateScroll.last=t,this.render(this.options)}},sumValues:function(t,e,i){var n={},s=this.options;for(z in s.modifiers)s.modifiers[z]&&(n[z]=t[z]+e[z]*i);return n},start:function(t){var e=this.options;if(!t.rightClick){e.preventDefault&&t.preventDefault(),e.stopPropagation&&t.stopPropagation(),this.compensateScroll.start=this.compensateScroll.last=this.offsetParent.getScroll(),this.compensateScroll.diff={x:0,y:0},this.mouse.start=t.page,this.fireEvent("beforeStart",this.element);var i=e.limit;this.limit={x:[],y:[]};var n,s,r=this.offsetParent==window?null:this.offsetParent;for(n in e.modifiers)if(e.modifiers[n]){var o=this.element.getStyle(e.modifiers[n]);if(o&&!o.match(/px$/)&&(s||(s=this.element.getCoordinates(r)),o=s[e.modifiers[n]]),this.value.now[n]=e.style?(o||0).toInt():this.element[e.modifiers[n]],e.invert&&(this.value.now[n]*=-1),this.mouse.pos[n]=t.page[n]-this.value.now[n],i&&i[n])for(var a=2;a--;){var h=i[n][a];(h||0===h)&&(this.limit[n][a]="function"==typeof h?h():h)}}"number"==typeOf(this.options.grid)&&(this.options.grid={x:this.options.grid,y:this.options.grid});var l={mousemove:this.bound.check,mouseup:this.bound.cancel};l[this.selection]=this.bound.eventStop,this.document.addEvents(l)}},check:function(t){this.options.preventDefault&&t.preventDefault();var e=Math.round(Math.sqrt(Math.pow(t.page.x-this.mouse.start.x,2)+Math.pow(t.page.y-this.mouse.start.y,2)));e>this.options.snap&&(this.cancel(),this.document.addEvents({mousemove:this.bound.drag,mouseup:this.bound.stop}),this.fireEvent("start",[this.element,t]).fireEvent("snap",this.element))},drag:function(t){var e=this.options;e.preventDefault&&t.preventDefault(),this.mouse.now=this.sumValues(t.page,this.compensateScroll.diff,-1),this.render(e),this.fireEvent("drag",[this.element,t])},render:function(t){for(var e in t.modifiers)t.modifiers[e]&&(this.value.now[e]=this.mouse.now[e]-this.mouse.pos[e],t.invert&&(this.value.now[e]*=-1),t.limit&&this.limit[e]&&((this.limit[e][1]||0===this.limit[e][1])&&this.value.now[e]>this.limit[e][1]?this.value.now[e]=this.limit[e][1]:(this.limit[e][0]||0===this.limit[e][0])&&this.value.now[e]0^t0^t>this.max||(t=this.max),this.step=t.round(this.modulus.decimalLength),e?this.checkStep().setKnobPosition(this.toPosition(this.step)):this.checkStep().fireEvent("tick",this.toPosition(this.step)).fireEvent("move").end(),this},setRange:function(t,e,i){this.min=Array.pick([t[0],0]),this.max=Array.pick([t[1],this.options.steps]),this.range=this.max-this.min,this.steps=this.options.steps||this.full;this.stepSize=Math.abs(this.range)/this.steps;return this.stepWidth=this.stepSize*this.full/Math.abs(this.range),this.setModulus(),t&&this.set(Array.pick([e,this.step]).limit(this.min,this.max),i),this},setModulus:function(){for(var t=((this.stepSize+"").split(".")[1]||[]).length,e="1";t--;)e+="0";this.modulus={multiplier:e.toInt(10),decimalLength:e.length-1}},clickedElement:function(t){if(!this.isDragging&&t.target!=this.knob){var e=this.range<0?-1:1,i=t.page[this.axis]-this.element.getPosition()[this.axis]-this.half;i=i.limit(-this.options.offset,this.full-this.options.offset),this.step=(this.min+e*this.toStep(i)).round(this.modulus.decimalLength),this.checkStep().fireEvent("tick",i).fireEvent("move").end()}},scrolledElement:function(t){var e="horizontal"==this.options.mode?t.wheel<0:t.wheel>0;this.set(this.step+(e?-1:1)*this.stepSize),t.stop()},draggedKnob:function(){var t=this.range<0?-1:1,e=this.drag.value.now[this.axis];e=e.limit(-this.options.offset,this.full-this.options.offset),this.step=(this.min+t*this.toStep(e)).round(this.modulus.decimalLength),this.checkStep(),this.fireEvent("move")},checkStep:function(){var t=this.step;return this.previousChange!=t&&(this.previousChange=t,this.fireEvent("change",t)),this},end:function(){var t=this.step;return this.previousEnd!==t&&(this.previousEnd=t,this.fireEvent("complete",t+"")),this},toStep:function(t){var e=(t+this.options.offset)*this.stepSize/this.full*this.steps;return this.options.steps?(e-e*this.modulus.multiplier%(this.stepSize*this.modulus.multiplier)/this.modulus.multiplier).round(this.modulus.decimalLength):e},toPosition:function(t){return this.full*Math.abs(this.min-t)/(this.steps*this.stepSize)-this.options.offset||0}});Drag.Move=new Class({Extends:Drag,options:{droppables:[],container:!1,precalculate:!1,includeMargins:!0,checkDroppables:!0},initialize:function(t,e){if(this.parent(t,e),t=this.element,this.droppables=$$(this.options.droppables),this.setContainer(this.options.container),this.options.style){if("left"==this.options.modifiers.x&&"top"==this.options.modifiers.y){var i=t.getOffsetParent(),n=t.getStyles("left","top");!i||"auto"!=n.left&&"auto"!=n.top||t.setPosition(t.getPosition(i))}"static"==t.getStyle("position")&&t.setStyle("position","absolute")}this.addEvent("start",this.checkDroppables,!0),this.overed=null},setContainer:function(t){this.container=document.id(t),this.container&&"element"!=typeOf(this.container)&&(this.container=document.id(this.container.getDocument().body))},start:function(t){this.container&&(this.options.limit=this.calculateLimit()),this.options.precalculate&&(this.positions=this.droppables.map(function(t){return t.getCoordinates()})),this.parent(t)},calculateLimit:function(){var t=this.element,e=this.container,i=document.id(t.getOffsetParent())||document.body,n=e.getCoordinates(i),s={},r={},o={},a={},h={},l=i.getScroll();["top","right","bottom","left"].each(function(n){s[n]=t.getStyle("margin-"+n).toInt(),r[n]=t.getStyle("border-"+n).toInt(),o[n]=e.getStyle("margin-"+n).toInt(),a[n]=e.getStyle("border-"+n).toInt(),h[n]=i.getStyle("padding-"+n).toInt()},this);var u=t.offsetWidth+s.left+s.right,c=t.offsetHeight+s.top+s.bottom,d=0+l.x,m=0+l.y,f=n.right-a.right-u+l.x,p=n.bottom-a.bottom-c+l.y;if(this.options.includeMargins?(d+=s.left,m+=s.top):(f+=s.right,p+=s.bottom),"relative"==t.getStyle("position")){var g=t.getCoordinates(i);g.left-=t.getStyle("left").toInt(),g.top-=t.getStyle("top").toInt(),d-=g.left,m-=g.top,"relative"!=e.getStyle("position")&&(d+=a.left,m+=a.top),f+=s.left-g.left,p+=s.top-g.top,e!=i&&(d+=o.left+h.left,!h.left&&0>d&&(d=0),m+=i==document.body?0:o.top+h.top,!h.top&&0>m&&(m=0))}else d-=s.left,m-=s.top,e!=i&&(d+=n.left+a.left,m+=n.top+a.top);return{x:[d,f],y:[m,p]}},getDroppableCoordinates:function(t){var e=t.getCoordinates();if("fixed"==t.getStyle("position")){var i=window.getScroll();e.left+=i.x,e.right+=i.x,e.top+=i.y,e.bottom+=i.y}return e},checkDroppables:function(){var t=this.droppables.filter(function(t,e){t=this.positions?this.positions[e]:this.getDroppableCoordinates(t);var i=this.mouse.now;return i.x>t.left&&i.xt.top},this).getLast();this.overed!=t&&(this.overed&&this.fireEvent("leave",[this.element,this.overed]),t&&this.fireEvent("enter",[this.element,t]),this.overed=t)},drag:function(t){this.parent(t),this.options.checkDroppables&&this.droppables.length&&this.checkDroppables()},stop:function(t){return this.checkDroppables(),this.fireEvent("drop",[this.element,this.overed,t]),this.overed=null,this.parent(t)}}),Element.implement({makeDraggable:function(t){var e=new Drag.Move(this,t);return this.store("dragger",e),e}});var Sortables=new Class({Implements:[Events,Options],options:{opacity:1,clone:!1,revert:!1,handle:!1,dragOptions:{},unDraggableTags:["button","input","a","textarea","select","option"]},initialize:function(t,e){this.setOptions(e),this.elements=[],this.lists=[],this.idle=!0,this.addLists($$(document.id(t)||t)),this.options.clone||(this.options.revert=!1),this.options.revert&&(this.effect=new Fx.Morph(null,Object.merge({duration:250,link:"cancel"},this.options.revert)))},attach:function(){return this.addLists(this.lists),this},detach:function(){return this.lists=this.removeLists(this.lists),this},addItems:function(){return Array.flatten(arguments).each(function(t){this.elements.push(t);var e=t.retrieve("sortables:start",function(e){this.start.call(this,e,t)}.bind(this));(this.options.handle?t.getElement(this.options.handle)||t:t).addEvent("mousedown",e)},this),this},addLists:function(){return Array.flatten(arguments).each(function(t){this.lists.include(t),this.addItems(t.getChildren())},this),this},removeItems:function(){return $$(Array.flatten(arguments).map(function(t){this.elements.erase(t);var e=t.retrieve("sortables:start");return(this.options.handle?t.getElement(this.options.handle)||t:t).removeEvent("mousedown",e),t},this))},removeLists:function(){return $$(Array.flatten(arguments).map(function(t){return this.lists.erase(t),this.removeItems(t.getChildren()),t},this))},getDroppableCoordinates:function(t){var e=t.getOffsetParent(),i=t.getPosition(e),n={w:window.getScroll(),offsetParent:e.getScroll()};return i.x+=n.offsetParent.x,i.y+=n.offsetParent.y,"fixed"==e.getStyle("position")&&(i.x-=n.w.x,i.y-=n.w.y),i},getClone:function(t,e){if(!this.options.clone)return new Element(e.tagName).inject(document.body);if("function"==typeOf(this.options.clone))return this.options.clone.call(this,t,e,this.list);var i=e.clone(!0).setStyles({margin:0,position:"absolute",visibility:"hidden",width:e.getStyle("width")}).addEvent("mousedown",function(t){e.fireEvent("mousedown",t)});return i.get("html").test("radio")&&i.getElements("input[type=radio]").each(function(t,i){t.set("name","clone_"+i),t.get("checked")&&e.getElements("input[type=radio]")[i].set("checked",!0)}),i.inject(this.list).setPosition(this.getDroppableCoordinates(this.element))},getDroppables:function(){var t=this.list.getChildren().erase(this.clone).erase(this.element);return this.options.constrain||t.append(this.lists).erase(this.list),t},insert:function(t,e){var i="inside";this.lists.contains(e)?(this.list=e,this.drag.droppables=this.getDroppables()):i=this.element.getAllPrevious().contains(e)?"before":"after",this.element.inject(e,i),this.fireEvent("sort",[this.element,this.clone])},start:function(t,e){!this.idle||t.rightClick||!this.options.handle&&this.options.unDraggableTags.contains(t.target.get("tag"))||(this.idle=!1,this.element=e,this.opacity=e.getStyle("opacity"),this.list=e.getParent(),this.clone=this.getClone(t,e),this.drag=new Drag.Move(this.clone,Object.merge({droppables:this.getDroppables()},this.options.dragOptions)).addEvents({onSnap:function(){t.stop(),this.clone.setStyle("visibility","visible"),this.element.setStyle("opacity",this.options.opacity||0),this.fireEvent("start",[this.element,this.clone])}.bind(this),onEnter:this.insert.bind(this),onCancel:this.end.bind(this),onComplete:this.end.bind(this)}),this.clone.inject(this.element,"before"),this.drag.start(t))},end:function(){this.drag.detach(),this.element.setStyle("opacity",this.opacity);var t=this;if(this.effect){var e=this.element.getStyles("width","height"),i=this.clone,n=i.computePosition(this.getDroppableCoordinates(i)),s=function(){this.removeEvent("cancel",s),i.destroy(),t.reset()};this.effect.element=i,this.effect.start({top:n.top,left:n.left,width:e.width,height:e.height,opacity:.25}).addEvent("cancel",s).chain(s)}else this.clone.destroy(),t.reset()},reset:function(){this.idle=!0,this.fireEvent("complete",this.element)},serialize:function(){var t=Array.link(arguments,{modifier:Type.isFunction,index:function(t){return null!=t}}),e=this.lists.map(function(e){return e.getChildren().map(t.modifier||function(t){return t.get("id")},this)},this),i=t.index;return 1==this.lists.length&&(i=0),(i||0===i)&&i>=0&&i\s*)*<(t[dhr]|tbody|tfoot|thead)/i);if(n){i=new Element("table");var s=n[1].toLowerCase();["td","th","tr"].contains(s)&&(i=new Element("tbody").inject(i),"tr"!=s&&(i=new Element("tr").inject(i)))}return(i||new Element("div")).set("html",t).getChildren()},Class.Occlude=new Class({occlude:function(t,e){e=document.id(e||this.element);var i=e.retrieve(t||this.property);return i&&!this.occluded?this.occluded=i:(this.occluded=!1,e.store(t||this.property,this),this.occluded)}}),Class.refactor=function(t,e){return Object.each(e,function(e,i){var n=t.prototype[i];n=n&&n.$origin||n||function(){},t.implement(i,"function"==typeof e?function(){var t=this.previous;this.previous=n;var i=e.apply(this,arguments);return this.previous=t,i}:e)}),t},function(t){var e=Element.Position={options:{relativeTo:document.body,position:{x:"center",y:"center"},offset:{x:0,y:0}},getOptions:function(t,i){return i=Object.merge({},e.options,i),e.setPositionOption(i),e.setEdgeOption(i),e.setOffsetOption(t,i),e.setDimensionsOption(t,i),i},setPositionOption:function(t){t.position=e.getCoordinateFromValue(t.position)},setEdgeOption:function(t){var i=e.getCoordinateFromValue(t.edge);t.edge=i?i:"center"==t.position.x&&"center"==t.position.y?{x:"center",y:"center"}:{x:"left",y:"top"}},setOffsetOption:function(t,e){var i={x:0,y:0},n={x:0,y:0},s=t.measure(function(){return document.id(this.getOffsetParent())});s&&s!=t.getDocument().body&&(n=s.getScroll(),i=s.measure(function(){var t=this.getPosition();if("fixed"==this.getStyle("position")){var e=window.getScroll();t.x+=e.x,t.y+=e.y}return t}),e.offset={parentPositioned:s!=document.id(e.relativeTo),x:e.offset.x-i.x+n.x,y:e.offset.y-i.y+n.y})},setDimensionsOption:function(t,e){e.dimensions=t.getDimensions({computeSize:!0,styles:["padding","border","margin"]})},getPosition:function(t,i){var n={};i=e.getOptions(t,i);var s=document.id(i.relativeTo)||document.body;e.setPositionCoordinates(i,n,s),i.edge&&e.toEdge(n,i);var r=i.offset;return n.left=(n.x>=0||r.parentPositioned||i.allowNegative?n.x:0).toInt(),n.top=(n.y>=0||r.parentPositioned||i.allowNegative?n.y:0).toInt(),e.toMinMax(n,i),(i.relFixedPosition||"fixed"==s.getStyle("position"))&&e.toRelFixedPosition(s,n),i.ignoreScroll&&e.toIgnoreScroll(s,n),i.ignoreMargins&&e.toIgnoreMargins(n,i),n.left=Math.ceil(n.left),n.top=Math.ceil(n.top),delete n.x,delete n.y,n},setPositionCoordinates:function(t,e,i){var n=t.offset.y,s=t.offset.x,r=i==document.body?window.getScroll():i.getPosition(),o=r.y,a=r.x,h=window.getSize();switch(t.position.x){case"left":e.x=a+s;break;case"right":e.x=a+s+i.offsetWidth;break;default:e.x=a+(i==document.body?h.x:i.offsetWidth)/2+s}switch(t.position.y){case"top":e.y=o+n;break;case"bottom":e.y=o+n+i.offsetHeight;break;default:e.y=o+(i==document.body?h.y:i.offsetHeight)/2+n}},toMinMax:function(t,e){var i,n={left:"x",top:"y"};["minimum","maximum"].each(function(s){["left","top"].each(function(r){i=e[s]?e[s][n[r]]:null,null!=i&&("minimum"==s?t[r]i)&&(t[r]=i)})})},toRelFixedPosition:function(t,e){var i=window.getScroll();e.top+=i.y,e.left+=i.x},toIgnoreScroll:function(t,e){var i=t.getScroll();e.top-=i.y,e.left-=i.x},toIgnoreMargins:function(t,e){t.left+="right"==e.edge.x?e.dimensions["margin-right"]:"center"!=e.edge.x?-e.dimensions["margin-left"]:-e.dimensions["margin-left"]+(e.dimensions["margin-right"]+e.dimensions["margin-left"])/2,t.top+="bottom"==e.edge.y?e.dimensions["margin-bottom"]:"center"!=e.edge.y?-e.dimensions["margin-top"]:-e.dimensions["margin-top"]+(e.dimensions["margin-bottom"]+e.dimensions["margin-top"])/2},toEdge:function(t,e){var i={},n=e.dimensions,s=e.edge;switch(s.x){case"left":i.x=0;break;case"right":i.x=-n.x-n.computedRight-n.computedLeft;break;default:i.x=-Math.round(n.totalWidth/2)}switch(s.y){case"top":i.y=0;break;case"bottom":i.y=-n.y-n.computedTop-n.computedBottom;break;default:i.y=-Math.round(n.totalHeight/2)}t.x+=i.x,t.y+=i.y},getCoordinateFromValue:function(t){return"string"!=typeOf(t)?t:(t=t.toLowerCase(),{x:t.test("left")?"left":t.test("right")?"right":"center",y:t.test(/upper|top/)?"top":t.test("bottom")?"bottom":"center"})}};Element.implement({position:function(e){if(e&&(null!=e.x||null!=e.y))return t?t.apply(this,arguments):this;var i=this.setStyle("position","absolute").calculatePosition(e);return e&&e.returnPos?i:this.setStyles(i)},calculatePosition:function(t){return e.getPosition(this,t)}})}(Element.prototype.position),function(){var t=!1;this.IframeShim=new Class({Implements:[Options,Events,Class.Occlude],options:{className:"iframeShim",src:'javascript:false;document.write("");',display:!1,zIndex:null,margin:0,offset:{x:0,y:0},browsers:t},property:"IframeShim",initialize:function(t,e){return this.element=document.id(t),this.occlude()?this.occluded:(this.setOptions(e),this.makeShim(),this)},makeShim:function(){if(this.options.browsers){var t=this.element.getStyle("zIndex").toInt();if(!t){t=1;var e=this.element.getStyle("position");"static"!=e&&e||this.element.setStyle("position","relative"),this.element.setStyle("zIndex",t)}t=(null!=this.options.zIndex||0===this.options.zIndex)&&t>this.options.zIndex?this.options.zIndex:t-1,0>t&&(t=1),this.shim=new Element("iframe",{src:this.options.src,scrolling:"no",frameborder:0,styles:{zIndex:t,position:"absolute",border:"none",filter:"progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)"},"class":this.options.className}).store("IframeShim",this);var i=function(){this.shim.inject(this.element,"after"),this[this.options.display?"show":"hide"](),this.fireEvent("inject")}.bind(this);IframeShim.ready?i():window.addEvent("load",i)}else this.position=this.hide=this.show=this.dispose=Function.from(this)},position:function(){if(!IframeShim.ready||!this.shim)return this;var t=this.element.measure(function(){return this.getSize()});return void 0!=this.options.margin&&(t.x=t.x-2*this.options.margin,t.y=t.y-2*this.options.margin,this.options.offset.x+=this.options.margin,this.options.offset.y+=this.options.margin),this.shim.set({width:t.x,height:t.y}).position({relativeTo:this.element,offset:this.options.offset}),this},hide:function(){return this.shim&&this.shim.setStyle("display","none"),this},show:function(){return this.shim&&this.shim.setStyle("display","block"),this.position()},dispose:function(){return this.shim&&this.shim.dispose(),this},destroy:function(){return this.shim&&this.shim.destroy(),this}})}(),window.addEvent("load",function(){IframeShim.ready=!0});var Mask=new Class({Implements:[Options,Events],Binds:["position"],options:{style:{},"class":"mask",maskMargins:!1,useIframeShim:!0,iframeShimOptions:{}},initialize:function(t,e){this.target=document.id(t)||document.id(document.body),this.target.store("mask",this),this.setOptions(e),this.render(),this.inject()},render:function(){this.element=new Element("div",{"class":this.options["class"],id:this.options.id||"mask-"+String.uniqueID(),styles:Object.merge({},this.options.style,{display:"none"}),events:{click:function(t){this.fireEvent("click",t),this.options.hideOnClick&&this.hide()}.bind(this)}}),this.hidden=!0},toElement:function(){return this.element},inject:function(t,e){e=e||(this.options.inject?this.options.inject.where:"")||(this.target==document.body?"inside":"after"),t=t||this.options.inject&&this.options.inject.target||this.target,this.element.inject(t,e),this.options.useIframeShim&&(this.shim=new IframeShim(this.element,this.options.iframeShimOptions),this.addEvents({show:this.shim.show.bind(this.shim),hide:this.shim.hide.bind(this.shim),destroy:this.shim.destroy.bind(this.shim)}))},position:function(){return this.resize(this.options.width,this.options.height),this.element.position({relativeTo:this.target,position:"topLeft",ignoreMargins:!this.options.maskMargins,ignoreScroll:this.target==document.body}),this},resize:function(t,e){var i={styles:["padding","border"]};this.options.maskMargins&&i.styles.push("margin");var n=this.target.getComputedSize(i);if(this.target==document.body){this.element.setStyles({width:0,height:0});var s=window.getScrollSize();n.totalHeighti?"":e.substr(0,i),s=e.substr(i+1);return t?t.call(null,n,s):s||0===s}).join("&")}}),window.Form||(window.Form={}),function(){Form.Request=new Class({Binds:["onSubmit","onFormValidate"],Implements:[Options,Events,Class.Occlude],options:{requestOptions:{evalScripts:!0,useSpinner:!0,emulation:!1,link:"ignore"},sendButtonClicked:!0,extraData:{},resetForm:!0},property:"form.request",initialize:function(t,e,i){return this.element=document.id(t),this.occlude()?this.occluded:void this.setOptions(i).setTarget(e).attach()},setTarget:function(t){return this.target=document.id(t),this.request?this.request.setOptions({update:this.target}):this.makeRequest(),this},toElement:function(){return this.element},makeRequest:function(){var t=this;return this.request=new Request.HTML(Object.merge({update:this.target,emulation:!1,spinnerTarget:this.element,method:this.element.get("method")||"post"},this.options.requestOptions)).addEvents({success:function(e,i,n,s){["complete","success"].each(function(r){t.fireEvent(r,[t.target,e,i,n,s])})},failure:function(){t.fireEvent("complete",arguments).fireEvent("failure",arguments)},exception:function(){t.fireEvent("failure",arguments)}}),this.attachReset()},attachReset:function(){return this.options.resetForm?(this.request.addEvent("success",function(){Function.attempt(function(){this.element.reset()}.bind(this)),window.OverText&&OverText.update()}.bind(this)),this):this},attach:function(t){var e=0!=t?"addEvent":"removeEvent";this.element[e]("click:relay(button, input[type=submit])",this.saveClickedButton.bind(this));var i=this.element.retrieve("validator");return i?i[e]("onFormValidate",this.onFormValidate):this.element[e]("submit",this.onSubmit),this},detach:function(){return this.attach(!1)},enable:function(){return this.attach()},disable:function(){return this.detach()},onFormValidate:function(t,e,i){if(i){var n=this.element.retrieve("validator");(t||n&&!n.options.stopOnFailure)&&(i.stop(),this.send())}},onSubmit:function(t){var e=this.element.retrieve("validator");return e?(this.element.removeEvent("submit",this.onSubmit),e.addEvent("onFormValidate",this.onFormValidate),void e.validate(t)):(t&&t.stop(),void this.send())},saveClickedButton:function(t,e){var i=e.get("name");i&&this.options.sendButtonClicked&&(this.options.extraData[i]=e.get("value")||!0,this.clickedCleaner=function(){delete this.options.extraData[i],this.clickedCleaner=function(){}}.bind(this))},clickedCleaner:function(){},send:function(){var t=this.element.toQueryString().trim(),e=Object.toQueryString(this.options.extraData);return t?t+="&"+e:t=e,this.fireEvent("send",[this.element,t.parseQueryString()]),this.request.send({data:t,url:this.options.requestOptions.url||this.element.get("action")}),this.clickedCleaner(),this}}),Element.implement("formUpdate",function(t,e){var i=this.retrieve("form.request");return i?(t&&i.setTarget(t),e&&i.setOptions(e).makeRequest()):i=new Form.Request(this,t,e),i.send(),this})}(),Element.implement({isDisplayed:function(){return"none"!=this.getStyle("display")},isVisible:function(){var t=this.offsetWidth,e=this.offsetHeight;return 0==t&&0==e?!1:t>0&&e>0?!0:"none"!=this.style.display},toggle:function(){return this[this.isDisplayed()?"hide":"show"]()},hide:function(){var t;try{t=this.getStyle("display")}catch(e){}return"none"==t?this:this.store("element:_originalDisplay",t||"").setStyle("display","none")},show:function(t){return!t&&this.isDisplayed()?this:(t=t||this.retrieve("element:_originalDisplay")||"block",this.setStyle("display","none"==t?"block":t))},swapClass:function(t,e){return this.removeClass(t).addClass(e)}}),Document.implement({clearSelection:function(){if(window.getSelection){var t=window.getSelection();t&&t.removeAllRanges&&t.removeAllRanges()}else if(document.selection&&document.selection.empty)try{document.selection.empty()}catch(e){}}}),function(){var t=function(t){var e=t.options.hideInputs;if(window.OverText){var i=[null];OverText.each(function(t){i.include("."+t.options.labelClass)}),i&&(e+=i.join(", "))}return e?t.element.getElements(e):null};Fx.Reveal=new Class({Extends:Fx.Morph,options:{link:"cancel",styles:["padding","border","margin"],transitionOpacity:"opacity"in document.documentElement,mode:"vertical",display:function(){return"tr"!=this.element.get("tag")?"block":"table-row"},opacity:1,hideInputs:"opacity"in document.documentElement?null:"select, input, textarea, object, embed"},dissolve:function(){if(this.hiding||this.showing)"chain"==this.options.link?this.chain(this.dissolve.bind(this)):"cancel"!=this.options.link||this.hiding||(this.cancel(),this.dissolve());else if("none"!=this.element.getStyle("display")){this.hiding=!0,this.showing=!1,this.hidden=!0,this.cssText=this.element.style.cssText;var e=this.element.getComputedSize({styles:this.options.styles,mode:this.options.mode});this.options.transitionOpacity&&(e.opacity=this.options.opacity);var i={};Object.each(e,function(t,e){i[e]=[t,0]}),this.element.setStyles({display:Function.from(this.options.display).call(this),overflow:"hidden"});var n=t(this);n&&n.setStyle("visibility","hidden"),this.$chain.unshift(function(){this.hidden&&(this.hiding=!1,this.element.style.cssText=this.cssText,this.element.setStyle("display","none"),n&&n.setStyle("visibility","visible")),this.fireEvent("hide",this.element),this.callChain()}.bind(this)),this.start(i)}else this.callChain.delay(10,this),this.fireEvent("complete",this.element),this.fireEvent("hide",this.element);return this},reveal:function(){if(this.showing||this.hiding)"chain"==this.options.link?this.chain(this.reveal.bind(this)):"cancel"!=this.options.link||this.showing||(this.cancel(),this.reveal());else if("none"==this.element.getStyle("display")){this.hiding=!1,this.showing=!0,this.hidden=!1,this.cssText=this.element.style.cssText;var e;this.element.measure(function(){e=this.element.getComputedSize({styles:this.options.styles,mode:this.options.mode})}.bind(this)),null!=this.options.heightOverride&&(e.height=this.options.heightOverride.toInt()),null!=this.options.widthOverride&&(e.width=this.options.widthOverride.toInt()),this.options.transitionOpacity&&(this.element.setStyle("opacity",0),e.opacity=this.options.opacity);var i={height:0,display:Function.from(this.options.display).call(this)};Object.each(e,function(t,e){i[e]=0}),i.overflow="hidden",this.element.setStyles(i);var n=t(this);n&&n.setStyle("visibility","hidden"),this.$chain.unshift(function(){this.element.style.cssText=this.cssText,this.element.setStyle("display",Function.from(this.options.display).call(this)),this.hidden||(this.showing=!1),n&&n.setStyle("visibility","visible"),this.callChain(),this.fireEvent("show",this.element)}.bind(this)),this.start(e)}else this.callChain(),this.fireEvent("complete",this.element),this.fireEvent("show",this.element);return this},toggle:function(){return"none"==this.element.getStyle("display")?this.reveal():this.dissolve(),this},cancel:function(){return this.parent.apply(this,arguments),null!=this.cssText&&(this.element.style.cssText=this.cssText),this.hiding=!1,this.showing=!1,this}}),Element.Properties.reveal={set:function(t){return this.get("reveal").cancel().setOptions(t),this},get:function(){var t=this.retrieve("reveal");return t||(t=new Fx.Reveal(this),this.store("reveal",t)),t}},Element.Properties.dissolve=Element.Properties.reveal,Element.implement({reveal:function(t){return this.get("reveal").setOptions(t).reveal(),this},dissolve:function(t){return this.get("reveal").setOptions(t).dissolve(),this},nix:function(t){var e=Array.link(arguments,{destroy:Type.isBoolean,options:Type.isObject});return this.get("reveal").setOptions(t).dissolve().chain(function(){this[e.destroy?"destroy":"dispose"]()}.bind(this)),this},wink:function(){var t=Array.link(arguments,{duration:Type.isNumber,options:Type.isObject}),e=this.get("reveal").setOptions(t.options);e.reveal().chain(function(){(function(){e.dissolve()}).delay(t.duration||2e3)})}})}(),function(){var t=function(t){return null!=t},e=Object.prototype.hasOwnProperty;Object.extend({getFromPath:function(t,i){"string"==typeof i&&(i=i.split("."));for(var n=0,s=i.length;s>n;n++){if(!e.call(t,i[n]))return null;t=t[i[n]]}return t},cleanValues:function(e,i){i=i||t;for(var n in e)i(e[n])||delete e[n];return e},erase:function(t,i){return e.call(t,i)&&delete t[i],t},run:function(t){var e=Array.slice(arguments,1);for(var i in t)t[i].apply&&t[i].apply(t,e);return t}})}(),function(){var t=null,e={},i=function(t){return instanceOf(t,n.Set)?t:e[t]},n=this.Locale={define:function(i,s,r,o){var a;return instanceOf(i,n.Set)?(a=i.name,a&&(e[a]=i)):(a=i,e[a]||(e[a]=new n.Set(a)),i=e[a]),s&&i.define(s,r,o),t||(t=i),i},use:function(e){return e=i(e),e&&(t=e,this.fireEvent("change",e)),this},getCurrent:function(){return t},get:function(e,i){return t?t.get(e,i):""},inherit:function(t,e,n){return t=i(t),t&&t.inherit(e,n),this},list:function(){return Object.keys(e)}};Object.append(n,new Events),n.Set=new Class({sets:{},inherits:{locales:[],sets:{}},initialize:function(t){this.name=t||""},define:function(t,e,i){var n=this.sets[t];return n||(n={}),e&&("object"==typeOf(e)?n=Object.merge(n,e):n[e]=i),this.sets[t]=n,this},get:function(t,i,n){var s=Object.getFromPath(this.sets,t);if(null!=s){var r=typeOf(s);return"function"==r?s=s.apply(null,Array.from(i)):"object"==r&&(s=Object.clone(s)),s}var o=t.indexOf("."),a=0>o?t:t.substr(0,o),h=(this.inherits.sets[a]||[]).combine(this.inherits.locales).include("en-US");n||(n=[]);for(var l=0,u=h.length;u>l;l++)if(!n.contains(h[l])){n.include(h[l]);var c=e[h[l]];if(c&&(s=c.get(t,i,n),null!=s))return s}return""},inherit:function(t,e){t=Array.from(t),e&&!this.inherits.sets[e]&&(this.inherits.sets[e]=[]);for(var i=t.length;i--;)(e?this.inherits.sets[e]:this.inherits.locales).unshift(t[i]);return this}})}(),Locale.define("en-US","Date",{months:["January","February","March","April","May","June","July","August","September","October","November","December"],months_abbr:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],days_abbr:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dateOrder:["month","date","year"],shortDate:"%m/%d/%Y",shortTime:"%I:%M%p",AM:"AM",PM:"PM",firstDayOfWeek:0,ordinal:function(t){return t>3&&21>t?"th":["th","st","nd","rd","th"][Math.min(t%10,4)]},lessThanMinuteAgo:"less than a minute ago",minuteAgo:"about a minute ago",minutesAgo:"{delta} minutes ago",hourAgo:"about an hour ago",hoursAgo:"about {delta} hours ago",dayAgo:"1 day ago",daysAgo:"{delta} days ago",weekAgo:"1 week ago",weeksAgo:"{delta} weeks ago",monthAgo:"1 month ago",monthsAgo:"{delta} months ago",yearAgo:"1 year ago",yearsAgo:"{delta} years ago",lessThanMinuteUntil:"less than a minute from now",minuteUntil:"about a minute from now",minutesUntil:"{delta} minutes from now",hourUntil:"about an hour from now",hoursUntil:"about {delta} hours from now",dayUntil:"1 day from now",daysUntil:"{delta} days from now",weekUntil:"1 week from now",weeksUntil:"{delta} weeks from now",monthUntil:"1 month from now",monthsUntil:"{delta} months from now",yearUntil:"1 year from now",yearsUntil:"{delta} years from now"}),function(){var t=this.Date,e=t.Methods={ms:"Milliseconds",year:"FullYear",min:"Minutes",mo:"Month",sec:"Seconds",hr:"Hours"};["Date","Day","FullYear","Hours","Milliseconds","Minutes","Month","Seconds","Time","TimezoneOffset","Week","Timezone","GMTOffset","DayOfYear","LastMonth","LastDayOfMonth","UTCDate","UTCDay","UTCFullYear","AMPM","Ordinal","UTCHours","UTCMilliseconds","UTCMinutes","UTCMonth","UTCSeconds","UTCMilliseconds"].each(function(e){t.Methods[e.toLowerCase()]=e});var i=function(t,e,n){return 1==e?t:t28)return 1;0==o&&-2>a&&(n=new t(n).decrement("day",s),s=0),i=new t(n.get("year"),0,1).get("day")||7,i>4&&(r=-7)}else i=new t(n.get("year"),0,1).get("day");return r+=n.get("dayofyear"),r+=6-s,r+=(7+i-e)%7,r/7},getOrdinal:function(e){return t.getMsg("ordinal",e||this.get("date"))},getTimezone:function(){return this.toString().replace(/^.*? ([A-Z]{3}).[0-9]{4}.*$/,"$1").replace(/^.*?\(([A-Z])[a-z]+ ([A-Z])[a-z]+ ([A-Z])[a-z]+\)$/,"$1$2$3")},getGMTOffset:function(){var t=this.get("timezoneOffset");return(t>0?"-":"+")+i((t.abs()/60).floor(),2)+i(t%60,2)},setAMPM:function(t){t=t.toUpperCase();var e=this.get("hr");return e>11&&"AM"==t?this.decrement("hour",12):12>e&&"PM"==t?this.increment("hour",12):this},getAMPM:function(){return this.get("hr")<12?"AM":"PM"},parse:function(e){return this.set("time",t.parse(e)),this},isValid:function(t){return t||(t=this),"date"==typeOf(t)&&!isNaN(t.valueOf())},format:function(e){if(!this.isValid())return"invalid date";if(e||(e="%x %X"),"string"==typeof e&&(e=r[e.toLowerCase()]||e),"function"==typeof e)return e(this);var n=this;return e.replace(/%([a-z%])/gi,function(e,s){switch(s){case"a":return t.getMsg("days_abbr")[n.get("day")];case"A":return t.getMsg("days")[n.get("day")];case"b":return t.getMsg("months_abbr")[n.get("month")];case"B":return t.getMsg("months")[n.get("month")];case"c":return n.format("%a %b %d %H:%M:%S %Y");case"d":return i(n.get("date"),2);case"e":return i(n.get("date"),2," ");case"H":return i(n.get("hr"),2);case"I":return i(n.get("hr")%12||12,2);case"j":return i(n.get("dayofyear"),3);case"k":return i(n.get("hr"),2," ");case"l":return i(n.get("hr")%12||12,2," ");case"L":return i(n.get("ms"),3);case"m":return i(n.get("mo")+1,2);case"M":return i(n.get("min"),2);case"o":return n.get("ordinal");case"p":return t.getMsg(n.get("ampm"));case"s":return Math.round(n/1e3);case"S":return i(n.get("seconds"),2);case"T":return n.format("%H:%M:%S");case"U":return i(n.get("week"),2);case"w":return n.get("day");case"x":return n.format(t.getMsg("shortDate"));case"X":return n.format(t.getMsg("shortTime"));case"y":return n.get("year").toString().substr(2);case"Y":return n.get("year");case"z":return n.get("GMTOffset");case"Z":return n.get("Timezone")}return s})},toISOString:function(){return this.format("iso8601")}}).alias({toJSON:"toISOString",compare:"diff",strftime:"format"});var n=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],s=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],r={db:"%Y-%m-%d %H:%M:%S",compact:"%Y%m%dT%H%M%S","short":"%d %b %H:%M","long":"%B %d, %Y %H:%M",rfc822:function(t){return n[t.get("day")]+t.format(", %d ")+s[t.get("month")]+t.format(" %Y %H:%M:%S %Z")},rfc2822:function(t){return n[t.get("day")]+t.format(", %d ")+s[t.get("month")]+t.format(" %Y %H:%M:%S %z")},iso8601:function(t){return t.getUTCFullYear()+"-"+i(t.getUTCMonth()+1,2)+"-"+i(t.getUTCDate(),2)+"T"+i(t.getUTCHours(),2)+":"+i(t.getUTCMinutes(),2)+":"+i(t.getUTCSeconds(),2)+"."+i(t.getUTCMilliseconds(),3)+"Z"}},o=[],a=t.parse,h=function(e,i,n){var s=-1,r=t.getMsg(e+"s");switch(typeOf(i)){case"object":s=r[i.get(e)];break;case"number":if(s=r[i],!s)throw new Error("Invalid "+e+" index: "+i);break;case"string":var o=r.filter(function(t){return this.test(t)},new RegExp("^"+i,"i"));if(!o.length)throw new Error("Invalid "+e+" string");if(o.length>1)throw new Error("Ambiguous "+e);s=o[0]}return n?r.indexOf(s):s},l=1900,u=70;t.extend({getMsg:function(t,e){return Locale.get("Date."+t,e)},units:{ms:Function.from(1),second:Function.from(1e3),minute:Function.from(6e4),hour:Function.from(36e5),day:Function.from(864e5),week:Function.from(6084e5),month:function(e,i){var n=new t;return 864e5*t.daysInMonth(null!=e?e:n.get("mo"),null!=i?i:n.get("year"))},year:function(e){return e=e||(new t).get("year"),t.isLeapYear(e)?316224e5:31536e6}},daysInMonth:function(e,i){return[31,t.isLeapYear(i)?29:28,31,30,31,30,31,31,30,31,30,31][e]},isLeapYear:function(t){return t%4===0&&t%100!==0||t%400===0},parse:function(e){var i=typeOf(e);if("number"==i)return new t(e);if("string"!=i)return e;if(e=e.clean(),!e.length)return null;var n;return o.some(function(t){var i=t.re.exec(e);return i?n=t.handler(i):!1}),n&&n.isValid()||(n=new t(a(e)),n&&n.isValid()||(n=new t(e.toInt()))),n},parseDay:function(t,e){return h("day",t,e)},parseMonth:function(t,e){return h("month",t,e)},parseUTC:function(e){var i=new t(e),n=t.UTC(i.get("year"),i.get("mo"),i.get("date"),i.get("hr"),i.get("min"),i.get("sec"),i.get("ms"));return new t(n)},orderIndex:function(e){return t.getMsg("dateOrder").indexOf(e)+1},defineFormat:function(t,e){return r[t]=e,this},defineParser:function(t){return o.push(t.re&&t.handler?t:g(t)),this},defineParsers:function(){return Array.flatten(arguments).each(t.defineParser),this},define2DigitYearStart:function(t){return u=t%100,l=t-u,this}}).extend({defineFormats:t.defineFormat.overloadSetter()});var c=function(e){return new RegExp("(?:"+t.getMsg(e).map(function(t){return t.substr(0,3)}).join("|")+")[a-z]*")},d=function(e){switch(e){case"T":return"%H:%M:%S";case"x":return(1==t.orderIndex("month")?"%m[-./]%d":"%d[-./]%m")+"([-./]%y)?";case"X":return"%H([.:]%M)?([.:]%S([.:]%s)?)? ?%p? ?%z?"}return null},m={d:/[0-2]?[0-9]|3[01]/,H:/[01]?[0-9]|2[0-3]/,I:/0?[1-9]|1[0-2]/,M:/[0-5]?\d/,s:/\d+/,o:/[a-z]*/,p:/[ap]\.?m\.?/,y:/\d{2}|\d{4}/,Y:/\d{4}/,z:/Z|[+-]\d{2}(?::?\d{2})?/};m.m=m.I,m.S=m.M;var f,p=function(t){f=t,m.a=m.A=c("days"),m.b=m.B=c("months"),o.each(function(t,e){t.format&&(o[e]=g(t.format))})},g=function(e){if(!f)return{format:e};var i=[],n=(e.source||e).replace(/%([a-z])/gi,function(t,e){return d(e)||t}).replace(/\((?!\?)/g,"(?:").replace(/ (?!\?|\*)/g,",? ").replace(/%([a-z%])/gi,function(t,e){var n=m[e];return n?(i.push(e),"("+n.source+")"):e}).replace(/\[a-z\]/gi,"[a-z\\u00c0-\\uffff;&]");return{format:e,re:new RegExp("^"+n+"$","i"),handler:function(e){e=e.slice(1).associate(i);var n=(new t).clearTime(),s=e.y||e.Y;null!=s&&v.call(n,"y",s),"d"in e&&v.call(n,"d",1),("m"in e||e.b||e.B)&&v.call(n,"m",1);for(var r in e)v.call(n,r,e[r]);return n}}},v=function(e,i){if(!i)return this;switch(e){case"a":case"A":return this.set("day",t.parseDay(i,!0));case"b":case"B":return this.set("mo",t.parseMonth(i,!0));case"d":return this.set("date",i);case"H":case"I":return this.set("hr",i);case"m":return this.set("mo",i-1);case"M":return this.set("min",i);case"p":return this.set("ampm",i.replace(/\./g,""));case"S":return this.set("sec",i);case"s":return this.set("ms",1e3*("0."+i));case"w":return this.set("day",i);case"Y":return this.set("year",i);case"y":return i=+i,100>i&&(i+=l+(u>i?100:0)),this.set("year",i);case"z":"Z"==i&&(i="+00");var n=i.match(/([+-])(\d{2}):?(\d{2})?/);return n=(n[1]+"1")*(60*n[2]+(+n[3]||0))+this.getTimezoneOffset(),this.set("time",this-6e4*n)}return this};t.defineParsers("%Y([-./]%m([-./]%d((T| )%X)?)?)?","%Y%m%d(T%H(%M%S?)?)?","%x( %X)?","%d%o( %b( %Y)?)?( %X)?","%b( %d%o)?( %Y)?( %X)?","%Y %b( %d%o( %X)?)?","%o %b %d %X %z %Y","%T","%H:%M( ?%p)?"),Locale.addEvent("change",function(t){Locale.get("Date")&&p(t)}).fireEvent("change",Locale.getCurrent())}(),function(){var t={a:/[àáâãäåăą]/g,A:/[ÀÁÂÃÄÅĂĄ]/g,c:/[ćčç]/g,C:/[ĆČÇ]/g,d:/[ďđ]/g,D:/[ĎÐ]/g,e:/[èéêëěę]/g,E:/[ÈÉÊËĚĘ]/g,g:/[ğ]/g,G:/[Ğ]/g,i:/[ìíîï]/g,I:/[ÌÍÎÏ]/g,l:/[ĺľł]/g,L:/[ĹĽŁ]/g,n:/[ñňń]/g,N:/[ÑŇŃ]/g,o:/[òóôõöøő]/g,O:/[ÒÓÔÕÖØ]/g,r:/[řŕ]/g,R:/[ŘŔ]/g,s:/[ššş]/g,S:/[ŠŞŚ]/g,t:/[ťţ]/g,T:/[ŤŢ]/g,u:/[ùúûůüµ]/g,U:/[ÙÚÛŮÜ]/g,y:/[ÿý]/g,Y:/[ŸÝ]/g,z:/[žźż]/g,Z:/[ŽŹŻ]/g,th:/[þ]/g,TH:/[Þ]/g,dh:/[ð]/g,DH:/[Ð]/g,ss:/[ß]/g,oe:/[œ]/g,OE:/[Œ]/g,ae:/[æ]/g,AE:/[Æ]/g},e={" ":/[\xa0\u2002\u2003\u2009]/g,"*":/[\xb7]/g,"'":/[\u2018\u2019]/g,'"':/[\u201c\u201d]/g,"...":/[\u2026]/g,"-":/[\u2013]/g,"»":/[\uFFFD]/g},i={ms:1,s:1e3,m:6e4,h:36e5},n=/(\d*.?\d+)([msh]+)/,s=function(t,e){var i,n=t;for(i in e)n=n.replace(e[i],i);return n},r=function(t,e){t=t||"";var i=e?"<"+t+"(?!\\w)[^>]*>([\\s\\S]*?)":"]+)?>",n=new RegExp(i,"gi");return n};String.implement({standardize:function(){return s(this,t)},repeat:function(t){return new Array(t+1).join(this)},pad:function(t,e,i){if(this.length>=t)return this;var n=(null==e?" ":""+e).repeat(t-this.length).substr(0,t-this.length);return i&&"right"!=i?"left"==i?n+this:n.substr(0,(n.length/2).floor())+this+n.substr(0,(n.length/2).ceil()):this+n},getTags:function(t,e){return this.match(r(t,e))||[]},stripTags:function(t,e){return this.replace(r(t,e),"")},tidy:function(){return s(this,e)},truncate:function(t,e,i){var n=this;if(null==e&&1==arguments.length&&(e="…"),n.length>t){if(n=n.substring(0,t),i){var s=n.lastIndexOf(i);-1!=s&&(n=n.substr(0,s))}e&&(n+=e)}return n},ms:function(){var t=n.exec(this);return null==t?Number(this):Number(t[1])*i[t[2]]}})}(),Element.implement({tidy:function(){this.set("value",this.get("value").tidy())},getTextInRange:function(t,e){return this.get("value").substring(t,e)},getSelectedText:function(){return this.setSelectionRange?this.getTextInRange(this.getSelectionStart(),this.getSelectionEnd()):document.selection.createRange().text},getSelectedRange:function(){if(null!=this.selectionStart)return{start:this.selectionStart,end:this.selectionEnd};var t={start:0,end:0},e=this.getDocument().selection.createRange();if(!e||e.parentElement()!=this)return t;var i=e.duplicate();if("text"==this.type)t.start=0-i.moveStart("character",-1e5),t.end=t.start+e.text.length;else{var n=this.get("value"),s=n.length;i.moveToElementText(this),i.setEndPoint("StartToEnd",e),i.text.length&&(s-=n.match(/[\n\r]*$/)[0].length),t.end=s-i.text.length,i.setEndPoint("StartToStart",e),t.start=s-i.text.length}return t},getSelectionStart:function(){return this.getSelectedRange().start},getSelectionEnd:function(){return this.getSelectedRange().end},setCaretPosition:function(t){return"end"==t&&(t=this.get("value").length),this.selectRange(t,t),this},getCaretPosition:function(){return this.getSelectedRange().start},selectRange:function(t,e){if(this.setSelectionRange)this.focus(),this.setSelectionRange(t,e);else{var i=this.get("value"),n=i.substr(t,e-t).replace(/\r/g,"").length;t=i.substr(0,t).replace(/\r/g,"").length;var s=this.createTextRange();s.collapse(!0),s.moveEnd("character",t+n),s.moveStart("character",t),s.select()}return this},insertAtCursor:function(t,e){var i=this.getSelectedRange(),n=this.get("value");return this.set("value",n.substring(0,i.start)+t+n.substring(i.end,n.length)),e!==!1?this.selectRange(i.start,i.start+t.length):this.setCaretPosition(i.start+t.length),this},insertAroundCursor:function(t,e){t=Object.append({before:"",defaultMiddle:"",after:""},t);var i=this.getSelectedText()||t.defaultMiddle,n=this.getSelectedRange(),s=this.get("value");if(n.start==n.end)this.set("value",s.substring(0,n.start)+t.before+i+t.after+s.substring(n.end,s.length)),this.selectRange(n.start+t.before.length,n.end+t.before.length+i.length);else{var r=s.substring(n.start,n.end);this.set("value",s.substring(0,n.start)+t.before+r+t.after+s.substring(n.end,s.length));var o=n.start+t.before.length;e!==!1?this.selectRange(o,o+r.length):this.setCaretPosition(o+s.length)}return this}}),Locale.define("en-US","FormValidator",{required:"This field is required.",length:"Please enter {length} characters (you entered {elLength} characters)",minLength:"Please enter at least {minLength} characters (you entered {length} characters).",maxLength:"Please enter no more than {maxLength} characters (you entered {length} characters).",integer:"Please enter an integer in this field. Numbers with decimals (e.g. 1.25) are not permitted.",numeric:'Please enter only numeric values in this field (i.e. "1" or "1.1" or "-1" or "-1.1").',digits:"Please use numbers and punctuation only in this field (for example, a phone number with dashes or dots is permitted).",alpha:"Please use only letters (a-z) within this field. No spaces or other characters are allowed.",alphanum:"Please use only letters (a-z) or numbers (0-9) in this field. No spaces or other characters are allowed.",dateSuchAs:"Please enter a valid date such as {date}",dateInFormatMDY:'Please enter a valid date such as MM/DD/YYYY (i.e. "12/31/1999")',email:'Please enter a valid email address. For example "fred@domain.com".',url:"Please enter a valid URL such as http://www.example.com.",currencyDollar:"Please enter a valid $ amount. For example $100.00 .",oneRequired:"Please enter something for at least one of these inputs.",errorPrefix:"Error: ",warningPrefix:"Warning: ",noSpace:"There can be no spaces in this input.",reqChkByNode:"No items are selected.",requiredChk:"This field is required.",reqChkByName:"Please select a {label}.",match:"This field needs to match the {matchName} field",startDate:"the start date",endDate:"the end date",currentDate:"the current date",afterDate:"The date should be the same or after {label}.",beforeDate:"The date should be the same or before {label}.",startMonth:"Please select a start month",sameMonth:"These two dates must be in the same month - you must change one or the other.",creditcard:"The credit card number entered is invalid. Please check the number and try again. {length} digits entered."}),window.Form||(window.Form={});var InputValidator=this.InputValidator=new Class({Implements:[Options],options:{errorMsg:"Validation failed.",test:Function.from(!0)},initialize:function(t,e){this.setOptions(e),this.className=t},test:function(t,e){return t=document.id(t),t?this.options.test(t,e||this.getProps(t)):!1},getError:function(t,e){t=document.id(t);var i=this.options.errorMsg;return"function"==typeOf(i)&&(i=i(t,e||this.getProps(t))),i},getProps:function(t){return t=document.id(t),t?t.get("validatorProps"):{}}});Element.Properties.validators={get:function(){return(this.get("data-validators")||this.className).clean().split(" ")}},Element.Properties.validatorProps={set:function(t){return this.eliminate("$moo:validatorProps").store("$moo:validatorProps",t)},get:function(t){if(t&&this.set(t),this.retrieve("$moo:validatorProps"))return this.retrieve("$moo:validatorProps");if(this.getProperty("data-validator-properties")||this.getProperty("validatorProps"))try{this.store("$moo:validatorProps",JSON.decode(this.getProperty("validatorProps")||this.getProperty("data-validator-properties"),!1))}catch(e){return{}}else{var i=this.get("validators").filter(function(t){return t.test(":")});i.length?(t={},i.each(function(e){var i=e.split(":");if(i[1])try{t[i[0]]=JSON.decode(i[1],!1)}catch(n){}}),this.store("$moo:validatorProps",t)):this.store("$moo:validatorProps",{})}return this.retrieve("$moo:validatorProps")}},Form.Validator=new Class({Implements:[Options,Events],options:{fieldSelectors:"input, select, textarea",ignoreHidden:!0,ignoreDisabled:!0,useTitles:!1,evaluateOnSubmit:!0,evaluateFieldsOnBlur:!0,evaluateFieldsOnChange:!0,serial:!0,stopOnFailure:!0,warningPrefix:function(){return Form.Validator.getMsg("warningPrefix")||"Warning: "},errorPrefix:function(){return Form.Validator.getMsg("errorPrefix")||"Error: "}},initialize:function(t,e){this.setOptions(e),this.element=document.id(t),this.warningPrefix=Function.from(this.options.warningPrefix)(),this.errorPrefix=Function.from(this.options.errorPrefix)(),this._bound={onSubmit:this.onSubmit.bind(this),blurOrChange:function(t,e){this.validationMonitor(e,!0)}.bind(this)},this.enable()},toElement:function(){return this.element},getFields:function(){return this.fields=this.element.getElements(this.options.fieldSelectors) +},enable:function(){this.element.store("validator",this),this.options.evaluateOnSubmit&&this.element.addEvent("submit",this._bound.onSubmit),this.options.evaluateFieldsOnBlur&&this.element.addEvent("blur:relay(input,select,textarea)",this._bound.blurOrChange),this.options.evaluateFieldsOnChange&&this.element.addEvent("change:relay(input,select,textarea)",this._bound.blurOrChange)},disable:function(){this.element.eliminate("validator"),this.element.removeEvents({submit:this._bound.onSubmit,"blur:relay(input,select,textarea)":this._bound.blurOrChange,"change:relay(input,select,textarea)":this._bound.blurOrChange})},validationMonitor:function(){clearTimeout(this.timer),this.timer=this.validateField.delay(50,this,arguments)},onSubmit:function(t){this.validate(t)&&this.reset()},reset:function(){return this.getFields().each(this.resetField,this),this},validate:function(t){var e=this.getFields().map(function(t){return this.validateField(t,!0)},this).every(function(t){return t});return this.fireEvent("formValidate",[e,this.element,t]),this.options.stopOnFailure&&!e&&t&&t.preventDefault(),e},validateField:function(t,e){if(this.paused)return!0;t=document.id(t);var i,n,s=!t.hasClass("validation-failed");if(this.options.serial&&!e&&(i=this.element.getElement(".validation-failed"),n=this.element.getElement(".warning")),t&&(!i||e||t.hasClass("validation-failed")||i&&!this.options.serial)){var r=t.get("validators"),o=r.some(function(t){return this.getValidator(t)},this),a=[];if(r.each(function(e){e&&!this.test(e,t)&&a.include(e)},this),s=0===a.length,o&&!this.hasValidator(t,"warnOnly")&&(s?(t.addClass("validation-passed").removeClass("validation-failed"),this.fireEvent("elementPass",[t])):(t.addClass("validation-failed").removeClass("validation-passed"),this.fireEvent("elementFail",[t,a]))),!n){{r.some(function(t){return t.test("^warn")?this.getValidator(t.replace(/^warn-/,"")):null},this)}t.removeClass("warning");{r.map(function(e){return e.test("^warn")?this.test(e.replace(/^warn-/,""),t,!0):null},this)}}}return s},test:function(t,e,i){if(e=document.id(e),this.options.ignoreHidden&&!e.isVisible()||this.options.ignoreDisabled&&e.get("disabled"))return!0;var n=this.getValidator(t);null!=i&&(i=!1),this.hasValidator(e,"warnOnly")&&(i=!0);var s=e.hasClass("ignoreValidation")||(n?n.test(e):!0);return n&&this.fireEvent("elementValidate",[s,e,t,i]),i?!0:s},hasValidator:function(t,e){return t.get("validators").contains(e)},resetField:function(t){return t=document.id(t),t&&t.get("validators").each(function(e){e.test("^warn-")&&(e=e.replace(/^warn-/,"")),t.removeClass("validation-failed"),t.removeClass("warning"),t.removeClass("validation-passed")},this),this},stop:function(){return this.paused=!0,this},start:function(){return this.paused=!1,this},ignoreField:function(t,e){return t=document.id(t),t&&(this.enforceField(t),t.addClass(e?"warnOnly":"ignoreValidation")),this},enforceField:function(t){return t=document.id(t),t&&t.removeClass("warnOnly").removeClass("ignoreValidation"),this}}),Form.Validator.getMsg=function(t){return Locale.get("FormValidator."+t)},Form.Validator.adders={validators:{},add:function(t,e){this.validators[t]=new InputValidator(t,e),this.initialize||this.implement({validators:this.validators})},addAllThese:function(t){Array.from(t).each(function(t){this.add(t[0],t[1])},this)},getValidator:function(t){return this.validators[t.split(":")[0]]}},Object.append(Form.Validator,Form.Validator.adders),Form.Validator.implement(Form.Validator.adders),Form.Validator.add("IsEmpty",{errorMsg:!1,test:function(t){return"select-one"==t.type||"select"==t.type?!(t.selectedIndex>=0&&""!=t.options[t.selectedIndex].value):null==t.get("value")||0==t.get("value").length}}),Form.Validator.addAllThese([["required",{errorMsg:function(){return Form.Validator.getMsg("required")},test:function(t){return!Form.Validator.getValidator("IsEmpty").test(t)}}],["length",{errorMsg:function(t,e){return"null"!=typeOf(e.length)?Form.Validator.getMsg("length").substitute({length:e.length,elLength:t.get("value").length}):""},test:function(t,e){return"null"!=typeOf(e.length)?t.get("value").length==e.length||0==t.get("value").length:!0}}],["minLength",{errorMsg:function(t,e){return"null"!=typeOf(e.minLength)?Form.Validator.getMsg("minLength").substitute({minLength:e.minLength,length:t.get("value").length}):""},test:function(t,e){return"null"!=typeOf(e.minLength)?t.get("value").length>=(e.minLength||0):!0}}],["maxLength",{errorMsg:function(t,e){return"null"!=typeOf(e.maxLength)?Form.Validator.getMsg("maxLength").substitute({maxLength:e.maxLength,length:t.get("value").length}):""},test:function(t,e){return t.get("value").length<=(e.maxLength||1e4)}}],["validate-integer",{errorMsg:Form.Validator.getMsg.pass("integer"),test:function(t){return Form.Validator.getValidator("IsEmpty").test(t)||/^(-?[1-9]\d*|0)$/.test(t.get("value"))}}],["validate-numeric",{errorMsg:Form.Validator.getMsg.pass("numeric"),test:function(t){return Form.Validator.getValidator("IsEmpty").test(t)||/^-?(?:0$0(?=\d*\.)|[1-9]|0)\d*(\.\d+)?$/.test(t.get("value"))}}],["validate-digits",{errorMsg:Form.Validator.getMsg.pass("digits"),test:function(t){return Form.Validator.getValidator("IsEmpty").test(t)||/^[\d() .:\-\+#]+$/.test(t.get("value"))}}],["validate-alpha",{errorMsg:Form.Validator.getMsg.pass("alpha"),test:function(t){return Form.Validator.getValidator("IsEmpty").test(t)||/^[a-zA-Z]+$/.test(t.get("value"))}}],["validate-alphanum",{errorMsg:Form.Validator.getMsg.pass("alphanum"),test:function(t){return Form.Validator.getValidator("IsEmpty").test(t)||!/\W/.test(t.get("value"))}}],["validate-date",{errorMsg:function(t,e){if(Date.parse){var i=e.dateFormat||"%x";return Form.Validator.getMsg("dateSuchAs").substitute({date:(new Date).format(i)})}return Form.Validator.getMsg("dateInFormatMDY")},test:function(t,e){if(Form.Validator.getValidator("IsEmpty").test(t))return!0;var i=Locale.get("Date"),n=new RegExp([i.days,i.days_abbr,i.months,i.months_abbr,i.AM,i.PM].flatten().join("|"),"i"),s=t.get("value"),r=s.match(/[a-z]+/gi);if(r&&!r.every(n.exec,n))return!1;var o=Date.parse(s);if(!o)return!1;var a=e.dateFormat||"%x",h=o.format(a);return"invalid date"!=h&&t.set("value",h),o.isValid()}}],["validate-email",{errorMsg:Form.Validator.getMsg.pass("email"),test:function(t){return Form.Validator.getValidator("IsEmpty").test(t)||/^(?:[a-z0-9!#$%&'*+\/=?^_`{|}~-]\.?){0,63}[a-z0-9!#$%&'*+\/=?^_`{|}~-]@(?:(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)*[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\])$/i.test(t.get("value"))}}],["validate-url",{errorMsg:Form.Validator.getMsg.pass("url"),test:function(t){return Form.Validator.getValidator("IsEmpty").test(t)||/^(https?|ftp|rmtp|mms):\/\/(([A-Z0-9][A-Z0-9_-]*)(\.[A-Z0-9][A-Z0-9_-]*)+)(:(\d+))?\/?/i.test(t.get("value"))}}],["validate-currency-dollar",{errorMsg:Form.Validator.getMsg.pass("currencyDollar"),test:function(t){return Form.Validator.getValidator("IsEmpty").test(t)||/^\$?\-?([1-9]{1}[0-9]{0,2}(\,[0-9]{3})*(\.[0-9]{0,2})?|[1-9]{1}\d*(\.[0-9]{0,2})?|0(\.[0-9]{0,2})?|(\.[0-9]{1,2})?)$/.test(t.get("value"))}}],["validate-one-required",{errorMsg:Form.Validator.getMsg.pass("oneRequired"),test:function(t,e){var i=document.id(e["validate-one-required"])||t.getParent(e["validate-one-required"]);return i.getElements("input").some(function(t){return t.get(["checkbox","radio"].contains(t.get("type"))?"checked":"value")})}}]]),Element.Properties.validator={set:function(t){this.get("validator").setOptions(t)},get:function(){var t=this.retrieve("validator");return t||(t=new Form.Validator(this),this.store("validator",t)),t}},Element.implement({validate:function(t){return t&&this.set("validator",t),this.get("validator").validate()}}),Form.Validator.addAllThese([["validate-enforce-oncheck",{test:function(t,e){var i=t.getParent("form").retrieve("validator");return i?((e.toEnforce||document.id(e.enforceChildrenOf).getElements("input, select, textarea")).map(function(e){t.checked?i.enforceField(e):(i.ignoreField(e),i.resetField(e))}),!0):!0}}],["validate-ignore-oncheck",{test:function(t,e){var i=t.getParent("form").retrieve("validator");return i?((e.toIgnore||document.id(e.ignoreChildrenOf).getElements("input, select, textarea")).each(function(e){t.checked?(i.ignoreField(e),i.resetField(e)):i.enforceField(e)}),!0):!0}}],["validate-nospace",{errorMsg:function(){return Form.Validator.getMsg("noSpace")},test:function(t){return!t.get("value").test(/\s/)}}],["validate-toggle-oncheck",{test:function(t,e){var i=t.getParent("form").retrieve("validator");if(!i)return!0;var n=e.toToggle||document.id(e.toToggleChildrenOf).getElements("input, select, textarea");return n.each(t.checked?function(t){i.enforceField(t)}:function(t){i.ignoreField(t),i.resetField(t)}),!0}}],["validate-reqchk-bynode",{errorMsg:function(){return Form.Validator.getMsg("reqChkByNode")},test:function(t,e){return document.id(e.nodeId).getElements(e.selector||"input[type=checkbox], input[type=radio]").some(function(t){return t.checked})}}],["validate-required-check",{errorMsg:function(t,e){return e.useTitle?t.get("title"):Form.Validator.getMsg("requiredChk")},test:function(t){return!!t.checked}}],["validate-reqchk-byname",{errorMsg:function(t,e){return Form.Validator.getMsg("reqChkByName").substitute({label:e.label||t.get("type")})},test:function(t,e){var i=e.groupName||t.get("name"),n=$$(document.getElementsByName(i)).some(function(t){return t.checked}),s=t.getParent("form").retrieve("validator");return n&&s&&s.resetField(t),n}}],["validate-match",{errorMsg:function(t,e){return Form.Validator.getMsg("match").substitute({matchName:e.matchName||document.id(e.matchInput).get("name")})},test:function(t,e){var i=t.get("value"),n=document.id(e.matchInput)&&document.id(e.matchInput).get("value");return i&&n?i==n:!0}}],["validate-after-date",{errorMsg:function(t,e){return Form.Validator.getMsg("afterDate").substitute({label:e.afterLabel||Form.Validator.getMsg(e.afterElement?"startDate":"currentDate")})},test:function(t,e){var i=document.id(e.afterElement)?Date.parse(document.id(e.afterElement).get("value")):new Date,n=Date.parse(t.get("value"));return n&&i?n>=i:!0}}],["validate-before-date",{errorMsg:function(t,e){return Form.Validator.getMsg("beforeDate").substitute({label:e.beforeLabel||Form.Validator.getMsg(e.beforeElement?"endDate":"currentDate")})},test:function(t,e){var i=Date.parse(t.get("value")),n=document.id(e.beforeElement)?Date.parse(document.id(e.beforeElement).get("value")):new Date;return n&&i?n>=i:!0}}],["validate-custom-required",{errorMsg:function(){return Form.Validator.getMsg("required")},test:function(t,e){return t.get("value")!=e.emptyValue}}],["validate-same-month",{errorMsg:function(t,e){var i=document.id(e.sameMonthAs)&&document.id(e.sameMonthAs).get("value"),n=t.get("value");return""!=n?Form.Validator.getMsg(i?"sameMonth":"startMonth"):void 0},test:function(t,e){var i=Date.parse(t.get("value")),n=Date.parse(document.id(e.sameMonthAs)&&document.id(e.sameMonthAs).get("value"));return i&&n?i.format("%B")==n.format("%B"):!0}}],["validate-cc-num",{errorMsg:function(t){var e=t.get("value").replace(/[^0-9]/g,"");return Form.Validator.getMsg("creditcard").substitute({length:e.length})},test:function(t){if(Form.Validator.getValidator("IsEmpty").test(t))return!0;var e=t.get("value");e=e.replace(/[^0-9]/g,"");var i=!1;if(e.test(/^4[0-9]{12}([0-9]{3})?$/)?i="Visa":e.test(/^5[1-5]([0-9]{14})$/)?i="Master Card":e.test(/^3[47][0-9]{13}$/)?i="American Express":e.test(/^6(?:011|5[0-9]{2})[0-9]{12}$/)?i="Discover":e.test(/^3(?:0[0-5]|[68][0-9])[0-9]{11}$/)&&(i="Diners Club"),i){for(var n=0,s=0,r=e.length-1;r>=0;--r)s=e.charAt(r).toInt(),0!=s&&((e.length-r)%2==0&&(s+=s),s>9&&(s=s.toString().charAt(0).toInt()+s.toString().charAt(1).toInt()),n+=s);if(n%10==0)return!0}for(var o="";""!=e;)o+=" "+e.substr(0,4),e=e.substr(4);return t.getParent("form").retrieve("validator").ignoreField(t),t.set("value",o.clean()),t.getParent("form").retrieve("validator").enforceField(t),!1}}]]),Fx.Elements=new Class({Extends:Fx.CSS,initialize:function(t,e){this.elements=this.subject=$$(t),this.parent(e)},compute:function(t,e,i){var n={};for(var s in t){var r=t[s],o=e[s],a=n[s]={};for(var h in r)a[h]=this.parent(r[h],o[h],i)}return n},set:function(t){for(var e in t)if(this.elements[e]){var i=t[e];for(var n in i)this.render(this.elements[e],n,i[n],this.options.unit)}return this},start:function(t){if(!this.check(t))return this;var e={},i={};for(var n in t)if(this.elements[n]){var s=t[n],r=e[n]={},o=i[n]={};for(var a in s){var h=this.prepare(this.elements[n],a,s[a]);r[a]=h.from,o[a]=h.to}}return this.parent(e,i)}}),Fx.Accordion=new Class({Extends:Fx.Elements,options:{fixedHeight:!1,fixedWidth:!1,display:0,show:!1,height:!0,width:!1,opacity:!0,alwaysHide:!1,trigger:"click",initialDisplayFx:!0,resetHeight:!0},initialize:function(){var t=function(t){return null!=t},e=Array.link(arguments,{container:Type.isElement,options:Type.isObject,togglers:t,elements:t});this.parent(e.elements,e.options);var i=this.options,n=this.togglers=$$(e.togglers);this.previous=-1,this.internalChain=new Chain,i.alwaysHide&&(this.options.link="chain"),(i.show||0===this.options.show)&&(i.display=!1,this.previous=i.show),i.start&&(i.display=!1,i.show=!1);var s=this.effects={};i.opacity&&(s.opacity="fullOpacity"),i.width&&(s.width=i.fixedWidth?"fullWidth":"offsetWidth"),i.height&&(s.height=i.fixedHeight?"fullHeight":"scrollHeight");for(var r=0,o=n.length;o>r;r++)this.addSection(n[r],this.elements[r]);this.elements.each(function(t,e){if(i.show===e)this.fireEvent("active",[n[e],t]);else for(var r in s)t.setStyle(r,0)},this),(i.display||0===i.display||i.initialDisplayFx===!1)&&this.display(i.display,i.initialDisplayFx),i.fixedHeight!==!1&&(i.resetHeight=!1),this.addEvent("complete",this.internalChain.callChain.bind(this.internalChain))},addSection:function(t,e){t=document.id(t),e=document.id(e),this.togglers.include(t),this.elements.include(e);var i=this.togglers,n=this.options,s=i.contains(t),r=i.indexOf(t),o=this.display.pass(r,this);if(t.store("accordion:display",o).addEvent(n.trigger,o),n.height&&e.setStyles({"padding-top":0,"border-top":"none","padding-bottom":0,"border-bottom":"none"}),n.width&&e.setStyles({"padding-left":0,"border-left":"none","padding-right":0,"border-right":"none"}),e.fullOpacity=1,n.fixedWidth&&(e.fullWidth=n.fixedWidth),n.fixedHeight&&(e.fullHeight=n.fixedHeight),e.setStyle("overflow","hidden"),!s)for(var a in this.effects)e.setStyle(a,0);return this},removeSection:function(t,e){var i=this.togglers,n=i.indexOf(t),s=this.elements[n],r=function(){i.erase(t),this.elements.erase(s),this.detach(t)}.bind(this);return this.now==n||null!=e?this.display(null!=e?e:n-1>=0?n-1:0).chain(r):r(),this},detach:function(t){var e=function(t){t.removeEvent(this.options.trigger,t.retrieve("accordion:display"))}.bind(this);return t?e(t):this.togglers.each(e),this},display:function(t,e){if(!this.check(t,e))return this;var i={},n=this.elements,s=this.options,r=this.effects;if(null==e&&(e=!0),"element"==typeOf(t)&&(t=n.indexOf(t)),t==this.current&&!s.alwaysHide)return this;if(s.resetHeight){var o=n[this.current];if(o&&!this.selfHidden)for(var a in r)o.setStyle(a,o[r[a]])}return this.timer&&"chain"==s.link||t===this.current&&!s.alwaysHide?this:(null!=this.current&&(this.previous=this.current),this.current=t,this.selfHidden=!1,n.each(function(n,o){i[o]={};var a;o!=t?a=!0:s.alwaysHide&&(n.offsetHeight>0&&s.height||n.offsetWidth>0&&s.width)&&(a=!0,this.selfHidden=!0),this.fireEvent(a?"background":"active",[this.togglers[o],n]);for(var h in r)i[o][h]=a?0:n[r[h]];e||a||!s.resetHeight||(i[o].height="auto")},this),this.internalChain.clearChain(),this.internalChain.chain(function(){if(s.resetHeight&&!this.selfHidden){var e=n[t];e&&e.setStyle("height","auto")}}.bind(this)),e?this.start(i):this.set(i).internalChain.callChain())}}),Fx.Move=new Class({Extends:Fx.Morph,options:{relativeTo:document.body,position:"center",edge:!1,offset:{x:0,y:0}},start:function(t){var e=this.element,i=e.getStyles("top","left");return("auto"==i.top||"auto"==i.left)&&e.setPosition(e.getPosition(e.getOffsetParent())),this.parent(e.position(Object.merge({},this.options,t,{returnPos:!0})))}}),Element.Properties.move={set:function(t){return this.get("move").cancel().setOptions(t),this},get:function(){var t=this.retrieve("move");return t||(t=new Fx.Move(this,{link:"cancel"}),this.store("move",t)),t}},Element.implement({move:function(t){return this.get("move").start(t),this}}),Fx.Slide=new Class({Extends:Fx,options:{mode:"vertical",wrapper:!1,hideOverflow:!0,resetHeight:!1},initialize:function(t,e){t=this.element=this.subject=document.id(t),this.parent(e),e=this.options;var i=t.retrieve("wrapper"),n=t.getStyles("margin","position","overflow");e.hideOverflow&&(n=Object.append(n,{overflow:"hidden"})),e.wrapper&&(i=document.id(e.wrapper).setStyles(n)),i||(i=new Element("div",{styles:n}).wraps(t)),t.store("wrapper",i).setStyle("margin",0),"visible"==t.getStyle("overflow")&&t.setStyle("overflow","hidden"),this.now=[],this.open=!0,this.wrapper=i,this.addEvent("complete",function(){this.open=0!=i["offset"+this.layout.capitalize()],this.open&&this.options.resetHeight&&i.setStyle("height","")},!0)},vertical:function(){this.margin="margin-top",this.layout="height",this.offset=this.element.offsetHeight},horizontal:function(){this.margin="margin-left",this.layout="width",this.offset=this.element.offsetWidth},set:function(t){return this.element.setStyle(this.margin,t[0]),this.wrapper.setStyle(this.layout,t[1]),this},compute:function(t,e,i){return[0,1].map(function(n){return Fx.compute(t[n],e[n],i)})},start:function(t,e){if(!this.check(t,e))return this;this[e||this.options.mode]();var i,n=this.element.getStyle(this.margin).toInt(),s=this.wrapper.getStyle(this.layout).toInt(),r=[[n,s],[0,this.offset]],o=[[n,s],[-this.offset,0]];switch(t){case"in":i=r;break;case"out":i=o;break;case"toggle":i=0==s?r:o}return this.parent(i[0],i[1])},slideIn:function(t){return this.start("in",t)},slideOut:function(t){return this.start("out",t)},hide:function(t){return this[t||this.options.mode](),this.open=!1,this.set([-this.offset,0])},show:function(t){return this[t||this.options.mode](),this.open=!0,this.set([0,this.offset])},toggle:function(t){return this.start("toggle",t)}}),Element.Properties.slide={set:function(t){return this.get("slide").cancel().setOptions(t),this},get:function(){var t=this.retrieve("slide");return t||(t=new Fx.Slide(this,{link:"cancel"}),this.store("slide",t)),t}},Element.implement({slide:function(t,e){t=t||"toggle";var i,n=this.get("slide");switch(t){case"hide":n.hide(e);break;case"show":n.show(e);break;case"toggle":var s=this.retrieve("slide:flag",n.open);n[s?"slideOut":"slideIn"](e),this.store("slide:flag",!s),i=!0;break;default:n.start(t,e)}return i||this.eliminate("slide:flag"),this}}),function(){function t(t){return/^(?:body|html)$/i.test(t.tagName)}Fx.Scroll=new Class({Extends:Fx,options:{offset:{x:0,y:0},wheelStops:!0},initialize:function(t,e){if(this.element=this.subject=document.id(t),this.parent(e),"element"!=typeOf(this.element)&&(this.element=document.id(this.element.getDocument().body)),this.options.wheelStops){var i=this.element,n=this.cancel.pass(!1,this);this.addEvent("start",function(){i.addEvent("mousewheel",n)},!0),this.addEvent("complete",function(){i.removeEvent("mousewheel",n)},!0)}},set:function(){var t=Array.flatten(arguments);return this.element.scrollTo(t[0],t[1]),this},compute:function(t,e,i){return[0,1].map(function(n){return Fx.compute(t[n],e[n],i)})},start:function(t,e){if(!this.check(t,e))return this;var i=this.element.getScroll();return this.parent([i.x,i.y],[t,e])},calculateScroll:function(t,e){var i=this.element,n=i.getScrollSize(),s=i.getScroll(),r=i.getSize(),o=this.options.offset,a={x:t,y:e};for(var h in a)a[h]||0===a[h]||(a[h]=s[h]),"number"!=typeOf(a[h])&&(a[h]=n[h]-r[h]),a[h]+=o[h];return[a.x,a.y]},toTop:function(){return this.start.apply(this,this.calculateScroll(!1,0))},toLeft:function(){return this.start.apply(this,this.calculateScroll(0,!1))},toRight:function(){return this.start.apply(this,this.calculateScroll("right",!1))},toBottom:function(){return this.start.apply(this,this.calculateScroll(!1,"bottom"))},toElement:function(e,i){i=i?Array.from(i):["x","y"];var n=t(this.element)?{x:0,y:0}:this.element.getScroll(),s=Object.map(document.id(e).getPosition(this.element),function(t,e){return i.contains(e)?t+n[e]:!1});return this.start.apply(this,this.calculateScroll(s.x,s.y))},toElementEdge:function(t,e,i){e=e?Array.from(e):["x","y"],t=document.id(t);var n={},s=t.getPosition(this.element),r=t.getSize(),o=this.element.getScroll(),a=this.element.getSize(),h={x:s.x+r.x,y:s.y+r.y};return["x","y"].each(function(t){e.contains(t)&&(h[t]>o[t]+a[t]&&(n[t]=h[t]-a[t]),s[t]this.elements.length&&t.splice(this.elements.length-1,t.length-this.elements.length));var a=0;e=i=0,t.each(function(t){var s={};r?(s.top=e-o[t].top-a,e+=o[t].height):(s.left=i-o[t].left,i+=o[t].width),a+=o[t].margin,n[t]=s},this);var h={};return Array.clone(t).sort().each(function(t){h[t]=n[t]}),this.start(h),this.currentOrder=t,this},rearrangeDOM:function(t){t=t||this.currentOrder;var e=this.elements[0].getParent(),i=[];return this.elements.setStyle("opacity",0),t.each(function(t){i.push(this.elements[t].inject(e).setStyles({top:0,left:0}))},this),this.elements.setStyle("opacity",1),this.elements=$$(i),this.setDefaultOrder(),this},getDefaultOrder:function(){return this.elements.map(function(t,e){return e})},getCurrentOrder:function(){return this.currentOrder},forward:function(){return this.sort(this.getDefaultOrder())},backward:function(){return this.sort(this.getDefaultOrder().reverse())},reverse:function(){return this.sort(this.currentOrder.reverse())},sortByElements:function(t){return this.sort(t.map(function(t){return this.elements.indexOf(t)},this))},swap:function(t,e){"element"==typeOf(t)&&(t=this.elements.indexOf(t)),"element"==typeOf(e)&&(e=this.elements.indexOf(e));var i=Array.clone(this.currentOrder);return i[this.currentOrder.indexOf(t)]=e,i[this.currentOrder.indexOf(e)]=t,this.sort(i)}});var HtmlTable=new Class({Implements:[Options,Events,Class.Occlude],options:{properties:{cellpadding:0,cellspacing:0,border:0},rows:[],headers:[],footers:[]},property:"HtmlTable",initialize:function(){var t=Array.link(arguments,{options:Type.isObject,table:Type.isElement,id:Type.isString});return this.setOptions(t.options),!t.table&&t.id&&(t.table=document.id(t.id)),this.element=t.table||new Element("table",this.options.properties),this.occlude()?this.occluded:void this.build()},build:function(){this.element.store("HtmlTable",this),this.body=document.id(this.element.tBodies[0])||new Element("tbody").inject(this.element),$$(this.body.rows),this.options.headers.length?this.setHeaders(this.options.headers):this.thead=document.id(this.element.tHead),this.thead&&(this.head=this.getHead()),this.options.footers.length&&this.setFooters(this.options.footers),this.tfoot=document.id(this.element.tFoot),this.tfoot&&(this.foot=document.id(this.tfoot.rows[0])),this.options.rows.each(function(t){this.push(t)},this)},toElement:function(){return this.element},empty:function(){return this.body.empty(),this},set:function(t,e){var i="headers"==t?"tHead":"tFoot",n=i.toLowerCase();this[n]=(document.id(this.element[i])||new Element(n).inject(this.element,"top")).empty();var s=this.push(e,{},this[n],"headers"==t?"th":"td");return"headers"==t?this.head=this.getHead():this.foot=this.getHead(),s},getHead:function(){var t=this.thead.rows;return t.length>1?$$(t):t.length?document.id(t[0]):!1},setHeaders:function(t){return this.set("headers",t),this},setFooters:function(t){return this.set("footers",t),this},update:function(t,e,i){var n=t.getChildren(i||"td"),s=n.length-1;return e.each(function(e,r){var o=n[r]||new Element(i||"td").inject(t),a=(e&&Object.prototype.hasOwnProperty.call(e,"content")?e.content:"")||e,h=typeOf(a);e&&Object.prototype.hasOwnProperty.call(e,"properties")&&o.set(e.properties),/(element(s?)|array|collection)/.test(h)?o.empty().adopt(a):o.set("html",a),r>s?n.push(o):n[r]=o}),{tr:t,tds:n}},push:function(t,e,i,n,s){return"element"==typeOf(t)&&"tr"==t.get("tag")?(t.inject(i||this.body,s),{tr:t,tds:t.getChildren("td")}):this.update(new Element("tr",e).inject(i||this.body,s),t,n)},pushMany:function(t,e,i,n,s){return t.map(function(t){return this.push(t,e,i,n,s)},this)}});["adopt","inject","wraps","grab","replaces","dispose"].each(function(t){HtmlTable.implement(t,function(){return this.element[t].apply(this.element,arguments),this})}),function(){var t=document.createElement("table");try{t.innerHTML="",t=0===t.childNodes.length}catch(e){t=!0}HtmlTable=Class.refactor(HtmlTable,{options:{sortIndex:0,sortReverse:!1,parsers:[],defaultParser:"string",classSortable:"table-sortable",classHeadSort:"table-th-sort",classHeadSortRev:"table-th-sort-rev",classNoSort:"table-th-nosort",classGroupHead:"table-tr-group-head",classGroup:"table-tr-group",classCellSort:"table-td-sort",classSortSpan:"table-th-sort-span",sortable:!1,thSelector:"th"},initialize:function(){return this.previous.apply(this,arguments),this.occluded?this.occluded:(this.sorted={index:null,dir:1},this.bound||(this.bound={}),this.bound.headClick=this.headClick.bind(this),this.sortSpans=new Elements,void(this.options.sortable&&(this.enableSort(),null!=this.options.sortIndex&&this.sort(this.options.sortIndex,this.options.sortReverse))))},attachSorts:function(t){this.detachSorts(),t!==!1&&this.element.addEvent("click:relay("+this.options.thSelector+")",this.bound.headClick)},detachSorts:function(){this.element.removeEvents("click:relay("+this.options.thSelector+")")},setHeaders:function(){this.previous.apply(this,arguments),this.sortable&&this.setParsers()},setParsers:function(){this.parsers=this.detectParsers()},detectParsers:function(){return this.head&&this.head.getElements(this.options.thSelector).flatten().map(this.detectParser,this)},detectParser:function(t,e){if(t.hasClass(this.options.classNoSort)||t.retrieve("htmltable-parser"))return t.retrieve("htmltable-parser");var i=new Element("div");i.adopt(t.childNodes).inject(t);var n=new Element("span",{"class":this.options.classSortSpan}).inject(i,"top");this.sortSpans.push(n);var s,r=this.options.parsers[e],o=this.body.rows;switch(typeOf(r)){case"function":r={convert:r},s=!0;break;case"string":r=r,s=!0}return s||HtmlTable.ParserPriority.some(function(t){var i=HtmlTable.Parsers[t],n=i.match;if(!n)return!1;for(var s=0,a=o.length;a>s;s++){var h=document.id(o[s].cells[e]),l=h?h.get("html").clean():"";if(l&&n.test(l))return r=i,!0}}),r||(r=this.options.defaultParser),t.store("htmltable-parser",r),r},headClick:function(t,e){return this.head&&!e.hasClass(this.options.classNoSort)?this.sort(Array.indexOf(this.head.getElements(this.options.thSelector).flatten(),e)%this.body.rows[0].cells.length):void 0},serialize:function(){var t=this.previous.apply(this,arguments)||{};return this.options.sortable&&(t.sortIndex=this.sorted.index,t.sortReverse=this.sorted.reverse),t},restore:function(t){this.options.sortable&&t.sortIndex&&this.sort(t.sortIndex,t.sortReverse),this.previous.apply(this,arguments)},setSortedState:function(t,e){this.sorted.reverse=null!=e?e:this.sorted.index==t?!this.sorted.reverse:null==this.sorted.index,null!=t&&(this.sorted.index=t)},setHeadSort:function(t){var e=$$(this.head.length?this.head.map(function(t){return t.getElements(this.options.thSelector)[this.sorted.index]},this).clean():this.head.cells[this.sorted.index]);e.length&&(t?(e.addClass(this.options.classHeadSort),this.sorted.reverse?e.addClass(this.options.classHeadSortRev):e.removeClass(this.options.classHeadSortRev)):e.removeClass(this.options.classHeadSort).removeClass(this.options.classHeadSortRev))},setRowSort:function(t,e){for(var i,n,s=t.length,r=this.body;s;){var o=t[--s],a=o.position,h=r.rows[a];if(!h.disabled)for(e||(i=this.setGroupSort(i,h,o),this.setRowStyle(h,s)),r.appendChild(h),n=0;s>n;n++)t[n].position>a&&t[n].position--}},setRowStyle:function(t,e){this.previous(t,e),t.cells[this.sorted.index].addClass(this.options.classCellSort)},setGroupSort:function(t,e,i){return t==i.value?e.removeClass(this.options.classGroupHead).addClass(this.options.classGroup):e.removeClass(this.options.classGroup).addClass(this.options.classGroupHead),i.value},getParser:function(){var t=this.parsers[this.sorted.index];return"string"==typeOf(t)?HtmlTable.Parsers[t]:t},sort:function(e,i,n,s){if(this.head){n||(this.clearSort(),this.setSortedState(e,i),this.setHeadSort(!0));var r=this.getParser();if(r){var o;t||(o=this.body.getParent(),this.body.dispose());var a=this.parseData(r).sort(s?s:function(t,e){return t.value===e.value?0:t.value>e.value?1:-1});return this.sorted.reverse==(r==HtmlTable.Parsers["input-checked"])&&a.reverse(!0),this.setRowSort(a,n),o&&o.grab(this.body),this.fireEvent("stateChanged"),this.fireEvent("sort",[this.body,this.sorted.index])}}},parseData:function(t){return Array.map(this.body.rows,function(e,i){var n=t.convert.call(document.id(e.cells[this.sorted.index]));return{position:i,value:n}},this)},clearSort:function(){this.setHeadSort(!1),this.body.getElements("td").removeClass(this.options.classCellSort)},reSort:function(){return this.sortable&&this.sort.call(this,this.sorted.index,this.sorted.reverse),this},enableSort:function(){return this.element.addClass(this.options.classSortable),this.attachSorts(!0),this.setParsers(),this.sortable=!0,this},disableSort:function(){return this.element.removeClass(this.options.classSortable),this.attachSorts(!1),this.sortSpans.each(function(t){t.destroy()}),this.sortSpans.empty(),this.sortable=!1,this}}),HtmlTable.ParserPriority=["date","input-checked","input-value","float","number"],HtmlTable.Parsers={date:{match:/^\d{2}[-\/ ]\d{2}[-\/ ]\d{2,4}$/,convert:function(){var t=Date.parse(this.get("text").stripTags()); +return"date"==typeOf(t)?t.format("db"):""},type:"date"},"input-checked":{match:/ type="(radio|checkbox)"/,convert:function(){return this.getElement("input").checked}},"input-value":{match:/2083&&this.fireEvent("error",s),Request.JSONP.request_map["request_"+n]=function(){this.success(arguments,n)}.bind(this);var r=this.getScript(s).inject(t.injectScript);return this.fireEvent("request",[s,r]),t.timeout&&this.timeout.delay(t.timeout,this),this},getScript:function(t){return this.script||(this.script=new Element("script",{type:"text/javascript",async:!0,src:t})),this.script},success:function(t){this.running&&this.clear().fireEvent("complete",t).fireEvent("success",t).callChain()},cancel:function(){return this.running&&this.clear().fireEvent("cancel"),this},isRunning:function(){return!!this.running},clear:function(){return this.running=!1,this.script&&(this.script.destroy(),this.script=null),this},timeout:function(){return this.running&&(this.running=!1,this.fireEvent("timeout",[this.script.get("src"),this.script]).fireEvent("failure").cancel()),this}}),Request.JSONP.counter=0,Request.JSONP.request_map={},Request.implement({options:{initialDelay:5e3,delay:5e3,limit:6e4},startTimer:function(t){var e=function(){this.running||this.send({data:t})};return this.lastDelay=this.options.initialDelay,this.timer=e.delay(this.lastDelay,this),this.completeCheck=function(t){clearTimeout(this.timer),this.lastDelay=t?this.options.delay:(this.lastDelay+this.options.delay).min(this.options.limit),this.timer=e.delay(this.lastDelay,this)},this.addEvent("complete",this.completeCheck)},stopTimer:function(){return clearTimeout(this.timer),this.removeEvent("complete",this.completeCheck)}}),Request.Queue=new Class({Implements:[Options,Events],Binds:["attach","request","complete","cancel","success","failure","exception"],options:{stopOnFailure:!0,autoAdvance:!0,concurrent:1,requests:{}},initialize:function(t){var e;t&&(e=t.requests,delete t.requests),this.setOptions(t),this.requests={},this.queue=[],this.reqBinders={},e&&this.addRequests(e)},addRequest:function(t,e){return this.requests[t]=e,this.attach(t,e),this},addRequests:function(t){return Object.each(t,function(t,e){this.addRequest(e,t)},this),this},getName:function(t){return Object.keyOf(this.requests,t)},attach:function(t,e){return e._groupSend?this:(["request","complete","cancel","success","failure","exception"].each(function(i){this.reqBinders[t]||(this.reqBinders[t]={}),this.reqBinders[t][i]=function(){this["on"+i.capitalize()].apply(this,[t,e].append(arguments))}.bind(this),e.addEvent(i,this.reqBinders[t][i])},this),e._groupSend=e.send,e.send=function(i){return this.send(t,i),e}.bind(this),this)},removeRequest:function(t){var e="object"==typeOf(t)?this.getName(t):t;return(e||"string"==typeOf(e))&&(t=this.requests[e])?(["request","complete","cancel","success","failure","exception"].each(function(i){t.removeEvent(i,this.reqBinders[e][i])},this),t.send=t._groupSend,delete t._groupSend,this):this},getRunning:function(){return Object.filter(this.requests,function(t){return t.running})},isRunning:function(){return!!Object.keys(this.getRunning()).length},send:function(t,e){var i=function(){this.requests[t]._groupSend(e),this.queue.erase(i)}.bind(this);return i.name=t,Object.keys(this.getRunning()).length>=this.options.concurrent||this.error&&this.options.stopOnFailure?this.queue.push(i):i(),this},hasNext:function(t){return t?!!this.queue.filter(function(e){return e.name==t}).length:!!this.queue.length},resume:function(){return this.error=!1,(this.options.concurrent-Object.keys(this.getRunning()).length).times(this.runNext,this),this},runNext:function(t){if(!this.queue.length)return this;if(t){var e;this.queue.each(function(i){e||i.name!=t||(e=!0,i())})}else this.queue[0]();return this},runAll:function(){return this.queue.each(function(t){t()}),this},clear:function(t){return t?this.queue=this.queue.map(function(e){return e.name!=t?e:!1}).filter(function(t){return t}):this.queue.empty(),this},cancel:function(t){return this.requests[t].cancel(),this},onRequest:function(){this.fireEvent("request",arguments)},onComplete:function(){this.fireEvent("complete",arguments),this.queue.length||this.fireEvent("end")},onCancel:function(){this.options.autoAdvance&&!this.error&&this.runNext(),this.fireEvent("cancel",arguments)},onSuccess:function(){this.options.autoAdvance&&!this.error&&this.runNext(),this.fireEvent("success",arguments)},onFailure:function(){this.error=!0,!this.options.stopOnFailure&&this.options.autoAdvance&&this.runNext(),this.fireEvent("failure",arguments)},onException:function(){this.error=!0,!this.options.stopOnFailure&&this.options.autoAdvance&&this.runNext(),this.fireEvent("exception",arguments)}});var Asset={javascript:function(t,e){e||(e={});var i=new Element("script",{src:t,type:"text/javascript"}),n=e.document||document,s=e.onload||e.onLoad;return delete e.onload,delete e.onLoad,delete e.document,s&&(i.addEventListener?i.addEvent("load",s):i.addEvent("readystatechange",function(){["loaded","complete"].contains(this.readyState)&&s.call(this)})),i.set(e).inject(n.head)},css:function(t,e){e||(e={});var i=e.onload||e.onLoad,n=e.document||document,s=e.timeout||3e3;["onload","onLoad","document"].each(function(t){delete e[t]});var r=new Element("link",{type:"text/css",rel:"stylesheet",media:"screen",href:t}).setProperties(e).inject(n.head);if(i){var o=!1,a=0,h=function(){for(var t=document.styleSheets,e=0;ea?setTimeout(h,50):void 0};setTimeout(h,0)}return r},image:function(t,e){e||(e={});var i=new Image,n=document.id(i)||new Element("img");return["load","abort","error"].each(function(t){var s="on"+t,r="on"+t.capitalize(),o=e[s]||e[r]||function(){};delete e[r],delete e[s],i[s]=function(){i&&(n.parentNode||(n.width=i.width,n.height=i.height),i=i.onload=i.onabort=i.onerror=null,o.delay(1,n,n),n.fireEvent(t,n,1))}}),i.src=n.src=t,i&&i.complete&&i.onload.delay(1),n.set(e)},images:function(t,e){t=Array.from(t);var i=function(){},n=0;return e=Object.merge({onComplete:i,onProgress:i,onError:i,properties:{}},e),new Elements(t.map(function(i,s){return Asset.image(i,Object.append(e.properties,{onload:function(){n++,e.onProgress.call(this,n,s,i),n==t.length&&e.onComplete()},onerror:function(){n++,e.onError.call(this,n,s,i),n==t.length&&e.onComplete()}}))}))}};!function(){var t=this.Color=new Type("Color",function(t,e){switch(arguments.length>=3?(e="rgb",t=Array.slice(arguments,0,3)):"string"==typeof t&&(t=t.match(/rgb/)?t.rgbToHex().hexToRgb(!0):t.match(/hsb/)?t.hsbToRgb():t.hexToRgb(!0)),e=e||"rgb"){case"hsb":var i=t;t=t.hsbToRgb(),t.hsb=i;break;case"hex":t=t.hexToRgb(!0)}return t.rgb=t.slice(0,3),t.hsb=t.hsb||t.rgbToHsb(),t.hex=t.rgbToHex(),Object.append(t,this)});t.implement({mix:function(){var e=Array.slice(arguments),i="number"==typeOf(e.getLast())?e.pop():50,n=this.slice();return e.each(function(e){e=new t(e);for(var s=0;3>s;s++)n[s]=Math.round(n[s]/100*(100-i)+e[s]/100*i)}),new t(n,"rgb")},invert:function(){return new t(this.map(function(t){return 255-t}))},setHue:function(e){return new t([e,this.hsb[1],this.hsb[2]],"hsb")},setSaturation:function(e){return new t([this.hsb[0],e,this.hsb[2]],"hsb")},setBrightness:function(e){return new t([this.hsb[0],this.hsb[1],e],"hsb")}}),this.$RGB=function(e,i,n){return new t([e,i,n],"rgb")},this.$HSB=function(e,i,n){return new t([e,i,n],"hsb")},this.$HEX=function(e){return new t(e,"hex")},Array.implement({rgbToHsb:function(){var t=this[0],e=this[1],i=this[2],n=0,s=Math.max(t,e,i),r=Math.min(t,e,i),o=s-r,a=s/255,h=0!=s?o/s:0;if(0!=h){var l=(s-t)/o,u=(s-e)/o,c=(s-i)/o;n=t==s?c-u:e==s?2+l-c:4+u-l,n/=6,0>n&&n++}return[Math.round(360*n),Math.round(100*h),Math.round(100*a)]},hsbToRgb:function(){var t=Math.round(this[2]/100*255);if(0==this[1])return[t,t,t];var e=this[0]%360,i=e%60,n=Math.round(this[2]*(100-this[1])/1e4*255),s=Math.round(this[2]*(6e3-this[1]*i)/6e5*255),r=Math.round(this[2]*(6e3-this[1]*(60-i))/6e5*255);switch(Math.floor(e/60)){case 0:return[t,r,n];case 1:return[s,t,n];case 2:return[n,t,r];case 3:return[n,s,t];case 4:return[r,n,t];case 5:return[t,n,s]}return!1}}),String.implement({rgbToHsb:function(){var t=this.match(/\d{1,3}/g);return t?t.rgbToHsb():null},hsbToRgb:function(){var t=this.match(/\d{1,3}/g);return t?t.hsbToRgb():null}})}(),function(){var t=this.Table=function(){this.length=0;var t=[],e=[];this.set=function(i,n){var s=t.indexOf(i);if(-1==s){var r=t.length;t[r]=i,e[r]=n,this.length++}else e[s]=n;return this},this.get=function(i){var n=t.indexOf(i);return-1==n?null:e[n]},this.erase=function(i){var n=t.indexOf(i);return-1!=n?(this.length--,t.splice(n,1),e.splice(n,1)[0]):null},this.each=this.forEach=function(i,n){for(var s=0,r=this.length;r>s;s++)i.call(n,t[s],e[s],this)}};this.Type&&new Type("Table",t)}(); \ No newline at end of file diff --git a/views/css/colorscheme.styl b/views/css/colorscheme.styl index 5d738e9..001baf5 100644 --- a/views/css/colorscheme.styl +++ b/views/css/colorscheme.styl @@ -7,3 +7,8 @@ pre span color_scheme('number', #429bc1) color_scheme('string', #83a440) color_scheme('comment', #9c9ea0) + color_scheme('tag', #b05098) + color_scheme('attribute', #83a440) + color_scheme('value', #429bc1) + color_scheme('id', #b05098) + color_scheme('class', #b05098) diff --git a/views/css/demos.styl b/views/css/demos.styl new file mode 100644 index 0000000..6d23e48 --- /dev/null +++ b/views/css/demos.styl @@ -0,0 +1,35 @@ +/* D E M O S * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +.demos + div.tabcontent + margin 0 + .tabs + width 100% + height 100% + display none + &.selected + display block !important + background-color #fff + #runner + background-color #fff + h2 + color #fff !important + h3 + background-color #fff + border-radius: 5px; + border: solid #dedfdf 1px; + font-weight: 400; + margin: 1.5em 0 0; + padding: 0.15em 0.5em 0.25em; + a + padding 0 0.3em + margin-top 0.2em + .details + float left + clear: both + width 100% + +.demoTabs + form + textarea + display none diff --git a/views/css/docs.styl b/views/css/docs.styl index d3f0478..76eb70b 100644 --- a/views/css/docs.styl +++ b/views/css/docs.styl @@ -90,7 +90,7 @@ &:after color #ffffff - .content + > .content margin 0 0 2em .heading:first-child diff --git a/views/css/media.styl b/views/css/media.styl index 8aef96d..45bd8d0 100644 --- a/views/css/media.styl +++ b/views/css/media.styl @@ -261,6 +261,8 @@ .previous-version select width 19.2em + .democontent + position static !important .modules padding-top 2em @@ -317,7 +319,7 @@ float left width 26% - .content + > .content float right width 70% diff --git a/views/css/style.styl b/views/css/style.styl index e334930..f47e120 100644 --- a/views/css/style.styl +++ b/views/css/style.styl @@ -11,6 +11,7 @@ @import mootools @import builder @import developers +@import demos // temp until guides are up diff --git a/views/demos/index.jade b/views/demos/index.jade new file mode 100644 index 0000000..2160cfa --- /dev/null +++ b/views/demos/index.jade @@ -0,0 +1,50 @@ +extends ../layouts/home + +mixin tabs(highlighted) + div.versions.clearfix + h3 + | #{demoName} + + ul.demoTabs + each highligh, type in highlighted + li + a(href="#", data-type="#{type}") + | #{type} + li + a(href="#", data-type="demo").selected + | demo + li + form(method="post", action="http://jsfiddle.net/api/post/mootools/#{version}/#{dependencies}") + a(href="#", data-type="jsfiddle") + | Edit live in jsFiddle + textarea(name="html") #{content.html} + textarea(name="css") #{content.css} + textarea(name="js") #{content.js} + +block main + .docs.overview.clearfix.wrapper.democontent + mixin tabs(content.highlighted) + .toc + each section in toc + ul.section + li.small + a(href= section.link) #{section.description.name} + + + .content.demos + div.tabcontent + div#runner.tabs.selected(data-type="demo") + .details + !{description} + div + !{content.html} + + each highligh, type in content.highlighted + div.tabs(data-type="#{type}") + | !{highligh} + + script(src='/demos/MooTools-More-1.5.1-compressed.js') + script. + !{content.js} + style. + !{content.css} diff --git a/views/js/main.js b/views/js/main.js index 07e5781..e6512d7 100644 --- a/views/js/main.js +++ b/views/js/main.js @@ -73,6 +73,18 @@ if (window.matchMedia){ sitemap[i].addEventListener('click', toggleDiv(i), false); } + // demo runner + document.getElements('ul.demoTabs li a').addEvent('click', function(event){ + event.preventDefault(); + var type = this.getProperty('data-type'); + if (type == 'jsfiddle') return this.getParent('form').submit(); + $$('ul.demoTabs a.selected').removeClass('selected'); + this.addClass('selected'); + $$('.tabcontent .tabs').removeClass('selected'); + $$('.tabcontent .tabs[data-type="' + type + '"]').addClass('selected'); + }, false); + + }, false); } diff --git a/views/partials/header.jade b/views/partials/header.jade index b9f8dd6..1e8352a 100644 --- a/views/partials/header.jade +++ b/views/partials/header.jade @@ -36,6 +36,7 @@ li(class=(site == 'more' ? 'selected' : '')) a(href='/more/') More + // mixin menu-item('/demos', 'Demos', site == 'demos') mixin menu-item('/blog', 'Blog', site == 'blog') mixin menu-item('/forge', 'Forge', site == 'forge') mixin menu-item("http://github.com/mootools", 'Contribute')