/*
 MIT License - {@link http://opensource.org/licenses/mit-license.php}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
*/
Array.prototype.remove=function(a,b){var c=this.slice((b||a)+1||this.length);this.length=a<0?this.length+a:a;return this.push.apply(this,c)};Array.prototype.get=function(a,b){if(a==="first")a=0;else if(a==="last")a=this.length-1;else if(a==="prev")a=this.index-1;else if(a==="next")a=this.index+1;else if(!a&&a!==0)a=this.index;b&&this.setIndex(a);return this.exists(a)?this[a]:undefined};Array.prototype.each=function(a){for(var b=0;b<this.length;++b){var c=this[b];if(a.apply(c,[b,c])===false)break}return this};
Array.prototype.validIndex=function(a){return a>=0&&a<this.length};Array.prototype.setIndex=function(a){this.index=this.validIndex(a)?a:null;return this};Array.prototype.current=function(a){return this.get(a,true)};Array.prototype.isEmpty=function(){return this.length===0};Array.prototype.isSingle=function(){return this.length===1};Array.prototype.isNotEmpty=function(){return this.length!==0};Array.prototype.isNotEmpty=function(){return this.length>1};
Array.prototype.isLast=function(a){a=typeof a==="undefined"?this.index:a;return!this.isEmpty()&&a===this.length-1};Array.prototype.isFirst=function(a){a=typeof a==="undefined"?this.index:a;return!this.isEmpty()&&a===0};Array.prototype.clear=function(){this.length=0};Array.prototype.next=function(a){return this.get(this.index+1,a)};Array.prototype.prev=function(a){return this.get(this.index-1,a)};Array.prototype.reset=function(){this.index=null;return this};
Array.prototype.set=function(a,b){if(a<this.length&&a>=0)this[a]=b;else throw Error("Array.prototype.set: [index] above this.length");return this};Array.prototype.loop=function(){if(!this.index&&this.index!==0)return this.current(0);return this.next()};Array.prototype.add=function(){this.push.apply(this,arguments);return this};
Array.prototype.insert=function(a,b){if(typeof a!=="number")a=this.length;a=a<=this.length?a:this.length;var c=this.slice(a);this.length=a;this.push(b);this.push.apply(this,c);return this};Array.prototype.exists=Array.prototype.exists||function(a){return typeof this[a]!=="undefined"};Array.prototype.has=Array.prototype.has||function(a){for(var b=false,c=0,d=this.length;c<d;++c)if(a==this[c]){b=true;break}return b};
if(typeof window.console!=="object"||typeof window.console.emulated==="undefined"){if(typeof window.console!=="object"||!(typeof window.console.log==="function"||typeof window.console.log==="object")){window.console={};window.console.log=window.console.debug=window.console.warn=window.console.trace=function(){};window.console.error=function(){for(var a="An error has occured. More information will be available in the console log.",b=0;b<arguments.length;++b){if(typeof arguments[b]!=="string")break;
a+="\n"+arguments[b]}if(typeof Error!=="undefined")throw Error(a);else throw a;}}else{if(typeof window.console.debug==="undefined")window.console.debug=function(){for(var a=["console.debug:"],b=0;b<arguments.length;b++)a.push(arguments[b]);window.console.log.apply(window.console,a)};if(typeof window.console.warn==="undefined")window.console.warn=function(){for(var a=["console.warn:"],b=0;b<arguments.length;b++)a.push(arguments[b]);window.console.log.apply(window.console,a)};if(typeof window.console.error===
"undefined")window.console.error=function(){for(var a=["console.error"],b=0;b<arguments.length;b++)a.push(arguments[b]);window.console.log.apply(window.console,a)};if(typeof window.console.trace==="undefined")window.console.trace=function(){window.console.error.apply(window.console,["console.trace does not exist"])}}window.console.emulated=true}
Date.prototype.setDatetimestr=Date.prototype.setDatetimestr||function(a){a=a.split(/[\-\s\:]/g);var b=a[3]||0,c=a[4]||0,d=a[5]||0;this.setUTCFullYear(a[0],a[1]-1,a[2]);this.setUTCHours(b);this.setUTCMinutes(c);this.setUTCSeconds(d);return this};Date.prototype.setDatestr=Date.prototype.setDatestr||function(a){a=a.split(/[\-\s\:]/g);this.setUTCFullYear(a[0]||1978,(a[1]||0)-1,a[2]||1);return this};
Date.prototype.setTimestr=Date.prototype.setTimestr||function(a){a=a.split(/[\-\s\:]/g);var b=a[1]||0,c=a[2]||0;this.setUTCHours(a[0]||0);this.setUTCMinutes(b);this.setUTCSeconds(c);return this};Date.prototype.getDatetimestr=Date.prototype.getDatetimestr||function(){return this.getDatestr()+" "+this.getTimestr()};
Date.prototype.getDatestr=Date.prototype.getDatestr||function(){var a=this,b=a.getUTCFullYear(),c=(this.getUTCMonth()+1).padLeft(0,2);a=this.getUTCDate().padLeft(0,2);return b+"-"+c+"-"+a};Date.prototype.getTimestr=Date.prototype.getTimestr||function(){var a=this.getUTCHours().padLeft(0,2),b=this.getUTCMinutes().padLeft(0,2),c=this.getUTCSeconds().padLeft(0,2);return a+":"+b+":"+c};
Date.prototype.getDatetime=String.prototype.getDatetime||function(){return this.getUTCFullYear()+"-"+(this.getUTCMonth()+1).zeroise(2)+"-"+this.getUTCDate().zeroise(2)+"T"+this.getUTCHours().zeroise(2)+":"+this.getUTCMinutes().zeroise(2)+":"+this.getUTCSeconds().zeroise(2)+"+00:00"};Number.prototype.zeroise=String.prototype.zeroise=String.prototype.zeroise||function(a){var b=this.toString();if(this<0)b=b.substr(1,b.length);for(;b.length<a;)b="0"+b;if(this<0)b="-"+b;return b};
Number.prototype.padLeft=String.prototype.padLeft=String.prototype.padLeft||function(a,b){var c=String(this),d=RegExp(".{"+b+"}$"),e="";if(!a&&a!==0)a=" ";do e+=a;while(e.length<b);return d.exec(e+c)[0]};Number.prototype.padRight=String.prototype.padRight=String.prototype.padRight||function(a,b){var c=String(this),d=RegExp("^.{"+b+"}"),e="";if(!a&&a!==0)a=" ";do e+=a;while(e.length<b);return d.exec(c+e)[0]};
Number.prototype.roundTo=String.prototype.roundTo=String.prototype.roundTo||function(){var a=String(parseInt(this,10));return a=parseInt(a.replace(/[1,2]$/,0).replace(/[3,4]$/,5),10)};String.prototype.trim=String.prototype.trim||function(){return this.replace(/^\s+|\s+$/g,"")};String.prototype.strip=String.prototype.strip||function(a,b){a=String(a);var c=this;if(a.length){b||0||(a=a.replace(/([\[\]\(\)\^\$\.\?\|\/\\])/g,"\\$1"));c=c.replace(eval("/^"+a+"+|"+a+"+$/g"),"")}return String(c)};
String.prototype.stripLeft=String.prototype.stripLeft||function(a,b){a=String(a);var c=this;if(a.length){b||0||(a=a.replace(/([\[\]\(\)\^\$\.\?\|\/\\])/g,"\\$1"));c=c.replace(eval("/^"+a+"+/g"),"")}return String(c)};String.prototype.stripRight=String.prototype.stripRight||function(a,b){a=String(a);var c=this;if(a.length){b||0||(a=a.replace(/([\[\]\(\)\^\$\.\?\|\/\\])/g,"\\$1"));c=c.replace(eval("/"+a+"+$/g"),"")}return String(c)};
String.prototype.toInt=String.prototype.toInt||function(){return parseInt(this,10)};String.prototype.wrap=String.prototype.wrap||function(a,b){return a+this+b};String.prototype.wrapSelection=String.prototype.wrapSelection||function(a,b,c,d){if(typeof c==="undefined"||c===null)c=this.length;if(typeof d==="undefined"||d===null)d=this.length;return this.substring(0,c)+a+this.substring(c,d)+b+this.substring(d)};
String.prototype.toSlug=String.prototype.toSlug||function(){return this.toLowerCase().replace(/[\s_]/g,"-").replace(/[^-a-z0-9]/g,"").replace(/--+/g,"-").replace(/^-+|-+$/g,"")};
String.prototype.queryStringToJSON=String.prototype.queryStringToJSON||function(){var a=String(this);a=a.substring(a.indexOf("?")+1);a=a.replace(/\+/g,"%20");if(a.substring(0,1)==="{"&&a.substring(a.length-1)==="}")return eval(decodeURIComponent(a));a=a.split(/\&(amp\;)?/);for(var b={},c=0,d=a.length;c<d;++c){var e=a[c]||null;if(e!==null){e=e.split("=");if(e!==null){var f=e[0]||null;if(f!==null)if(typeof e[1]!=="undefined"){e=e[1];f=decodeURIComponent(f);e=decodeURIComponent(e);try{e=eval(e)}catch(g){}var j=
f.split(".");if(j.length===1)b[f]=e;else{var k="",l="";$.each(j,function(o,h){k+='["'+h.replace(/"/g,'\\"')+'"]';jsonCLOSUREGLOBAL=b;l="if ( typeof jsonCLOSUREGLOBAL"+k+' === "undefined" ) jsonCLOSUREGLOBAL'+k+" = {}";eval(l);b=jsonCLOSUREGLOBAL;delete jsonCLOSUREGLOBAL});jsonCLOSUREGLOBAL=b;valueCLOSUREGLOBAL=e;l="jsonCLOSUREGLOBAL"+k+" = valueCLOSUREGLOBAL";eval(l);b=jsonCLOSUREGLOBAL;delete jsonCLOSUREGLOBAL;delete valueCLOSUREGLOBAL}}}}}return b};
(function(a){a.appendStylesheet=a.appendStylesheet||function(b,c){if(!(document.body||0)){setTimeout(function(){a.appendStylesheet.apply(a,[b,c])},500);return a}var d="stylesheet-"+b.replace(/[^a-zA-Z0-9]/g,""),e=a("#"+d);if(typeof c==="undefined")c=false;if(e.length===1)if(c)e.remove();else return a;e=document.getElementsByTagName(a.browser.safari?"head":"body")[0];var f=document.createElement("link");f.type="text/css";f.rel="stylesheet";f.media="screen";f.href=b;f.id=d;e.appendChild(f);return a};
a.appendScript=a.appendScript||function(b,c){if(!(document.body||0)){setTimeout(function(){a.appendScript.apply(a,[b,c])},500);return a}var d="script-"+b.replace(/[^a-zA-Z0-9]/g,""),e=a("#"+d);if(typeof c==="undefined")c=false;if(e.length===1)if(c)e.remove();else return a;e=document.getElementsByTagName(a.browser.safari?"head":"body")[0];var f=document.createElement("script");f.type="text/javascript";f.src=b;f.id=d;e.appendChild(f);return a}})(jQuery);
(function(a){a.fn.opacityFix=a.fn.opacityFix||function(){var b=a(this),c=b.css("background-color");if(c&&c!=="rgba(0, 0, 0, 0)")return this;for(var d=b;d.inDOM();){d=d.parent();if((c=d.css("background-color"))&&c!=="rgba(0, 0, 0, 0)"){b.css("background-color",c);break}}return this};a.fn.parentsAndSelf=a.fn.parentsAndSelf||function(b){return a(this).parents(b).andSelf().filter(b)};a.fn.findAndSelf=a.fn.findAndSelf||function(b){return a(this).find(b).andSelf().filter(b)};a.fn.firstInput=a.fn.firstInput||
function(){return a(this).findAndSelf(":input").filter(":first")};a.fn.choose=a.fn.choose||function(b){var c=a(this);if(typeof b==="undefined")b=c.val();else if(c.val()!==b)return this;switch(true){case this.is("option"):c.parents("select:first").choose(b);break;case c.is(":checkbox"):c.attr("checked",true);break;case c.is(":radio"):c.attr("checked",true);break;case c.is("select"):c.val(b);break;default:break}return this};a.fn.unchoose=a.fn.unchoose||function(){var b=a(this);switch(true){case b.is("option"):b.parents(":select:first").unchoose();
break;case b.is(":checkbox"):b.attr("checked",false);break;case b.is(":radio"):b.attr("checked",false);break;case b.is("select"):b.val(b.find("option:first").val());break;default:break}return this};a.fn.wouldSubmit=a.fn.wouldSubmit||function(){var b=a(this).findAndSelf(":input"),c=true;if(!b.length||!(b.attr("name")||0)||b.is(":radio,:checkbox")&&!b.is(":selected,:checked"))c=false;return c};a.fn.values=a.fn.values||function(){var b={};a(this).findAndSelf(":input").each(function(){var c=a(this),d=
c.attr("name")||null,e=c.val();if(!c.wouldSubmit())return true;if(d.indexOf("[]")!==-1){if(typeof b[d]==="undefined")b[d]=[];b[d].push(e)}else b[d]=e});return b};a.fn.submitForm=a.fn.submitForm||function(){var b=a(this);b.parentsAndSelf("form:first").trigger("submit");return b};a.fn.inDOM=a.fn.inDOM||function(){var b=a(this).parent().parent();return b.size()&&(b.height()||b.width())};a.fn.valWrap=a.fn.valWrap||function(b,c){var d=a(this);return d.val(d.val().wrap(b,c))};a.fn.valWrapSelection=a.fn.valWrapSelection||
function(b,c,d,e){var f=a(this),g=f.get(0);b=b||"";c=c||"";if(d||e)f.val(f.val().wrapSelection(b,c,d,e));else{d=g.selectionStart;e=g.selectionEnd;if(document.selection){g.focus();d=document.selection.createRange();d.text=b+d.text+c}else{var j=g.scrollTop;f.val(f.val().wrapSelection(b,c,d,e));g.focus();g.selectionStart=d+b.length;g.selectionEnd=e+b.length;g.scrollTop=j}}return f};a.fn.giveFocus=a.fn.giveFocus||function(){a(this).findAndSelf(":input:visible:first").focus();return this};a.fn.giveTarget=
a.fn.giveTarget||function(){var b=a(this);a(".target").removeClass("target");b.addClass("target");return this};a.fn.highlight=a.fn.highlight||function(b){return a(this).effect("highlight",{},b||3E3)};a.fn.htmlAndSelf=a.fn.htmlAndSelf||function(){return a(this).attr("outerHTML")};a.fn.preventDefault=a.fn.preventDefault||function(){return a(this).click(function(b){b.preventDefault();return false})};a.fn.attemptTypeChangeTo=a.fn.attemptTypeChangeTo||function(b){var c=a(this),d=false,e=c.get(0),f=e.type;
if(b===f)d=true;else if(c.is("input"))if(!a.browser.msie){e.type=b;if(e.type!==f)d=true}return d}})(jQuery);
(function(a){a.fn.binder=a.fn.binder||function(b,c,d){var e=a(this);if(d)e.bind(b,c,d);else{d=c;e.bind(b,d)}return e};a.fn.once=a.fn.once||function(b,c,d){var e=a(this);if(d){e.unbind(b,d);e.bind(b,c,d)}else{d=c;e.unbind(b,d);e.bind(b,d)}return e};a.fn.enter=a.fn.enter||function(b,c){return a(this).binder("enter",b,c)};a.event.special.enter=a.event.special.enter||{setup:function(){a(this).bind("keypress",a.event.special.enter.handler)},teardown:function(){a(this).unbind("keypress",a.event.special.enter.handler)},
handler:function(b){a(this);if(b.keyCode===13){b.type="enter";a.event.handle.apply(this,[b]);return true}}};a.fn.cancel=a.fn.cancel||function(b,c){return a(this).binder("cancel",b,c)};a.event.special.cancel=a.event.special.cancel||{setup:function(){a(this).bind("keyup",a.event.special.cancel.handler)},teardown:function(){a(this).unbind("keyup",a.event.special.cancel.handler)},handler:function(b){a(this);var c=b.keyCode===27;if((typeof b.DOM_VK_ESCAPE==="undefined"?false:b.DOM_VK_ESCAPE)||c){b.type=
"cancel";a.event.handle.apply(this,[b]);return true}}};a.fn.lastclick=a.fn.lastclick||function(b,c){return a(this).binder("lastclick",b,c)};a.event.special.lastclick=a.event.special.lastclick||{setup:function(){a(this).bind("click",a.event.special.lastclick.handler)},teardown:function(){a(this).unbind("click",a.event.special.lastclick.handler)},handler:function(b){var c=function(){var d=a(this),e=d.data("lastclick-timeout")||false;e&&clearTimeout(e);e=false;d.data("lastclick-timeout",e)};(function(d){var e=
this;c.call(e);var f=a(e);f.data("lastclick-clicks",(f.data("lastclick-clicks")||0)+1);var g=setTimeout(function(){var j=f.data("lastclick-clicks");c.apply(e,[d]);f.data("lastclick-clicks",0);d.type="lastclick";a.event.handle.apply(e,[d,j])},500);f.data("lastclick-timeout",g)}).apply(this,[b])}};a.fn.firstclick=a.fn.firstclick||function(b,c){return a(this).binder("firstclick",b,c)};a.event.special.firstclick=a.event.special.firstclick||{setup:function(){a(this).bind("click",a.event.special.firstclick.handler)},
teardown:function(){a(this).unbind("click",a.event.special.firstclick.handler)},handler:function(b){var c=function(){var d=a(this),e=d.data("firstclick-timeout")||false;e&&clearTimeout(e);e=false;d.data("firstclick-timeout",e)};(function(d){var e=this;c.call(e);var f=a(e);f.data("firstclick-clicks",(f.data("firstclick-clicks")||0)+1);if(f.data("firstclick-clicks")===1){d.type="firstclick";a.event.handle.apply(e,[d])}var g=setTimeout(function(){c.apply(e,[d]);f.data("firstclick-clicks",0)},500);f.data("firstclick-timeout",
g)}).apply(this,[b])}};a.fn.singleclick=a.fn.singleclick||function(b,c){return a(this).binder("singleclick",b,c)};a.event.special.singleclick=a.event.special.singleclick||{setup:function(){a(this).bind("click",a.event.special.singleclick.handler)},teardown:function(){a(this).unbind("click",a.event.special.singleclick.handler)},handler:function(b){var c=function(){var d=a(this),e=d.data("singleclick-timeout")||false;e&&clearTimeout(e);e=false;d.data("singleclick-timeout",e)};(function(d){var e=this;
c.call(e);var f=a(e);f.data("singleclick-clicks",(f.data("singleclick-clicks")||0)+1);var g=setTimeout(function(){var j=f.data("singleclick-clicks");c.apply(e,[d]);f.data("singleclick-clicks",0);if(j===1){d.type="singleclick";a.event.handle.apply(e,[d])}},500);f.data("singleclick-timeout",g)}).apply(this,[b])}}})(jQuery);
(function(a){a.prepareObject=a.prepareObject||function(b,c){var d={};a.extend(d,b||{});a.intercept(true,d,c);var e=arguments;e[0]=e[1]="$.prepareObject.skipValue";a.each(e,function(f,g){if(g==="$.prepareObject.skipValue")return true;a.intercept(true,d,g)});return d};a.intercept=a.intercept||function(){var b=arguments,c,d=false,e=false;if(typeof b[0]==="boolean"){d=b[0];b[0]="$.intercept.skipValue";if(typeof b[1]==="boolean"){e=b[1];b[1]="$.intercept.skipValue";if(e)c={};else{c=b[2];b[2]="$.intercept.skipValue"}}else{c=
b[1];b[1]="$.intercept.skipValue"}}else{c=b[0];b[0]="$.intercept.skipValue"}var f={};a.each(c,function(g){f[g]=true});d?a.each(b,function(g,j){if(j==="$.intercept.skipValue")return true;a.each(j,function(k,l){if(typeof f[k]==="undefined")return true;if(typeof l==="object"&&!(l.test||0))a.extend(c[k],l||{});else c[k]=l})}):a.each(b,function(g,j){a.each(j,function(k,l){if(typeof f[k]==="undefined")return true;if(typeof l==="object"&&!(l.test||0))a.intercept(true,c[k],l);else c[k]=l})});return c}})(jQuery);
(function(a){String.prototype.passwordstrength=String.prototype.passwordstrength||function(b,c){var d=this.toString(),e=0;b=b||"";c=c||"";if(d.length<4)return"short";if(c.length&&d.toLowerCase()==c.toLowerCase())return"username";if(b.length&&d!=b)return"mismatch";if(d.match(/[0-9]/))e+=10;if(d.match(/[a-z]/))e+=26;if(d.match(/[A-Z]/))e+=26;if(d.match(/[^a-zA-Z0-9]/))e+=31;d=Math.log(Math.pow(e,d.length))/Math.LN2;if(d<40)return"low";else if(d<56)return"medium";return"high"};if(a.fn.passwordstrength)window.console.warn("$.fn.passwordstrength has already been defined...");
else a.fn.passwordstrength=function(b){var c=a.fn.passwordstrength;c.config=c.config||{content:'<div class="sparkle-passwordstrength-result"></div><div class="sparkle-passwordstrength-description"></div>',contentSelectors:{result:".sparkle-passwordstrength-result",description:".sparkle-passwordstrength-description"},strengthCss:{"short":"invalid",mismatch:"invalid",username:"invalid",low:"low",medium:"medium",high:"high",empty:""},il8n:{description:'Hint: The password should be have a strength of at least medium. To make it stronger, use upper and lower case letters, numbers and symbols like ! " ? $ % ^ &amp; ).',
empty:"Strength indicator",username:"Password should not match username",mismatch:"Confirm password does not match","short":"Password is too short",low:"Weak",medium:"Medium",high:"Strongest"}};var d=a.extend({},c.config);a.extend(true,d,b);b=a(this);var e=b.html(d.content).hide(),f=e.find(d.contentSelectors.result);c=e.find(d.contentSelectors.description).html(d.il8n.description);d.il8n.description||c.remove();var g=[d.strengthCss["short"],d.strengthCss.mismatch,d.strengthCss.username,d.strengthCss.low,
d.strengthCss.medium,d.strengthCss.high,d.strengthCss.empty].join(" "),j=a(d.password),k=a(d.confirm||null),l=a(d.username||null);c=function(){var o=j.val(),h=k.val(),i=l.val();h=o?o.passwordstrength(h,i):"empty";o=d.strengthCss[h];h=d.il8n[h];f.removeClass(g).addClass(o).html(h)};j.keyup(function(){var o=a(this);k.val("");o.val()!==""&&!e.data("shown")&&e.animate({height:"show",opacity:"show"},"slow").data("shown",true)});j.add(k).add(l).keyup(c);c();return b}})(jQuery);
(function(a){if(a.BalClass)window.console.warn("$.BalClass has already been defined...");else{a.BalClass=function(b){this.construct(b)};a.extend(a.BalClass.prototype,{config:{},construct:function(b,c){var d={};if(typeof b==="object"&&typeof c==="object"){d=c;d.config=b||{}}else if(typeof b==="object"){d=b;d.config=d.config||{}}else window.console.error("BalClass.construct: Invalid Input");this.configure(d.config);delete d.config;a.extend(this,d);if(typeof this.built==="function")return this.built();
return true},configure:function(b){this.config=this.config||{};this.config=a.extend({},this.config,b||{});return this},clone:function(b){var c=function(d){this.construct(d)};a.extend(c.prototype,this.prototype,b||{});c.clone=c.prototype.clone;c.create=c.prototype.create;return c},create:function(b){return new this(b)},addConfig:function(b,c){var d=this;if(typeof c==="undefined"){typeof b==="object"&&a.each(b,function(e,f){d.applyConfig(e,f)});return false}else typeof c==="object"&&d.applyConfig(b,
c);return d},applyConfig:function(b,c){this.config[b]=this.config[b]||{};a.extend(true,this.config[b],c||{});return this},setConfig:function(b,c){this.config[b]=c||{};return this},hasConfig:function(b){return typeof this.config[b]!=="undefined"},getConfig:function(b){if(typeof b!=="string")return this.config;return this.getConfigWith(b)},getConfigWith:function(b,c){if(typeof b!=="string"){if(typeof c==="undefined")c=b;b="default"}if(typeof c!=="object")c={};var d={};a.extend(true,d,this.config[b]||
{},c||{});return d},getConfigWithDefault:function(b,c){return this.getConfigWith("default",this.getConfigWith(b,c))},setDefaults:function(b){return this.applyConfig("default",b)}});a.BalClass.clone=a.BalClass.prototype.clone;a.BalClass.create=a.BalClass.prototype.create}})(jQuery);
(function(a){if(a.Bespin)window.console.warn("$.Bespin has already been defined...");else a.Bespin=a.BalClass.create({config:{"default":{content:null,bespin:{settings:{tabstop:4}},toolbar:{fullscreen:true}},rich:{bespin:{syntax:"html"}},html:{bespin:{syntax:"html"}},plain:{toolbar:false}},fn:function(b,c){var d=a.Bespin,e=d.getConfigWithDefault(b,c),f=this;a(window).bind("onBespinLoad",function(){d.useBespin(f,e)});var g={onBespinLoad:function(){a(window).trigger("onBespinLoad")}};if(bespin.bootLoaded)setTimeout(function(){g.onBespinLoad()},
500);else window.onBespinLoad=g.onBespinLoad;return this},useBespin:function(b,c){var d=a.Bespin,e=a(b),f,g;if(e.is("textarea")){g=e.attr("id")+"-bespin";f=a('<div id="'+g+'"/>').html(e.val()).css({height:e.css("height"),width:e.css("width")});f.insertAfter(e);e.hide()}else{f=e;g=f.attr("id")}bespin.useBespin(g,c.bespin).then(function(j){d.postBespin(g,j,c)},function(j){window.console.error("Bespin Launch Failed: "+j)});return this},postBespin:function(b,c,d){var e=a("#"+b),f=e.siblings("textarea"),
g=c.editor;e.css("overflow","hidden");e.wrap('<div class="bespin-wrap" />');var j=e.parent();f.length&&f.parents("form:first").submit(function(){f.val(g.value)});if(d.content||d.content==="")g.value=d.content;if(d.toolbar){b=a('<div class="bespin-toolbar" />');b.insertBefore(e);if(d.toolbar.fullscreen){d=a('<span class="bespin-toolbar-fullscreen" title="Toggle Fullscreen"></span>');d.appendTo(b);d.click(function(){j.hasClass("bespin-fullscreen")?a("body").add(j).removeClass("bespin-fullscreen"):a("body").add(j).addClass("bespin-fullscreen");
c.dimensionsChanged()})}}return this},built:function(){var b=this;a.fn.Bespin=function(c,d){return b.fn.apply(this,[c,d])};return true}})})(jQuery);
(function(a){if(a.Datepicker)window.console.warn("$.Datepicker has already been defined...");else a.Datepicker=a.BalClass.create({config:{"default":{useHtml5:false}},fn:function(b,c){var d=a.Datepicker.getConfigWithDefault(b,c);return a(this).each(function(){var e=a(this);if(e.hasClass("sparkle-date-has"))return this;e.addClass("sparkle-date").addClass("sparkle-date-has");if(d.useHtml5&&Modernizr&&Modernizr.inputtypes.date&&e.attemptTypeChangeTo("date"))return this;e.datepicker(d);return this})},
built:function(){var b=this;a.fn.Datepicker=function(c,d){return b.fn.apply(this,[c,d])};return true}})})(jQuery);
(function(a){if(a.Datetimepicker)window.console.warn("$.Datetimepicker has already been defined...");else a.Datetimepicker=a.BalClass.create({config:{"default":{useHtml5:false,datepickerOptions:{},timepickerOptions:{}},"12hr":{timepickerOptions:{timeConvention:12}},"24hr":{timepickerOptions:{timeConvention:24}}},fn:function(b,c){var d=a.Datetimepicker.getConfigWithDefault(b,c);return a(this).each(function(){var e=a(this);if(e.hasClass("sparkle-datetime-has"))return this;e.addClass("sparkle-datetime").addClass("sparkle-datetime-has");
if(d.useHtml5&&Modernizr&&Modernizr.inputtypes.datetime&&e.attemptTypeChangeTo("datetime"))return this;var f=e.val(),g=new Date,j="",k="";if(f){g.setDatetimestr(f);j=g.getDatestr();k=g.getTimestr()}e.hide();var l=a('<input type="text" class="sparkle-date"/>');f=a('<span class="sparkle-datetime-sep"> @ </span>');var o=a('<input type="text" class="sparkle-time"/>');o.insertAfter(e);f.insertAfter(e);l.insertAfter(e);l.val(j);o.val(k);l.add(o).change(function(){var h=l.val()+" "+o.val();e.val(h).trigger("change")});
l.Datepicker(d.datepickerOptions);o.Timepicker(d.timepickerOptions);return e})},built:function(){var b=this;a.fn.datetimepicker=a.fn.Datetimepicker=function(c,d){return b.fn.apply(this,[c,d])};return true}})})(jQuery);
(function(a){if(a.EventCalendar)window.console.warn("$.EventCalendar has already been defined...");else a.EventCalendar=a.BalClass.create({config:{"default":{ajaxEntriesVariable:"entries",ajaxEntriesUrl:"",ajaxPostData:{},ajaxCache:true,calendarEntries:[],calendarClass:"hasEventCalendar",dayEventClass:"ui-state-active hasEvent",datepickerOptions:{},disableClick:true,domEvents:{}}},fn:function(b,c){var d=a(this);if(d.length>1){d.each(function(){a(this).EventCalendar(b,c)});return this}var e=a.EventCalendar.getConfigWithDefault(b,
c),f={entriesById:{},entriesByYearMonth:{},cacheableByYearMonth:{},isCacheable:function(h,i){return this.cacheableByYearMonth[h+"-"+i]?true:false},setCacheable:function(h,i,m){if(typeof m==="undefined")this.cacheableByYearMonth[h+"-"+i]=m;return this},isYearMonthSet:function(h,i){return typeof this.entriesByYearMonth[h+"-"+i]!=="undefined"},isYearMonthEmpty:function(h,i){return!(typeof this.entriesByYearMonth[h+"-"+i]==="array"&&this.entriesByYearMonth[h+"-"+i].length!==0||typeof this.entriesByYearMonth[h+
"-"+i]==="object"&&!a.isEmptyObject(this.entriesByYearMonth[h+"-"+i]))},getEntriesByYearMonth:function(h,i){return this.entriesByYearMonth[h+"-"+i]||[]},getEntryById:function(h){return this.entriesById[h]||undefined},getDaysInMonth:function(h){return 32-(new Date(h.getFullYear(),h.getMonth(),32)).getDate()},getDate:function(h){var i;if(typeof h==="string")i=new Date(h);else if(typeof h==="number"){i=new Date;i.setTime(h)}else if(typeof h==="object"){i=new Date;i.setTime(h.getTime())}else throw Error("Unknown date format.");
if(isNaN(i)||i.toString()==="Invalid Date"){i=new Date;i.setDatetimestr(h)}return i},addEntries:function(h){var i=this;a.each(h,function(m,n){n.id=n.id||m;i.addEntry(n)});return true},addEntry:function(h){h.start=this.getDate(h.start);h.finish=this.getDate(h.finish);var i=this.getDate(h.start);i.setDate(1);i.setHours(0);i.setMinutes(0);i.setSeconds(0);i.setMilliseconds(0);var m=this.getDate(h.finish);m.setDate(2);m.setHours(0);m.setMinutes(0);m.setSeconds(0);for(m.setMilliseconds(0);i<m;){var n=i.getFullYear(),
p=i.getMonth()+1;if(typeof this.entriesByYearMonth[n+"-"+p]==="undefined")this.entriesByYearMonth[n+"-"+p]={};this.entriesByYearMonth[n+"-"+p][h.id]=h;if(p===11){i.setMonth(0);i.setYear(n+1)}else i.setMonth(p+1)}return this.entriesById[h.id]=h}};f.addEntries(e.calendarEntries);var g=function(h,i,m){var n=f.getEntriesByYearMonth(i,m),p=a(h).find("tbody td"),q=p.find("a");if(e.disableClick){p.unbind("click").removeAttr("onclick");q.removeAttr("href").css("cursor","pointer")}a.each(n,function(J,s){var t=
s.start.getMonth()+1,u=s.finish.getMonth()+1,v=s.start.getDate(),w=s.finish.getDate();v=t==m?q.filter(":contains("+v+"):first"):q.filter(":first");w=u==m?q.filter(":contains("+w+"):first"):q.filter(":last");t=t==m?q.index(v):0;u=u==m?q.index(w):q.length-1;var z=[];z=t==u?v:t==u-1?v.add(w):v.add(q.filter(":lt("+u+")").filter(":gt("+t+")")).add(w);z.addClass(e.dayEventClass).each(function(K,E){var x=a(E);x.text().trim();var r=x.data("dayEntriesIds");if(typeof r==="undefined")r=s.id;else{r=String(r).split(/,/g);
r.push(s.id);r=r.join(",")}x.data("dayEntriesIds",r);a.each(e.domEvents,function(A,F){x.unbind(A).bind(A,function(G){var y=a(this),B=y.text().trim();y=String(y.data("dayEntriesIds")).split(/,/g);var C=new Date;C.setDatestr(i+"-"+m+"-"+B);var D=[];a.each(y,function(L,H){var I=f.getEntryById(H);D.push(I)});F.apply(this,[G,{year:i,month:m,day:B,date:C,dayEntries:D,monthEntries:n,datepicker:h}]);return true})})})});return true},j=function(h,i,m){var n=m.dpDiv||m;if(typeof e.ajaxEntriesUrl==="string"&&
e.ajaxEntriesUrl.length)if(e.ajaxCache&&f.isCacheable(h,i)&&!f.isYearMonthEmpty(h,i))setTimeout(function(){g(n,h,i)},50);else{m=a.extend({},{year:h,month:i},e.ajaxPostData);a.ajax({url:e.ajaxEntriesUrl,method:"post",dataType:"json",data:m,success:function(p){p=p[e.ajaxEntriesVariable]||[];f.setCacheable(h,i,true);if(p.length===0)return true;f.addEntries(p);setTimeout(function(){g(n,h,i)},50);return true},error:function(){window.console.warn("$.EventCalendar.calendarChangeMonthYear.ajax.error:",[this,
arguments])}})}else f.isYearMonthEmpty(h,i)||setTimeout(function(){g(n,h,i)},50);return true},k=false,l=function(h,i,m){if(!k){k=true;a(m).addClass(e.calendarClass);j(h,i,m)}},o=a.extend({},e.datepickerOptions,{onChangeMonthYear:function(h,i,m){j(h,i,m);typeof e.datepickerOptions.onChangeMonthYear==="function"&&l(h,i,m)},beforeShow:function(h,i){datepickerShowed=true;typeof e.datepickerOptions.beforeShow==="function"&&e.datepickerOptions.beforeShow.apply(this,[h,i]);setTimeout(function(){l(i.drawYear,
i.drawMonth+1,i)},1E3)}});d.datepicker(o);setTimeout(function(){var h=d.datepicker("getDate");l(h.getFullYear(),h.getMonth()+1,d)},2E3);return d},built:function(){var b=this;a.fn.EventCalendar=function(c,d){return b.fn.apply(this,[c,d])};return true}})})(jQuery);
(function(a){if(a.Help)window.console.warn("$.Help has already been defined...");else a.Help=a.BalClass.create({config:{"default":{wrap:'<span class="sparkle-help-wrap"/>',icon:'<span class="sparkle-help-icon"/>',text:'<span class="sparkle-help-text"/>',parentClass:"",title:""}},fn:function(b){var c=a.Help;if(typeof b==="string")b={title:b};b=c.getConfigWithDefault("default",b);c=a(this);var d=a(b.wrap),e=a(b.icon),f=a(b.text);c.parent().addClass(b.parentClass);var g=c.contents();c.append(d.append(f).append(e));
g.appendTo(f);c.attr("title",b.title);return c},built:function(){var b=this;a.fn.help=function(c,d){return b.fn.apply(this,[c,d])};return true}})})(jQuery);
(function(a){if(a.Timepicker)window.console.warn("$.Timepicker has already been defined...");else a.Timepicker=a.BalClass.create({config:{"default":{useHtml5:false,timeConvention:12},"12hr":{timeConvention:12},"24hr":{timeConvention:24}},fn:function(b,c){var d=a.Timepicker.getConfigWithDefault(b,c);return a(this).each(function(){var e=a(this);if(e.hasClass("sparkle-time-has"))return this;e.addClass("sparkle-time").addClass("sparkle-time-has");if(d.useHtml5&&Modernizr&&Modernizr.inputtypes.date&&e.attemptTypeChangeTo("time"))return this;
var f=e.val(),g=new Date,j=d.timeConvention,k=12,l=0,o="am";if(f){g.setTimestr(f);k=g.getUTCHours();l=g.getUTCMinutes()}if(j===12&&k>12){o="pm";k-=12}l=l.roundTo(5);if(j===12){if(k>12||k<1){k=1;window.console.warn("timepicker.fn: Invalid Hours.",[this,arguments])}}else if(k>23||k<0){k=1;window.console.warn("timepicker.fn: Invalid Hours.",[this,arguments])}if(l>60||l<0){l=0;window.console.warn("timepicker.fn: Invalid Minutes.",[this,arguments])}e.hide();if(j===12){var h=a('<select class="sparkle-time-meridian" />');
h.append("<option>am</option>");h.append("<option>pm</option>");h.val(o).insertAfter(e)}var i=a('<select class="sparkle-time-minutes" />');for(k=0;k<=55;k+=5)i.append('<option value="'+k+'">'+k.padLeft("0",2)+"</option>");i.val(l).insertAfter(e);var m=a('<select class="sparkle-time-hours" />');if(j===12){k=j;for(l=1;l<=k;++l)m.append('<option value="'+l+'">'+l.padLeft("0",2)+"</option>");m.val(k-1).insertAfter(e)}else{k=j;for(l=0;l<k;++l)m.append('<option value="'+l+'">'+l.padLeft("0",2)+"</option>");
m.val(k).insertAfter(e)}k=function(){var n=parseInt(m.val(),10),p=i.val();if(j===12){var q=h.val();if(n!==12&&q==="pm")n+=12;if(n===12&&q==="am")n=0}n=n.padLeft(0,2)+":"+p.padLeft(0,2)+":00";e.val(n).trigger("change")};m.add(i).add(h).change(k);e.parent("form:first").submit(k);return e})},built:function(){var b=this;a.fn.timepicker=a.fn.Timepicker=function(c,d){return b.fn.apply(this,[c,d])};return true}})})(jQuery);
(function(a){if(a.Tinymce)window.console.warn("$.Tinymce has already been defined...");else a.Tinymce=a.BalClass.create({config:{"default":{script_url:"/scripts/tiny_mce/tiny_mce.js",theme:"advanced",plugins:"autoresize,safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",theme_advanced_buttons1:"bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect,|,code,",
theme_advanced_buttons2:"cut,copy,paste,pastetext,pasteword,|,undo,redo,|,link,unlink,image,|,preview,|,forecolor,backcolor,|,bullist,numlist,|,outdent,indent,blockquote,|,fullscreen",theme_advanced_buttons3:"tablecontrols,|,hr,removeformat,visualaid,|,sub,sup",theme_advanced_toolbar_location:"top",theme_advanced_toolbar_align:"left",theme_advanced_statusbar_location:"bottom",theme_advanced_path:false,theme_advanced_resizing:false,width:"100%",template_replace_values:{}},rich:{},simple:{theme_advanced_buttons2:"",
theme_advanced_buttons3:""}},fn:function(b,c){var d=a.Tinymce.getConfigWithDefault(b,c);return a(this).tinymce(d)},built:function(){var b=this;a.fn.Tinymce=function(c,d){return b.fn.apply(this,[c,d])};return true}})})(jQuery);
(function(a){a(document.body).addClass("js");if(a.Sparkle)window.console.warn("$.Sparkle has already been defined...");else{a.SparkleClass=a.BalClass.clone({addExtension:function(b,c,d){var e=a.Sparkle,f={};switch(true){case Boolean(d||false):if(typeof b==="string"&&typeof d==="function"&&typeof c==="object"){f.extension=d;f.config=c;f.name=b}if(typeof b==="string"&&typeof c==="function"&&typeof d==="object"){f.extension=c;f.config=d;f.name=b}else window.console.error("Sparkle.addExtension: Invalid Input");
break;case Boolean(c||false):if(typeof b==="string"&&typeof c==="function"){f.extension=c;f.name=b}else if(typeof b==="string"&&e.isExtension(c)){f=c;f.name=b}else window.console.error("Sparkle.addExtension: Invalid Input");break;case Boolean(b||false):if(e.isExtension(b))f=b;else typeof b==="object"||typeof b==="array"?a.each(b,function(g,j){e.addExtension(g,j)}):window.console.error("Sparkle.addExtension: Invalid Input");break}f.config=f.config||{};f.extension=f.extension||{};e.addConfig(f.name,
f);return true},cycleExtensions:function(){var b=a.Sparkle,c=b.getExtensions();a.each(c,function(d,e){b.triggerExtension(e)});return true},hasExtension:function(b){return a.Sparkle.getExtension(b)!=="undefined"},isExtension:function(b){return Boolean(b.extension||false)},getExtensions:function(){var b=a.Sparkle,c=b.getConfig(),d={};a.each(c,function(e,f){if(b.isExtension(f))d[e]=f});return d},getExtension:function(b){var c=a.Sparkle,d=undefined;if(c.isExtension(b))d=b;else{b=c.getConfigWithDefault(b);
if(c.isExtension(b))d=b}return d},getExtensionConfig:function(b){return a.Sparkle.getExtension(b).config||{}},applyExtensionConfig:function(b,c){a.Sparkle.applyConfig(b,{config:c});return true},triggerExtension:function(b){var c=a.Sparkle;b=c.getExtension(b);var d=this instanceof jQuery?this:a("body");if(b)return b.extension.apply(d,[c,b.config,b]);return false},fn:function(b){var c=a.Sparkle,d=a(this);b?c.triggerExtension.apply(d,[b]):c.cycleExtensions.apply(d,[]);return d},built:function(){var b=
this;a.fn.sparkle=function(c){return b.fn.apply(this,[c])};a(function(){a(document.body).sparkle()});return true}});a.Sparkle=a.SparkleClass.create({config:{date:{config:{selector:".sparkle-date",datepickerOptions:{},demoText:"Date format must use the international standard: [year-month-day]. This due to other formats being ambigious eg. day/month/year or month/day/year.",demo:'<input type="text" class="sparkle-date" value="2010-08-05" />'},extension:function(b,c){var d=a(this).findAndSelf(c.selector);
if(!d.length)return true;if(typeof d.Datepicker==="undefined"){window.console.warn("Datepicker not loaded. Did you forget to include it?");return false}d.Datepicker(c.datepickerOptions);return true}},time:{config:{selector:".sparkle-time",timepickerOptions:{},demoText:"Time format must be either [hour:minute:second] or [hour:minute], with hours being between 0-23.",demo:'<input type="text" class="sparkle-time" value="23:11" />'},extension:function(b,c){var d=a(this).findAndSelf(c.selector);if(!d.length)return true;
if(typeof d.Timepicker==="undefined"){window.console.warn("Timepicker not loaded. Did you forget to include it?");return false}d.Timepicker(c.timepickerOptions);return true}},datetime:{config:{selector:".sparkle-datetime",datepickerOptions:{},timepickerOptions:{},demoText:"Date format must use the international standard: [year-month-day]. This due to other formats being ambigious eg. day/month/year or month/day/year.<br/>\t\t\t\t\t\t\tTime format must be either [hour:minute:second] or [hour:minute], with hours being between 0-23.",
demo:'<input type="text" class="sparkle-datetime" value="2010-08-05 23:10:09" />'},extension:function(b,c){var d=a(this).findAndSelf(c.selector);if(!d.length)return true;if(typeof d.Datetimepicker==="undefined"){window.console.warn("Datetimepicker not loaded. Did you forget to include it?");return false}d.Datetimepicker({datepickerOptions:b.getExtensionConfig("date").datepickerOptions,timepickerOptions:b.getExtensionConfig("time").timepickerOptions});return true}},"hide-if-empty":{config:{selector:".sparkle-hide-if-empty:empty",
demo:'<div class="sparkle-hide-if-empty" style="border:1px solid black"></div>\n<div class="sparkle-hide-if-empty" style="border:1px solid black">Hello World</div>'},extension:function(b,c){var d=a(this).findAndSelf(c.selector);if(!d.length)return true;d.hide();return true}},hide:{config:{selector:".sparkle-hide",demo:'<div class="sparkle-hide">Something to Hide when Sparkle has Loaded</div>'},extension:function(b,c){var d=a(this).findAndSelf(c.selector);if(!d.length)return true;d.removeClass(c.selector.replace(".",
"")).hide();return true}},show:{config:{selector:".sparkle-show",demo:'<div class="sparkle-show" style="display:none;">Something to Show when Sparkle has Loaded</div>'},extension:function(b,c){var d=a(this).findAndSelf(c.selector);if(!d.length)return true;d.removeClass(c.selector.replace(".","")).show();return true}},subtle:{config:{selector:".sparkle-subtle",css:{},inSpeed:200,inCss:{opacity:1},outSpeed:400,outCss:{opacity:0.5},demo:'<div class="sparkle-subtle">This is some subtle text. (mouseover)</div>'},
extension:function(b,c){var d=a(this).findAndSelf(c.selector);if(!d.length)return true;var e={};a.extend(e,c.outCss,c.css);d.css(e).opacityFix().hover(function(){a(this).stop(true,false).animate(c.inCss,c.inSpeed)},function(){a(this).stop(true,false).animate(c.outCss,c.outSpeed)});return true}},panelshower:{config:{selectorSwitch:".sparkle-panelshower-switch",selectorPanel:".sparkle-panelshower-panel",inSpeed:200,outSpeed:200,demo:""},extension:function(b,c){var d=a(this),e=d.findAndSelf(c.selectorSwitch);
d=d.findAndSelf(c.selectorPanel);if(!e.length&&!d.length)return true;e.once("click",{clickEvent:function(){var f=a(this),g=f.siblings(c.selectorPanel).filter(":first"),j=f.val();f.is(":checked,:selected")&&!(!j||j===0||j==="0"||j==="false"||j===false||j==="no"||j==="off")?g.fadeIn(c.inSpeed):g.fadeOut(c.outSpeed)}}.clickEvent);d.hide();return true}},autogrow:{config:{selector:"textarea.autogrow,textarea.autosize",demo:'<textarea class="autogrow">This textarea will autogrow with your input. - Only if jQuery Autogrow has been loaded.</textarea>'},
extension:function(b,c){var d=a(this).findAndSelf(c.selector);if(!d.length)return true;if(typeof a.fn.autogrow==="undefined"){window.console.warn("autogrow not loaded. Did you forget to include it?");return false}d.autogrow();return true}},gsfnwidget:{config:{selector:".gsfnwidget",demo:'<a class="gsfnwidget" href="#">This link will show a GetSatisfaction Widget onclick. - Only if GetSatisfaction has been loaded.</a>'},extension:function(b,c){var d={clickEvent:function(f){if(typeof GSFN_feedback_widget===
"undefined"){window.console.warn("GSFN not loaded. Did you forget to include it?");return true}GSFN_feedback_widget.show();f.preventDefault();return false}},e=a(this).findAndSelf(c.selector);if(!e.length)return true;e.once("click",d.clickEvent);return true}},hint:{config:{selector:".form-input-tip,.sparkle-hint,.sparkle-hint-has,:text[placeholder]",hasClass:"sparkle-hint-has",hintedClass:"sparkle-hint-hinted",demoText:"Simulates HTML5's <code>placeholder</code> attribute for non HTML5 browsers. Placeholder can be the <code>title</code> or <code>placeholder</code> attribute. Placeholder will not be sent with the form (unlike most other solutions). The <code>sparkle-hint</code> class is optional if you are using the <code>placeholder</code> attribute.",
demo:'<input type="text" class="sparkle-hint" placeholder="This is some hint text." title="This is a title." /><br/>\n<input type="text" class="sparkle-hint" title="This is some hint text." />'},extension:function(b,c){var d=a(this),e=d.findAndSelf(c.selector).addClass(c.hasClass);if(!e.length)return true;var f={focusEvent:function(){var g=a(this),j=g.attr("placeholder")||g.attr("title"),k=g.val();j===k&&g.val("").removeClass(c.hintedClass);return true},blurEvent:function(){var g=a(this),j=g.attr("placeholder")||
g.attr("title"),k=g.val();if(j===k||!k)g.val("").addClass(c.hintedClass).val(j);return true},submitEvent:function(){e.trigger("focus")}};if(typeof Modernizr!=="undefined"&&Modernizr.input.placeholder)e.each(function(){var g=a(this),j=g.attr("title");j&&!g.attr("placeholder")&&g.attr("placeholder",j)});else{e.each(function(){a(this).once("focus",f.focusEvent).once("blur",f.blurEvent).trigger("blur")});d.find("form").once("submit",f.submitEvent)}return d}},debug:{config:{selector:".sparkle-debug",hasClass:"sparkle-debug-has",
hintedClass:"sparkle-debug-hinted",showVar:"sparkle-debug-show",demo:""},extension:function(b,c){var d=a(this);b=a.Sparkle;var e=d.findAndSelf(c.selector);if(!e.length)return true;e.addClass(c.hasClass).find(".value:has(.var)").hide().siblings(".name,.type").addClass("link").once("singleclick",f.clickEvent).once("dblclick",f.dblclickEvent);var f={clickEvent:function(){var g=a(this),j=g.parent(),k=!j.data(c.showVar);j.data(c.showVar,k);g.siblings(".value").toggle(k)},dblclickEvent:function(){var g=
a(this).parent(),j=g.data(c.showVar);g.data(c.showVar,j);g.find(".value").toggle(j)}};return d}},submit:{config:{selector:".sparkle-submit",demoText:"Adding the <code>sparkle-submit</code> class to an element within a <code>form</code> will submit the form when that element is clicked."},extension:function(b,c){var d=a(this);b=a.Sparkle;var e=d.findAndSelf(c.selector);if(!e.length)return true;e.once("singleclick",{clickEvent:function(){a(this).submitForm();return true}}.clickEvent);return d}},submitswap:{config:{selector:".sparkle-submitswap",
demoText:"Adding the <code>sparkle-submitswap</code> class to a submit button, will swap it's value with it's title when it has been clicked. Making it possible for a submit value which isn't the submit button's text."},extension:function(b,c){var d=a(this);b=a.Sparkle;var e=d.findAndSelf(c.selector);if(!e.length)return true;e.once("singleclick",{clickEvent:function(){var f=a(this);f.val(f.data("sparkle-submitswap-value"));return true}}.clickEvent);e.each(function(){var f=a(this);f.data("sparkle-submitswap-value",
f.val());f.val(f.attr("title"));f.removeAttr("title")});return d}},"highlight-values":{config:{selector:".sparkle-highlight-values",innerSelector:"td,.column",empty:["",false,null,"false","null",0,"-"],emptyClass:"sparkle-highlight-values-empty",notemptyClass:"sparkle-highlight-values-notempty",demoText:'Adding the <code>sparkle-highlight-values</code> class to a table will highlight all <code>td</code> elements with non empty values. By adding <code>sparkle-highlight-values-notempty</code> or <code>sparkle-highlight-values-empty</code> to the corresponding <code>td</code> element - which can by styled by yourself. Benefit over css\'s <code>:empty</code> as 0, false, null and - are counted as empty values (not just "").'},
extension:function(b,c){var d=a(this);b=a.Sparkle;var e=d.findAndSelf(c.selector);if(!e.length)return true;e.findAndSelf(c.innerSelector).each(function(){var f=a(this),g=f.text().trim();c.empty.has(g)?f.addClass(c.emptyClass):f.addClass(c.notemptyClass)});return d}},demo:{config:{selector:".sparkle-demo",hasClass:"sparkle-debug-has",demoText:"Adding the <code>sparkle-demo</code> will display all these demo examples used on this page."},extension:function(b,c){var d=a(this);b=a.Sparkle;var e=d.findAndSelf(c.selector);
if(e.hasClass(c.hasClass)||!e.length)return true;e.addClass(c.hasClass);var f=b.getExtensions();a.each(f,function(g,j){var k=j.config.demo||"",l=j.config.demoText||"";if(!k&&!l)return true;var o=a('<div class="sparkle-demo-section" id="sparkle-demo-'+g+'">\t\t\t\t\t\t\t\t\t<h3>'+g+"</h3>\t\t\t\t\t\t\t\t</div>");l&&o.append('<div class="sparkle-demo-text">'+l+"</div>");if(k){l=k.replace(/</g,"&lt;").replace(/>/g,"&gt;");o.append('<h4>Example Code:</h4>\t\t\t\t\t\t\t\t\t<pre class="code language-html sparkle-demo-code">'+
l+'</pre>\t\t\t\t\t\t\t\t\t<h4>Example Result:</h4>\t\t\t\t\t\t\t\t\t<div class="sparkle-demo-result">'+k+"</div>")}o.appendTo(e)});e.sparkle();return d}}}})}})(jQuery);

