/*!
 * jQuery JavaScript Library v1.8.1
 * http://jquery.com/
 *
 * Includes Sizzle.js
 * http://sizzlejs.com/
 *
 * Copyright 2012 jQuery Foundation and other contributors
 * Released under the MIT license
 * http://jquery.org/license
 *
 * Date: Thu Aug 30 2012 17:17:22 GMT-0400 (Eastern Daylight Time)
 */
(function(window,undefined){var
// A central reference to the root jQuery(document)
rootjQuery,
// The deferred used on DOM ready
readyList,
// Use the correct document accordingly with window argument (sandbox)
document=window.document,location=window.location,navigator=window.navigator,
// Map over jQuery in case of overwrite
_jQuery=window.jQuery,
// Map over the $ in case of overwrite
_$=window.$,
// Save a reference to some core methods
core_push=Array.prototype.push,core_slice=Array.prototype.slice,core_indexOf=Array.prototype.indexOf,core_toString=Object.prototype.toString,core_hasOwn=Object.prototype.hasOwnProperty,core_trim=String.prototype.trim,
// Define a local copy of jQuery
jQuery=function(selector,context){
// The jQuery object is actually just the init constructor 'enhanced'
return new jQuery.fn.init(selector,context,rootjQuery)},
// Used for matching numbers
core_pnum=/[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source,
// Used for detecting and trimming whitespace
core_rnotwhite=/\S/,core_rspace=/\s+/,
// Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE)
rtrim=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
// A simple way to check for HTML strings
// Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
rquickExpr=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,
// Match a standalone tag
rsingleTag=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,
// JSON RegExp
rvalidchars=/^[\],:{}\s]*$/,rvalidbraces=/(?:^|:|,)(?:\s*\[)+/g,rvalidescape=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,rvalidtokens=/"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g,
// Matches dashed string for camelizing
rmsPrefix=/^-ms-/,rdashAlpha=/-([\da-z])/gi,
// Used by jQuery.camelCase as callback to replace()
fcamelCase=function(all,letter){return(letter+"").toUpperCase()},
// The ready event handler and self cleanup method
DOMContentLoaded=function(){if(document.addEventListener){document.removeEventListener("DOMContentLoaded",DOMContentLoaded,false);jQuery.ready()}else if(document.readyState==="complete"){
// we're here because readyState === "complete" in oldIE
// which is good enough for us to call the dom ready!
document.detachEvent("onreadystatechange",DOMContentLoaded);jQuery.ready()}},
// [[Class]] -> type pairs
class2type={};jQuery.fn=jQuery.prototype={constructor:jQuery,init:function(selector,context,rootjQuery){var match,elem,ret,doc;
// Handle $(""), $(null), $(undefined), $(false)
if(!selector){return this}
// Handle $(DOMElement)
if(selector.nodeType){this.context=this[0]=selector;this.length=1;return this}
// Handle HTML strings
if(typeof selector==="string"){if(selector.charAt(0)==="<"&&selector.charAt(selector.length-1)===">"&&selector.length>=3){
// Assume that strings that start and end with <> are HTML and skip the regex check
match=[null,selector,null]}else{match=rquickExpr.exec(selector)}
// Match html or make sure no context is specified for #id
if(match&&(match[1]||!context)){
// HANDLE: $(html) -> $(array)
if(match[1]){context=context instanceof jQuery?context[0]:context;doc=context&&context.nodeType?context.ownerDocument||context:document;
// scripts is true for back-compat
selector=jQuery.parseHTML(match[1],doc,true);if(rsingleTag.test(match[1])&&jQuery.isPlainObject(context)){this.attr.call(selector,context,true)}return jQuery.merge(this,selector);
// HANDLE: $(#id)
}else{elem=document.getElementById(match[2]);
// Check parentNode to catch when Blackberry 4.6 returns
// nodes that are no longer in the document #6963
if(elem&&elem.parentNode){
// Handle the case where IE and Opera return items
// by name instead of ID
if(elem.id!==match[2]){return rootjQuery.find(selector)}
// Otherwise, we inject the element directly into the jQuery object
this.length=1;this[0]=elem}this.context=document;this.selector=selector;return this}
// HANDLE: $(expr, $(...))
}else if(!context||context.jquery){return(context||rootjQuery).find(selector);
// HANDLE: $(expr, context)
// (which is just equivalent to: $(context).find(expr)
}else{return this.constructor(context).find(selector)}
// HANDLE: $(function)
// Shortcut for document ready
}else if(jQuery.isFunction(selector)){return rootjQuery.ready(selector)}if(selector.selector!==undefined){this.selector=selector.selector;this.context=selector.context}return jQuery.makeArray(selector,this)},
// Start with an empty selector
selector:"",
// The current version of jQuery being used
jquery:"1.8.1",
// The default length of a jQuery object is 0
length:0,
// The number of elements contained in the matched element set
size:function(){return this.length},toArray:function(){return core_slice.call(this)},
// Get the Nth element in the matched element set OR
// Get the whole matched element set as a clean array
get:function(num){return num==null?
// Return a 'clean' array
this.toArray():
// Return just the object
num<0?this[this.length+num]:this[num]},
// Take an array of elements and push it onto the stack
// (returning the new matched element set)
pushStack:function(elems,name,selector){
// Build a new jQuery matched element set
var ret=jQuery.merge(this.constructor(),elems);
// Add the old object onto the stack (as a reference)
ret.prevObject=this;ret.context=this.context;if(name==="find"){ret.selector=this.selector+(this.selector?" ":"")+selector}else if(name){ret.selector=this.selector+"."+name+"("+selector+")"}
// Return the newly-formed element set
return ret},
// Execute a callback for every element in the matched set.
// (You can seed the arguments with an array of args, but this is
// only used internally.)
each:function(callback,args){return jQuery.each(this,callback,args)},ready:function(fn){
// Add the callback
jQuery.ready.promise().done(fn);return this},eq:function(i){i=+i;return i===-1?this.slice(i):this.slice(i,i+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(core_slice.apply(this,arguments),"slice",core_slice.call(arguments).join(","))},map:function(callback){return this.pushStack(jQuery.map(this,function(elem,i){return callback.call(elem,i,elem)}))},end:function(){return this.prevObject||this.constructor(null)},
// For internal use only.
// Behaves like an Array's method, not like a jQuery method.
push:core_push,sort:[].sort,splice:[].splice};
// Give the init function the jQuery prototype for later instantiation
jQuery.fn.init.prototype=jQuery.fn;jQuery.extend=jQuery.fn.extend=function(){var options,name,src,copy,copyIsArray,clone,target=arguments[0]||{},i=1,length=arguments.length,deep=false;
// Handle a deep copy situation
if(typeof target==="boolean"){deep=target;target=arguments[1]||{};
// skip the boolean and the target
i=2}
// Handle case when target is a string or something (possible in deep copy)
if(typeof target!=="object"&&!jQuery.isFunction(target)){target={}}
// extend jQuery itself if only one argument is passed
if(length===i){target=this;--i}for(;i<length;i++){
// Only deal with non-null/undefined values
if((options=arguments[i])!=null){
// Extend the base object
for(name in options){src=target[name];copy=options[name];
// Prevent never-ending loop
if(target===copy){continue}
// Recurse if we're merging plain objects or arrays
if(deep&&copy&&(jQuery.isPlainObject(copy)||(copyIsArray=jQuery.isArray(copy)))){if(copyIsArray){copyIsArray=false;clone=src&&jQuery.isArray(src)?src:[]}else{clone=src&&jQuery.isPlainObject(src)?src:{}}
// Never move original objects, clone them
target[name]=jQuery.extend(deep,clone,copy);
// Don't bring in undefined values
}else if(copy!==undefined){target[name]=copy}}}}
// Return the modified object
return target};jQuery.extend({noConflict:function(deep){if(window.$===jQuery){window.$=_$}if(deep&&window.jQuery===jQuery){window.jQuery=_jQuery}return jQuery},
// Is the DOM ready to be used? Set to true once it occurs.
isReady:false,
// A counter to track how many items to wait for before
// the ready event fires. See #6781
readyWait:1,
// Hold (or release) the ready event
holdReady:function(hold){if(hold){jQuery.readyWait++}else{jQuery.ready(true)}},
// Handle when the DOM is ready
ready:function(wait){
// Abort if there are pending holds or we're already ready
if(wait===true?--jQuery.readyWait:jQuery.isReady){return}
// Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
if(!document.body){return setTimeout(jQuery.ready,1)}
// Remember that the DOM is ready
jQuery.isReady=true;
// If a normal DOM Ready event fired, decrement, and wait if need be
if(wait!==true&&--jQuery.readyWait>0){return}
// If there are functions bound, to execute
readyList.resolveWith(document,[jQuery]);
// Trigger any bound ready events
if(jQuery.fn.trigger){jQuery(document).trigger("ready").off("ready")}},
// See test/unit/core.js for details concerning isFunction.
// Since version 1.3, DOM methods and functions like alert
// aren't supported. They return false on IE (#2968).
isFunction:function(obj){return jQuery.type(obj)==="function"},isArray:Array.isArray||function(obj){return jQuery.type(obj)==="array"},isWindow:function(obj){return obj!=null&&obj==obj.window},isNumeric:function(obj){return!isNaN(parseFloat(obj))&&isFinite(obj)},type:function(obj){return obj==null?String(obj):class2type[core_toString.call(obj)]||"object"},isPlainObject:function(obj){
// Must be an Object.
// Because of IE, we also have to check the presence of the constructor property.
// Make sure that DOM nodes and window objects don't pass through, as well
if(!obj||jQuery.type(obj)!=="object"||obj.nodeType||jQuery.isWindow(obj)){return false}try{
// Not own constructor property must be Object
if(obj.constructor&&!core_hasOwn.call(obj,"constructor")&&!core_hasOwn.call(obj.constructor.prototype,"isPrototypeOf")){return false}}catch(e){
// IE8,9 Will throw exceptions on certain host objects #9897
return false}
// Own properties are enumerated firstly, so to speed up,
// if last one is own, then all properties are own.
var key;for(key in obj){}return key===undefined||core_hasOwn.call(obj,key)},isEmptyObject:function(obj){var name;for(name in obj){return false}return true},error:function(msg){throw new Error(msg)},
// data: string of html
// context (optional): If specified, the fragment will be created in this context, defaults to document
// scripts (optional): If true, will include scripts passed in the html string
parseHTML:function(data,context,scripts){var parsed;if(!data||typeof data!=="string"){return null}if(typeof context==="boolean"){scripts=context;context=0}context=context||document;
// Single tag
if(parsed=rsingleTag.exec(data)){return[context.createElement(parsed[1])]}parsed=jQuery.buildFragment([data],context,scripts?null:[]);return jQuery.merge([],(parsed.cacheable?jQuery.clone(parsed.fragment):parsed.fragment).childNodes)},parseJSON:function(data){if(!data||typeof data!=="string"){return null}
// Make sure leading/trailing whitespace is removed (IE can't handle it)
data=jQuery.trim(data);
// Attempt to parse using the native JSON parser first
if(window.JSON&&window.JSON.parse){return window.JSON.parse(data)}
// Make sure the incoming data is actual JSON
// Logic borrowed from http://json.org/json2.js
if(rvalidchars.test(data.replace(rvalidescape,"@").replace(rvalidtokens,"]").replace(rvalidbraces,""))){return new Function("return "+data)()}jQuery.error("Invalid JSON: "+data)},
// Cross-browser xml parsing
parseXML:function(data){var xml,tmp;if(!data||typeof data!=="string"){return null}try{if(window.DOMParser){// Standard
tmp=new DOMParser;xml=tmp.parseFromString(data,"text/xml")}else{// IE
xml=new ActiveXObject("Microsoft.XMLDOM");xml.async="false";xml.loadXML(data)}}catch(e){xml=undefined}if(!xml||!xml.documentElement||xml.getElementsByTagName("parsererror").length){jQuery.error("Invalid XML: "+data)}return xml},noop:function(){},
// Evaluates a script in a global context
// Workarounds based on findings by Jim Driscoll
// http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
globalEval:function(data){if(data&&core_rnotwhite.test(data)){
// We use execScript on Internet Explorer
// We use an anonymous function so that context is window
// rather than jQuery in Firefox
(window.execScript||function(data){window["eval"].call(window,data)})(data)}},
// Convert dashed to camelCase; used by the css and data modules
// Microsoft forgot to hump their vendor prefix (#9572)
camelCase:function(string){return string.replace(rmsPrefix,"ms-").replace(rdashAlpha,fcamelCase)},nodeName:function(elem,name){return elem.nodeName&&elem.nodeName.toUpperCase()===name.toUpperCase()},
// args is for internal usage only
each:function(obj,callback,args){var name,i=0,length=obj.length,isObj=length===undefined||jQuery.isFunction(obj);if(args){if(isObj){for(name in obj){if(callback.apply(obj[name],args)===false){break}}}else{for(;i<length;){if(callback.apply(obj[i++],args)===false){break}}}
// A special, fast, case for the most common use of each
}else{if(isObj){for(name in obj){if(callback.call(obj[name],name,obj[name])===false){break}}}else{for(;i<length;){if(callback.call(obj[i],i,obj[i++])===false){break}}}}return obj},
// Use native String.trim function wherever possible
trim:core_trim&&!core_trim.call("\ufeff ")?function(text){return text==null?"":core_trim.call(text)}:
// Otherwise use our own trimming functionality
function(text){return text==null?"":text.toString().replace(rtrim,"")},
// results is for internal usage only
makeArray:function(arr,results){var type,ret=results||[];if(arr!=null){
// The window, strings (and functions) also have 'length'
// Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930
type=jQuery.type(arr);if(arr.length==null||type==="string"||type==="function"||type==="regexp"||jQuery.isWindow(arr)){core_push.call(ret,arr)}else{jQuery.merge(ret,arr)}}return ret},inArray:function(elem,arr,i){var len;if(arr){if(core_indexOf){return core_indexOf.call(arr,elem,i)}len=arr.length;i=i?i<0?Math.max(0,len+i):i:0;for(;i<len;i++){
// Skip accessing in sparse arrays
if(i in arr&&arr[i]===elem){return i}}}return-1},merge:function(first,second){var l=second.length,i=first.length,j=0;if(typeof l==="number"){for(;j<l;j++){first[i++]=second[j]}}else{while(second[j]!==undefined){first[i++]=second[j++]}}first.length=i;return first},grep:function(elems,callback,inv){var retVal,ret=[],i=0,length=elems.length;inv=!!inv;
// Go through the array, only saving the items
// that pass the validator function
for(;i<length;i++){retVal=!!callback(elems[i],i);if(inv!==retVal){ret.push(elems[i])}}return ret},
// arg is for internal usage only
map:function(elems,callback,arg){var value,key,ret=[],i=0,length=elems.length,
// jquery objects are treated as arrays
isArray=elems instanceof jQuery||length!==undefined&&typeof length==="number"&&(length>0&&elems[0]&&elems[length-1]||length===0||jQuery.isArray(elems));
// Go through the array, translating each of the items to their
if(isArray){for(;i<length;i++){value=callback(elems[i],i,arg);if(value!=null){ret[ret.length]=value}}
// Go through every key on the object,
}else{for(key in elems){value=callback(elems[key],key,arg);if(value!=null){ret[ret.length]=value}}}
// Flatten any nested arrays
return ret.concat.apply([],ret)},
// A global GUID counter for objects
guid:1,
// Bind a function to a context, optionally partially applying any
// arguments.
proxy:function(fn,context){var tmp,args,proxy;if(typeof context==="string"){tmp=fn[context];context=fn;fn=tmp}
// Quick check to determine if target is callable, in the spec
// this throws a TypeError, but we will just return undefined.
if(!jQuery.isFunction(fn)){return undefined}
// Simulated bind
args=core_slice.call(arguments,2);proxy=function(){return fn.apply(context,args.concat(core_slice.call(arguments)))};
// Set the guid of unique handler to the same of original handler, so it can be removed
proxy.guid=fn.guid=fn.guid||proxy.guid||jQuery.guid++;return proxy},
// Multifunctional method to get and set values of a collection
// The value/s can optionally be executed if it's a function
access:function(elems,fn,key,value,chainable,emptyGet,pass){var exec,bulk=key==null,i=0,length=elems.length;
// Sets many values
if(key&&typeof key==="object"){for(i in key){jQuery.access(elems,fn,i,key[i],1,emptyGet,value)}chainable=1;
// Sets one value
}else if(value!==undefined){
// Optionally, function values get executed if exec is true
exec=pass===undefined&&jQuery.isFunction(value);if(bulk){
// Bulk operations only iterate when executing function values
if(exec){exec=fn;fn=function(elem,key,value){return exec.call(jQuery(elem),value)};
// Otherwise they run against the entire set
}else{fn.call(elems,value);fn=null}}if(fn){for(;i<length;i++){fn(elems[i],key,exec?value.call(elems[i],i,fn(elems[i],key)):value,pass)}}chainable=1}return chainable?elems:
// Gets
bulk?fn.call(elems):length?fn(elems[0],key):emptyGet},now:function(){return(new Date).getTime()}});jQuery.ready.promise=function(obj){if(!readyList){readyList=jQuery.Deferred();
// Catch cases where $(document).ready() is called after the browser event has already occurred.
// we once tried to use readyState "interactive" here, but it caused issues like the one
// discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15
if(document.readyState==="complete"){
// Handle it asynchronously to allow scripts the opportunity to delay ready
setTimeout(jQuery.ready,1);
// Standards-based browsers support DOMContentLoaded
}else if(document.addEventListener){
// Use the handy event callback
document.addEventListener("DOMContentLoaded",DOMContentLoaded,false);
// A fallback to window.onload, that will always work
window.addEventListener("load",jQuery.ready,false);
// If IE event model is used
}else{
// Ensure firing before onload, maybe late but safe also for iframes
document.attachEvent("onreadystatechange",DOMContentLoaded);
// A fallback to window.onload, that will always work
window.attachEvent("onload",jQuery.ready);
// If IE and not a frame
// continually check to see if the document is ready
var top=false;try{top=window.frameElement==null&&document.documentElement}catch(e){}if(top&&top.doScroll){(function doScrollCheck(){if(!jQuery.isReady){try{
// Use the trick by Diego Perini
// http://javascript.nwbox.com/IEContentLoaded/
top.doScroll("left")}catch(e){return setTimeout(doScrollCheck,50)}
// and execute any waiting functions
jQuery.ready()}})()}}}return readyList.promise(obj)};
// Populate the class2type map
jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(i,name){class2type["[object "+name+"]"]=name.toLowerCase()});
// All jQuery objects should point back to these
rootjQuery=jQuery(document);
// String to Object options format cache
var optionsCache={};
// Convert String-formatted options into Object-formatted ones and store in cache
function createOptions(options){var object=optionsCache[options]={};jQuery.each(options.split(core_rspace),function(_,flag){object[flag]=true});return object}
/*
 * Create a callback list using the following parameters:
 *
 *	options: an optional list of space-separated options that will change how
 *			the callback list behaves or a more traditional option object
 *
 * By default a callback list will act like an event callback list and can be
 * "fired" multiple times.
 *
 * Possible options:
 *
 *	once:			will ensure the callback list can only be fired once (like a Deferred)
 *
 *	memory:			will keep track of previous values and will call any callback added
 *					after the list has been fired right away with the latest "memorized"
 *					values (like a Deferred)
 *
 *	unique:			will ensure a callback can only be added once (no duplicate in the list)
 *
 *	stopOnFalse:	interrupt callings when a callback returns false
 *
 */jQuery.Callbacks=function(options){
// Convert options from String-formatted to Object-formatted if needed
// (we check in cache first)
options=typeof options==="string"?optionsCache[options]||createOptions(options):jQuery.extend({},options);var// Last fire value (for non-forgettable lists)
memory,
// Flag to know if list was already fired
fired,
// Flag to know if list is currently firing
firing,
// First callback to fire (used internally by add and fireWith)
firingStart,
// End of the loop when firing
firingLength,
// Index of currently firing callback (modified by remove if needed)
firingIndex,
// Actual callback list
list=[],
// Stack of fire calls for repeatable lists
stack=!options.once&&[],
// Fire callbacks
fire=function(data){memory=options.memory&&data;fired=true;firingIndex=firingStart||0;firingStart=0;firingLength=list.length;firing=true;for(;list&&firingIndex<firingLength;firingIndex++){if(list[firingIndex].apply(data[0],data[1])===false&&options.stopOnFalse){memory=false;// To prevent further calls using add
break}}firing=false;if(list){if(stack){if(stack.length){fire(stack.shift())}}else if(memory){list=[]}else{self.disable()}}},
// Actual Callbacks object
self={
// Add a callback or a collection of callbacks to the list
add:function(){if(list){
// First, we save the current length
var start=list.length;(function add(args){jQuery.each(args,function(_,arg){var type=jQuery.type(arg);if(type==="function"&&(!options.unique||!self.has(arg))){list.push(arg)}else if(arg&&arg.length&&type!=="string"){
// Inspect recursively
add(arg)}})})(arguments);
// Do we need to add the callbacks to the
// current firing batch?
if(firing){firingLength=list.length;
// With memory, if we're not firing then
// we should call right away
}else if(memory){firingStart=start;fire(memory)}}return this},
// Remove a callback from the list
remove:function(){if(list){jQuery.each(arguments,function(_,arg){var index;while((index=jQuery.inArray(arg,list,index))>-1){list.splice(index,1);
// Handle firing indexes
if(firing){if(index<=firingLength){firingLength--}if(index<=firingIndex){firingIndex--}}}})}return this},
// Control if a given callback is in the list
has:function(fn){return jQuery.inArray(fn,list)>-1},
// Remove all callbacks from the list
empty:function(){list=[];return this},
// Have the list do nothing anymore
disable:function(){list=stack=memory=undefined;return this},
// Is it disabled?
disabled:function(){return!list},
// Lock the list in its current state
lock:function(){stack=undefined;if(!memory){self.disable()}return this},
// Is it locked?
locked:function(){return!stack},
// Call all callbacks with the given context and arguments
fireWith:function(context,args){args=args||[];args=[context,args.slice?args.slice():args];if(list&&(!fired||stack)){if(firing){stack.push(args)}else{fire(args)}}return this},
// Call all the callbacks with the given arguments
fire:function(){self.fireWith(this,arguments);return this},
// To know if the callbacks have already been called at least once
fired:function(){return!!fired}};return self};jQuery.extend({Deferred:function(func){var tuples=[
// action, add listener, listener list, final state
["resolve","done",jQuery.Callbacks("once memory"),"resolved"],["reject","fail",jQuery.Callbacks("once memory"),"rejected"],["notify","progress",jQuery.Callbacks("memory")]],state="pending",promise={state:function(){return state},always:function(){deferred.done(arguments).fail(arguments);return this},then:function(){var fns=arguments;return jQuery.Deferred(function(newDefer){jQuery.each(tuples,function(i,tuple){var action=tuple[0],fn=fns[i];
// deferred[ done | fail | progress ] for forwarding actions to newDefer
deferred[tuple[1]](jQuery.isFunction(fn)?function(){var returned=fn.apply(this,arguments);if(returned&&jQuery.isFunction(returned.promise)){returned.promise().done(newDefer.resolve).fail(newDefer.reject).progress(newDefer.notify)}else{newDefer[action+"With"](this===deferred?newDefer:this,[returned])}}:newDefer[action])});fns=null}).promise()},
// Get a promise for this deferred
// If obj is provided, the promise aspect is added to the object
promise:function(obj){return typeof obj==="object"?jQuery.extend(obj,promise):promise}},deferred={};
// Keep pipe for back-compat
promise.pipe=promise.then;
// Add list-specific methods
jQuery.each(tuples,function(i,tuple){var list=tuple[2],stateString=tuple[3];
// promise[ done | fail | progress ] = list.add
promise[tuple[1]]=list.add;
// Handle state
if(stateString){list.add(function(){
// state = [ resolved | rejected ]
state=stateString;
// [ reject_list | resolve_list ].disable; progress_list.lock
},tuples[i^1][2].disable,tuples[2][2].lock)}
// deferred[ resolve | reject | notify ] = list.fire
deferred[tuple[0]]=list.fire;deferred[tuple[0]+"With"]=list.fireWith});
// Make the deferred a promise
promise.promise(deferred);
// Call given func if any
if(func){func.call(deferred,deferred)}
// All done!
return deferred},
// Deferred helper
when:function(subordinate/* , ..., subordinateN */){var i=0,resolveValues=core_slice.call(arguments),length=resolveValues.length,
// the count of uncompleted subordinates
remaining=length!==1||subordinate&&jQuery.isFunction(subordinate.promise)?length:0,
// the master Deferred. If resolveValues consist of only a single Deferred, just use that.
deferred=remaining===1?subordinate:jQuery.Deferred(),
// Update function for both resolve and progress values
updateFunc=function(i,contexts,values){return function(value){contexts[i]=this;values[i]=arguments.length>1?core_slice.call(arguments):value;if(values===progressValues){deferred.notifyWith(contexts,values)}else if(!--remaining){deferred.resolveWith(contexts,values)}}},progressValues,progressContexts,resolveContexts;
// add listeners to Deferred subordinates; treat others as resolved
if(length>1){progressValues=new Array(length);progressContexts=new Array(length);resolveContexts=new Array(length);for(;i<length;i++){if(resolveValues[i]&&jQuery.isFunction(resolveValues[i].promise)){resolveValues[i].promise().done(updateFunc(i,resolveContexts,resolveValues)).fail(deferred.reject).progress(updateFunc(i,progressContexts,progressValues))}else{--remaining}}}
// if we're not waiting on anything, resolve the master
if(!remaining){deferred.resolveWith(resolveContexts,resolveValues)}return deferred.promise()}});jQuery.support=function(){var support,all,a,select,opt,input,fragment,eventName,i,isSupported,clickFn,div=document.createElement("div");
// Preliminary tests
div.setAttribute("className","t");div.innerHTML="  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";all=div.getElementsByTagName("*");a=div.getElementsByTagName("a")[0];a.style.cssText="top:1px;float:left;opacity:.5";
// Can't get basic test support
if(!all||!all.length||!a){return{}}
// First batch of supports tests
select=document.createElement("select");opt=select.appendChild(document.createElement("option"));input=div.getElementsByTagName("input")[0];support={
// IE strips leading whitespace when .innerHTML is used
leadingWhitespace:div.firstChild.nodeType===3,
// Make sure that tbody elements aren't automatically inserted
// IE will insert them into empty tables
tbody:!div.getElementsByTagName("tbody").length,
// Make sure that link elements get serialized correctly by innerHTML
// This requires a wrapper element in IE
htmlSerialize:!!div.getElementsByTagName("link").length,
// Get the style information from getAttribute
// (IE uses .cssText instead)
style:/top/.test(a.getAttribute("style")),
// Make sure that URLs aren't manipulated
// (IE normalizes it by default)
hrefNormalized:a.getAttribute("href")==="/a",
// Make sure that element opacity exists
// (IE uses filter instead)
// Use a regex to work around a WebKit issue. See #5145
opacity:/^0.5/.test(a.style.opacity),
// Verify style float existence
// (IE uses styleFloat instead of cssFloat)
cssFloat:!!a.style.cssFloat,
// Make sure that if no value is specified for a checkbox
// that it defaults to "on".
// (WebKit defaults to "" instead)
checkOn:input.value==="on",
// Make sure that a selected-by-default option has a working selected property.
// (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
optSelected:opt.selected,
// Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
getSetAttribute:div.className!=="t",
// Tests for enctype support on a form(#6743)
enctype:!!document.createElement("form").enctype,
// Makes sure cloning an html5 element does not cause problems
// Where outerHTML is undefined, this still works
html5Clone:document.createElement("nav").cloneNode(true).outerHTML!=="<:nav></:nav>",
// jQuery.support.boxModel DEPRECATED in 1.8 since we don't support Quirks Mode
boxModel:document.compatMode==="CSS1Compat",
// Will be defined later
submitBubbles:true,changeBubbles:true,focusinBubbles:false,deleteExpando:true,noCloneEvent:true,inlineBlockNeedsLayout:false,shrinkWrapBlocks:false,reliableMarginRight:true,boxSizingReliable:true,pixelPosition:false};
// Make sure checked status is properly cloned
input.checked=true;support.noCloneChecked=input.cloneNode(true).checked;
// Make sure that the options inside disabled selects aren't marked as disabled
// (WebKit marks them as disabled)
select.disabled=true;support.optDisabled=!opt.disabled;
// Test to see if it's possible to delete an expando from an element
// Fails in Internet Explorer
try{delete div.test}catch(e){support.deleteExpando=false}if(!div.addEventListener&&div.attachEvent&&div.fireEvent){div.attachEvent("onclick",clickFn=function(){
// Cloning a node shouldn't copy over any
// bound event handlers (IE does this)
support.noCloneEvent=false});div.cloneNode(true).fireEvent("onclick");div.detachEvent("onclick",clickFn)}
// Check if a radio maintains its value
// after being appended to the DOM
input=document.createElement("input");input.value="t";input.setAttribute("type","radio");support.radioValue=input.value==="t";input.setAttribute("checked","checked");
// #11217 - WebKit loses check when the name is after the checked attribute
input.setAttribute("name","t");div.appendChild(input);fragment=document.createDocumentFragment();fragment.appendChild(div.lastChild);
// WebKit doesn't clone checked state correctly in fragments
support.checkClone=fragment.cloneNode(true).cloneNode(true).lastChild.checked;
// Check if a disconnected checkbox will retain its checked
// value of true after appended to the DOM (IE6/7)
support.appendChecked=input.checked;fragment.removeChild(input);fragment.appendChild(div);
// Technique from Juriy Zaytsev
// http://perfectionkills.com/detecting-event-support-without-browser-sniffing/
// We only care about the case where non-standard event systems
// are used, namely in IE. Short-circuiting here helps us to
// avoid an eval call (in setAttribute) which can cause CSP
// to go haywire. See: https://developer.mozilla.org/en/Security/CSP
if(div.attachEvent){for(i in{submit:true,change:true,focusin:true}){eventName="on"+i;isSupported=eventName in div;if(!isSupported){div.setAttribute(eventName,"return;");isSupported=typeof div[eventName]==="function"}support[i+"Bubbles"]=isSupported}}
// Run tests that need a body at doc ready
jQuery(function(){var container,div,tds,marginDiv,divReset="padding:0;margin:0;border:0;display:block;overflow:hidden;",body=document.getElementsByTagName("body")[0];if(!body){
// Return for frameset docs that don't have a body
return}container=document.createElement("div");container.style.cssText="visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px";body.insertBefore(container,body.firstChild);
// Construct the test element
div=document.createElement("div");container.appendChild(div);
// Check if table cells still have offsetWidth/Height when they are set
// to display:none and there are still other visible table cells in a
// table row; if so, offsetWidth/Height are not reliable for use when
// determining if an element has been hidden directly using
// display:none (it is still safe to use offsets if a parent element is
// hidden; don safety goggles and see bug #4512 for more information).
// (only IE 8 fails this test)
div.innerHTML="<table><tr><td></td><td>t</td></tr></table>";tds=div.getElementsByTagName("td");tds[0].style.cssText="padding:0;margin:0;border:0;display:none";isSupported=tds[0].offsetHeight===0;tds[0].style.display="";tds[1].style.display="none";
// Check if empty table cells still have offsetWidth/Height
// (IE <= 8 fail this test)
support.reliableHiddenOffsets=isSupported&&tds[0].offsetHeight===0;
// Check box-sizing and margin behavior
div.innerHTML="";div.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;";support.boxSizing=div.offsetWidth===4;support.doesNotIncludeMarginInBodyOffset=body.offsetTop!==1;
// NOTE: To any future maintainer, we've window.getComputedStyle
// because jsdom on node.js will break without it.
if(window.getComputedStyle){support.pixelPosition=(window.getComputedStyle(div,null)||{}).top!=="1%";support.boxSizingReliable=(window.getComputedStyle(div,null)||{width:"4px"}).width==="4px";
// Check if div with explicit width and no margin-right incorrectly
// gets computed margin-right based on width of container. For more
// info see bug #3333
// Fails in WebKit before Feb 2011 nightlies
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
marginDiv=document.createElement("div");marginDiv.style.cssText=div.style.cssText=divReset;marginDiv.style.marginRight=marginDiv.style.width="0";div.style.width="1px";div.appendChild(marginDiv);support.reliableMarginRight=!parseFloat((window.getComputedStyle(marginDiv,null)||{}).marginRight)}if(typeof div.style.zoom!=="undefined"){
// Check if natively block-level elements act like inline-block
// elements when setting their display to 'inline' and giving
// them layout
// (IE < 8 does this)
div.innerHTML="";div.style.cssText=divReset+"width:1px;padding:1px;display:inline;zoom:1";support.inlineBlockNeedsLayout=div.offsetWidth===3;
// Check if elements with layout shrink-wrap their children
// (IE 6 does this)
div.style.display="block";div.style.overflow="visible";div.innerHTML="<div></div>";div.firstChild.style.width="5px";support.shrinkWrapBlocks=div.offsetWidth!==3;container.style.zoom=1}
// Null elements to avoid leaks in IE
body.removeChild(container);container=div=tds=marginDiv=null});
// Null elements to avoid leaks in IE
fragment.removeChild(div);all=a=select=opt=input=fragment=div=null;return support}();var rbrace=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,rmultiDash=/([A-Z])/g;jQuery.extend({cache:{},deletedIds:[],
// Please use with caution
uuid:0,
// Unique for each copy of jQuery on the page
// Non-digits removed to match rinlinejQuery
expando:"jQuery"+(jQuery.fn.jquery+Math.random()).replace(/\D/g,""),
// The following elements throw uncatchable exceptions if you
// attempt to add expando properties to them.
noData:{embed:true,
// Ban all objects except for Flash (which handle expandos)
object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:true},hasData:function(elem){elem=elem.nodeType?jQuery.cache[elem[jQuery.expando]]:elem[jQuery.expando];return!!elem&&!isEmptyDataObject(elem)},data:function(elem,name,data,pvt/* Internal Use Only */){if(!jQuery.acceptData(elem)){return}var thisCache,ret,internalKey=jQuery.expando,getByName=typeof name==="string",
// We have to handle DOM nodes and JS objects differently because IE6-7
// can't GC object references properly across the DOM-JS boundary
isNode=elem.nodeType,
// Only DOM nodes need the global jQuery cache; JS object data is
// attached directly to the object so GC can occur automatically
cache=isNode?jQuery.cache:elem,
// Only defining an ID for JS objects if its cache already exists allows
// the code to shortcut on the same path as a DOM node with no cache
id=isNode?elem[internalKey]:elem[internalKey]&&internalKey;
// Avoid doing any more work than we need to when trying to get data on an
// object that has no data at all
if((!id||!cache[id]||!pvt&&!cache[id].data)&&getByName&&data===undefined){return}if(!id){
// Only DOM nodes need a new unique ID for each element since their data
// ends up in the global cache
if(isNode){elem[internalKey]=id=jQuery.deletedIds.pop()||++jQuery.uuid}else{id=internalKey}}if(!cache[id]){cache[id]={};
// Avoids exposing jQuery metadata on plain JS objects when the object
// is serialized using JSON.stringify
if(!isNode){cache[id].toJSON=jQuery.noop}}
// An object can be passed to jQuery.data instead of a key/value pair; this gets
// shallow copied over onto the existing cache
if(typeof name==="object"||typeof name==="function"){if(pvt){cache[id]=jQuery.extend(cache[id],name)}else{cache[id].data=jQuery.extend(cache[id].data,name)}}thisCache=cache[id];
// jQuery data() is stored in a separate object inside the object's internal data
// cache in order to avoid key collisions between internal data and user-defined
// data.
if(!pvt){if(!thisCache.data){thisCache.data={}}thisCache=thisCache.data}if(data!==undefined){thisCache[jQuery.camelCase(name)]=data}
// Check for both converted-to-camel and non-converted data property names
// If a data property was specified
if(getByName){
// First Try to find as-is property data
ret=thisCache[name];
// Test for null|undefined property data
if(ret==null){
// Try to find the camelCased property
ret=thisCache[jQuery.camelCase(name)]}}else{ret=thisCache}return ret},removeData:function(elem,name,pvt/* Internal Use Only */){if(!jQuery.acceptData(elem)){return}var thisCache,i,l,isNode=elem.nodeType,
// See jQuery.data for more information
cache=isNode?jQuery.cache:elem,id=isNode?elem[jQuery.expando]:jQuery.expando;
// If there is already no cache entry for this object, there is no
// purpose in continuing
if(!cache[id]){return}if(name){thisCache=pvt?cache[id]:cache[id].data;if(thisCache){
// Support array or space separated string names for data keys
if(!jQuery.isArray(name)){
// try the string as a key before any manipulation
if(name in thisCache){name=[name]}else{
// split the camel cased version by spaces unless a key with the spaces exists
name=jQuery.camelCase(name);if(name in thisCache){name=[name]}else{name=name.split(" ")}}}for(i=0,l=name.length;i<l;i++){delete thisCache[name[i]]}
// If there is no data left in the cache, we want to continue
// and let the cache object itself get destroyed
if(!(pvt?isEmptyDataObject:jQuery.isEmptyObject)(thisCache)){return}}}
// See jQuery.data for more information
if(!pvt){delete cache[id].data;
// Don't destroy the parent cache unless the internal data object
// had been the only thing left in it
if(!isEmptyDataObject(cache[id])){return}}
// Destroy the cache
if(isNode){jQuery.cleanData([elem],true);
// Use delete when supported for expandos or `cache` is not a window per isWindow (#10080)
}else if(jQuery.support.deleteExpando||cache!=cache.window){delete cache[id];
// When all else fails, null
}else{cache[id]=null}},
// For internal use only.
_data:function(elem,name,data){return jQuery.data(elem,name,data,true)},
// A method for determining if a DOM node can handle the data expando
acceptData:function(elem){var noData=elem.nodeName&&jQuery.noData[elem.nodeName.toLowerCase()];
// nodes accept data unless otherwise specified; rejection can be conditional
return!noData||noData!==true&&elem.getAttribute("classid")===noData}});jQuery.fn.extend({data:function(key,value){var parts,part,attr,name,l,elem=this[0],i=0,data=null;
// Gets all values
if(key===undefined){if(this.length){data=jQuery.data(elem);if(elem.nodeType===1&&!jQuery._data(elem,"parsedAttrs")){attr=elem.attributes;for(l=attr.length;i<l;i++){name=attr[i].name;if(name.indexOf("data-")===0){name=jQuery.camelCase(name.substring(5));dataAttr(elem,name,data[name])}}jQuery._data(elem,"parsedAttrs",true)}}return data}
// Sets multiple values
if(typeof key==="object"){return this.each(function(){jQuery.data(this,key)})}parts=key.split(".",2);parts[1]=parts[1]?"."+parts[1]:"";part=parts[1]+"!";return jQuery.access(this,function(value){if(value===undefined){data=this.triggerHandler("getData"+part,[parts[0]]);
// Try to fetch any internally stored data first
if(data===undefined&&elem){data=jQuery.data(elem,key);data=dataAttr(elem,key,data)}return data===undefined&&parts[1]?this.data(parts[0]):data}parts[1]=value;this.each(function(){var self=jQuery(this);self.triggerHandler("setData"+part,parts);jQuery.data(this,key,value);self.triggerHandler("changeData"+part,parts)})},null,value,arguments.length>1,null,false)},removeData:function(key){return this.each(function(){jQuery.removeData(this,key)})}});function dataAttr(elem,key,data){
// If nothing was found internally, try to fetch any
// data from the HTML5 data-* attribute
if(data===undefined&&elem.nodeType===1){var name="data-"+key.replace(rmultiDash,"-$1").toLowerCase();data=elem.getAttribute(name);if(typeof data==="string"){try{data=data==="true"?true:data==="false"?false:data==="null"?null:
// Only convert to a number if it doesn't change the string
+data+""===data?+data:rbrace.test(data)?jQuery.parseJSON(data):data}catch(e){}
// Make sure we set the data so it isn't changed later
jQuery.data(elem,key,data)}else{data=undefined}}return data}
// checks a cache object for emptiness
function isEmptyDataObject(obj){var name;for(name in obj){
// if the public data object is empty, the private is still empty
if(name==="data"&&jQuery.isEmptyObject(obj[name])){continue}if(name!=="toJSON"){return false}}return true}jQuery.extend({queue:function(elem,type,data){var queue;if(elem){type=(type||"fx")+"queue";queue=jQuery._data(elem,type);
// Speed up dequeue by getting out quickly if this is just a lookup
if(data){if(!queue||jQuery.isArray(data)){queue=jQuery._data(elem,type,jQuery.makeArray(data))}else{queue.push(data)}}return queue||[]}},dequeue:function(elem,type){type=type||"fx";var queue=jQuery.queue(elem,type),startLength=queue.length,fn=queue.shift(),hooks=jQuery._queueHooks(elem,type),next=function(){jQuery.dequeue(elem,type)};
// If the fx queue is dequeued, always remove the progress sentinel
if(fn==="inprogress"){fn=queue.shift();startLength--}if(fn){
// Add a progress sentinel to prevent the fx queue from being
// automatically dequeued
if(type==="fx"){queue.unshift("inprogress")}
// clear up the last queue stop function
delete hooks.stop;fn.call(elem,next,hooks)}if(!startLength&&hooks){hooks.empty.fire()}},
// not intended for public consumption - generates a queueHooks object, or returns the current one
_queueHooks:function(elem,type){var key=type+"queueHooks";return jQuery._data(elem,key)||jQuery._data(elem,key,{empty:jQuery.Callbacks("once memory").add(function(){jQuery.removeData(elem,type+"queue",true);jQuery.removeData(elem,key,true)})})}});jQuery.fn.extend({queue:function(type,data){var setter=2;if(typeof type!=="string"){data=type;type="fx";setter--}if(arguments.length<setter){return jQuery.queue(this[0],type)}return data===undefined?this:this.each(function(){var queue=jQuery.queue(this,type,data);
// ensure a hooks for this queue
jQuery._queueHooks(this,type);if(type==="fx"&&queue[0]!=="inprogress"){jQuery.dequeue(this,type)}})},dequeue:function(type){return this.each(function(){jQuery.dequeue(this,type)})},
// Based off of the plugin by Clint Helfers, with permission.
// http://blindsignals.com/index.php/2009/07/jquery-delay/
delay:function(time,type){time=jQuery.fx?jQuery.fx.speeds[time]||time:time;type=type||"fx";return this.queue(type,function(next,hooks){var timeout=setTimeout(next,time);hooks.stop=function(){clearTimeout(timeout)}})},clearQueue:function(type){return this.queue(type||"fx",[])},
// Get a promise resolved when queues of a certain type
// are emptied (fx is the type by default)
promise:function(type,obj){var tmp,count=1,defer=jQuery.Deferred(),elements=this,i=this.length,resolve=function(){if(!--count){defer.resolveWith(elements,[elements])}};if(typeof type!=="string"){obj=type;type=undefined}type=type||"fx";while(i--){tmp=jQuery._data(elements[i],type+"queueHooks");if(tmp&&tmp.empty){count++;tmp.empty.add(resolve)}}resolve();return defer.promise(obj)}});var nodeHook,boolHook,fixSpecified,rclass=/[\t\r\n]/g,rreturn=/\r/g,rtype=/^(?:button|input)$/i,rfocusable=/^(?:button|input|object|select|textarea)$/i,rclickable=/^a(?:rea|)$/i,rboolean=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,getSetAttribute=jQuery.support.getSetAttribute;jQuery.fn.extend({attr:function(name,value){return jQuery.access(this,jQuery.attr,name,value,arguments.length>1)},removeAttr:function(name){return this.each(function(){jQuery.removeAttr(this,name)})},prop:function(name,value){return jQuery.access(this,jQuery.prop,name,value,arguments.length>1)},removeProp:function(name){name=jQuery.propFix[name]||name;return this.each(function(){
// try/catch handles cases where IE balks (such as removing a property on window)
try{this[name]=undefined;delete this[name]}catch(e){}})},addClass:function(value){var classNames,i,l,elem,setClass,c,cl;if(jQuery.isFunction(value)){return this.each(function(j){jQuery(this).addClass(value.call(this,j,this.className))})}if(value&&typeof value==="string"){classNames=value.split(core_rspace);for(i=0,l=this.length;i<l;i++){elem=this[i];if(elem.nodeType===1){if(!elem.className&&classNames.length===1){elem.className=value}else{setClass=" "+elem.className+" ";for(c=0,cl=classNames.length;c<cl;c++){if(!~setClass.indexOf(" "+classNames[c]+" ")){setClass+=classNames[c]+" "}}elem.className=jQuery.trim(setClass)}}}}return this},removeClass:function(value){var removes,className,elem,c,cl,i,l;if(jQuery.isFunction(value)){return this.each(function(j){jQuery(this).removeClass(value.call(this,j,this.className))})}if(value&&typeof value==="string"||value===undefined){removes=(value||"").split(core_rspace);for(i=0,l=this.length;i<l;i++){elem=this[i];if(elem.nodeType===1&&elem.className){className=(" "+elem.className+" ").replace(rclass," ");
// loop over each item in the removal list
for(c=0,cl=removes.length;c<cl;c++){
// Remove until there is nothing to remove,
while(className.indexOf(" "+removes[c]+" ")>-1){className=className.replace(" "+removes[c]+" "," ")}}elem.className=value?jQuery.trim(className):""}}}return this},toggleClass:function(value,stateVal){var type=typeof value,isBool=typeof stateVal==="boolean";if(jQuery.isFunction(value)){return this.each(function(i){jQuery(this).toggleClass(value.call(this,i,this.className,stateVal),stateVal)})}return this.each(function(){if(type==="string"){
// toggle individual class names
var className,i=0,self=jQuery(this),state=stateVal,classNames=value.split(core_rspace);while(className=classNames[i++]){
// check each className given, space separated list
state=isBool?state:!self.hasClass(className);self[state?"addClass":"removeClass"](className)}}else if(type==="undefined"||type==="boolean"){if(this.className){
// store className if set
jQuery._data(this,"__className__",this.className)}
// toggle whole className
this.className=this.className||value===false?"":jQuery._data(this,"__className__")||""}})},hasClass:function(selector){var className=" "+selector+" ",i=0,l=this.length;for(;i<l;i++){if(this[i].nodeType===1&&(" "+this[i].className+" ").replace(rclass," ").indexOf(className)>-1){return true}}return false},val:function(value){var hooks,ret,isFunction,elem=this[0];if(!arguments.length){if(elem){hooks=jQuery.valHooks[elem.type]||jQuery.valHooks[elem.nodeName.toLowerCase()];if(hooks&&"get"in hooks&&(ret=hooks.get(elem,"value"))!==undefined){return ret}ret=elem.value;return typeof ret==="string"?
// handle most common string cases
ret.replace(rreturn,""):
// handle cases where value is null/undef or number
ret==null?"":ret}return}isFunction=jQuery.isFunction(value);return this.each(function(i){var val,self=jQuery(this);if(this.nodeType!==1){return}if(isFunction){val=value.call(this,i,self.val())}else{val=value}
// Treat null/undefined as ""; convert numbers to string
if(val==null){val=""}else if(typeof val==="number"){val+=""}else if(jQuery.isArray(val)){val=jQuery.map(val,function(value){return value==null?"":value+""})}hooks=jQuery.valHooks[this.type]||jQuery.valHooks[this.nodeName.toLowerCase()];
// If set returns undefined, fall back to normal setting
if(!hooks||!("set"in hooks)||hooks.set(this,val,"value")===undefined){this.value=val}})}});jQuery.extend({valHooks:{option:{get:function(elem){
// attributes.value is undefined in Blackberry 4.7 but
// uses .value. See #6932
var val=elem.attributes.value;return!val||val.specified?elem.value:elem.text}},select:{get:function(elem){var value,i,max,option,index=elem.selectedIndex,values=[],options=elem.options,one=elem.type==="select-one";
// Nothing was selected
if(index<0){return null}
// Loop through all the selected options
i=one?index:0;max=one?index+1:options.length;for(;i<max;i++){option=options[i];
// Don't return options that are disabled or in a disabled optgroup
if(option.selected&&(jQuery.support.optDisabled?!option.disabled:option.getAttribute("disabled")===null)&&(!option.parentNode.disabled||!jQuery.nodeName(option.parentNode,"optgroup"))){
// Get the specific value for the option
value=jQuery(option).val();
// We don't need an array for one selects
if(one){return value}
// Multi-Selects return an array
values.push(value)}}
// Fixes Bug #2551 -- select.val() broken in IE after form.reset()
if(one&&!values.length&&options.length){return jQuery(options[index]).val()}return values},set:function(elem,value){var values=jQuery.makeArray(value);jQuery(elem).find("option").each(function(){this.selected=jQuery.inArray(jQuery(this).val(),values)>=0});if(!values.length){elem.selectedIndex=-1}return values}}},
// Unused in 1.8, left in so attrFn-stabbers won't die; remove in 1.9
attrFn:{},attr:function(elem,name,value,pass){var ret,hooks,notxml,nType=elem.nodeType;
// don't get/set attributes on text, comment and attribute nodes
if(!elem||nType===3||nType===8||nType===2){return}if(pass&&jQuery.isFunction(jQuery.fn[name])){return jQuery(elem)[name](value)}
// Fallback to prop when attributes are not supported
if(typeof elem.getAttribute==="undefined"){return jQuery.prop(elem,name,value)}notxml=nType!==1||!jQuery.isXMLDoc(elem);
// All attributes are lowercase
// Grab necessary hook if one is defined
if(notxml){name=name.toLowerCase();hooks=jQuery.attrHooks[name]||(rboolean.test(name)?boolHook:nodeHook)}if(value!==undefined){if(value===null){jQuery.removeAttr(elem,name);return}else if(hooks&&"set"in hooks&&notxml&&(ret=hooks.set(elem,value,name))!==undefined){return ret}else{elem.setAttribute(name,""+value);return value}}else if(hooks&&"get"in hooks&&notxml&&(ret=hooks.get(elem,name))!==null){return ret}else{ret=elem.getAttribute(name);
// Non-existent attributes return null, we normalize to undefined
return ret===null?undefined:ret}},removeAttr:function(elem,value){var propName,attrNames,name,isBool,i=0;if(value&&elem.nodeType===1){attrNames=value.split(core_rspace);for(;i<attrNames.length;i++){name=attrNames[i];if(name){propName=jQuery.propFix[name]||name;isBool=rboolean.test(name);
// See #9699 for explanation of this approach (setting first, then removal)
// Do not do this for boolean attributes (see #10870)
if(!isBool){jQuery.attr(elem,name,"")}elem.removeAttribute(getSetAttribute?name:propName);
// Set corresponding property to false for boolean attributes
if(isBool&&propName in elem){elem[propName]=false}}}}},attrHooks:{type:{set:function(elem,value){
// We can't allow the type property to be changed (since it causes problems in IE)
if(rtype.test(elem.nodeName)&&elem.parentNode){jQuery.error("type property can't be changed")}else if(!jQuery.support.radioValue&&value==="radio"&&jQuery.nodeName(elem,"input")){
// Setting the type on a radio button after the value resets the value in IE6-9
// Reset value to it's default in case type is set after value
// This is for element creation
var val=elem.value;elem.setAttribute("type",value);if(val){elem.value=val}return value}}},
// Use the value property for back compat
// Use the nodeHook for button elements in IE6/7 (#1954)
value:{get:function(elem,name){if(nodeHook&&jQuery.nodeName(elem,"button")){return nodeHook.get(elem,name)}return name in elem?elem.value:null},set:function(elem,value,name){if(nodeHook&&jQuery.nodeName(elem,"button")){return nodeHook.set(elem,value,name)}
// Does not return so that setAttribute is also used
elem.value=value}}},propFix:{tabindex:"tabIndex",readonly:"readOnly",for:"htmlFor",class:"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(elem,name,value){var ret,hooks,notxml,nType=elem.nodeType;
// don't get/set properties on text, comment and attribute nodes
if(!elem||nType===3||nType===8||nType===2){return}notxml=nType!==1||!jQuery.isXMLDoc(elem);if(notxml){
// Fix name and attach hooks
name=jQuery.propFix[name]||name;hooks=jQuery.propHooks[name]}if(value!==undefined){if(hooks&&"set"in hooks&&(ret=hooks.set(elem,value,name))!==undefined){return ret}else{return elem[name]=value}}else{if(hooks&&"get"in hooks&&(ret=hooks.get(elem,name))!==null){return ret}else{return elem[name]}}},propHooks:{tabIndex:{get:function(elem){
// elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
// http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
var attributeNode=elem.getAttributeNode("tabindex");return attributeNode&&attributeNode.specified?parseInt(attributeNode.value,10):rfocusable.test(elem.nodeName)||rclickable.test(elem.nodeName)&&elem.href?0:undefined}}}});
// Hook for boolean attributes
boolHook={get:function(elem,name){
// Align boolean attributes with corresponding properties
// Fall back to attribute presence where some booleans are not supported
var attrNode,property=jQuery.prop(elem,name);return property===true||typeof property!=="boolean"&&(attrNode=elem.getAttributeNode(name))&&attrNode.nodeValue!==false?name.toLowerCase():undefined},set:function(elem,value,name){var propName;if(value===false){
// Remove boolean attributes when set to false
jQuery.removeAttr(elem,name)}else{
// value is true since we know at this point it's type boolean and not false
// Set boolean attributes to the same name and set the DOM property
propName=jQuery.propFix[name]||name;if(propName in elem){
// Only set the IDL specifically if it already exists on the element
elem[propName]=true}elem.setAttribute(name,name.toLowerCase())}return name}};
// IE6/7 do not support getting/setting some attributes with get/setAttribute
if(!getSetAttribute){fixSpecified={name:true,id:true,coords:true};
// Use this for any attribute in IE6/7
// This fixes almost every IE6/7 issue
nodeHook=jQuery.valHooks.button={get:function(elem,name){var ret;ret=elem.getAttributeNode(name);return ret&&(fixSpecified[name]?ret.value!=="":ret.specified)?ret.value:undefined},set:function(elem,value,name){
// Set the existing or create a new attribute node
var ret=elem.getAttributeNode(name);if(!ret){ret=document.createAttribute(name);elem.setAttributeNode(ret)}return ret.value=value+""}};
// Set width and height to auto instead of 0 on empty string( Bug #8150 )
// This is for removals
jQuery.each(["width","height"],function(i,name){jQuery.attrHooks[name]=jQuery.extend(jQuery.attrHooks[name],{set:function(elem,value){if(value===""){elem.setAttribute(name,"auto");return value}}})});
// Set contenteditable to false on removals(#10429)
// Setting to empty string throws an error as an invalid value
jQuery.attrHooks.contenteditable={get:nodeHook.get,set:function(elem,value,name){if(value===""){value="false"}nodeHook.set(elem,value,name)}}}
// Some attributes require a special call on IE
if(!jQuery.support.hrefNormalized){jQuery.each(["href","src","width","height"],function(i,name){jQuery.attrHooks[name]=jQuery.extend(jQuery.attrHooks[name],{get:function(elem){var ret=elem.getAttribute(name,2);return ret===null?undefined:ret}})})}if(!jQuery.support.style){jQuery.attrHooks.style={get:function(elem){
// Return undefined in the case of empty string
// Normalize to lowercase since IE uppercases css property names
return elem.style.cssText.toLowerCase()||undefined},set:function(elem,value){return elem.style.cssText=""+value}}}
// Safari mis-reports the default selected property of an option
// Accessing the parent's selectedIndex property fixes it
if(!jQuery.support.optSelected){jQuery.propHooks.selected=jQuery.extend(jQuery.propHooks.selected,{get:function(elem){var parent=elem.parentNode;if(parent){parent.selectedIndex;
// Make sure that it also works with optgroups, see #5701
if(parent.parentNode){parent.parentNode.selectedIndex}}return null}})}
// IE6/7 call enctype encoding
if(!jQuery.support.enctype){jQuery.propFix.enctype="encoding"}
// Radios and checkboxes getter/setter
if(!jQuery.support.checkOn){jQuery.each(["radio","checkbox"],function(){jQuery.valHooks[this]={get:function(elem){
// Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified
return elem.getAttribute("value")===null?"on":elem.value}}})}jQuery.each(["radio","checkbox"],function(){jQuery.valHooks[this]=jQuery.extend(jQuery.valHooks[this],{set:function(elem,value){if(jQuery.isArray(value)){return elem.checked=jQuery.inArray(jQuery(elem).val(),value)>=0}}})});var rformElems=/^(?:textarea|input|select)$/i,rtypenamespace=/^([^\.]*|)(?:\.(.+)|)$/,rhoverHack=/(?:^|\s)hover(\.\S+|)\b/,rkeyEvent=/^key/,rmouseEvent=/^(?:mouse|contextmenu)|click/,rfocusMorph=/^(?:focusinfocus|focusoutblur)$/,hoverHack=function(events){return jQuery.event.special.hover?events:events.replace(rhoverHack,"mouseenter$1 mouseleave$1")};
/*
 * Helper functions for managing events -- not part of the public interface.
 * Props to Dean Edwards' addEvent library for many of the ideas.
 */jQuery.event={add:function(elem,types,handler,data,selector){var elemData,eventHandle,events,t,tns,type,namespaces,handleObj,handleObjIn,handlers,special;
// Don't attach events to noData or text/comment nodes (allow plain objects tho)
if(elem.nodeType===3||elem.nodeType===8||!types||!handler||!(elemData=jQuery._data(elem))){return}
// Caller can pass in an object of custom data in lieu of the handler
if(handler.handler){handleObjIn=handler;handler=handleObjIn.handler;selector=handleObjIn.selector}
// Make sure that the handler has a unique ID, used to find/remove it later
if(!handler.guid){handler.guid=jQuery.guid++}
// Init the element's event structure and main handler, if this is the first
events=elemData.events;if(!events){elemData.events=events={}}eventHandle=elemData.handle;if(!eventHandle){elemData.handle=eventHandle=function(e){
// Discard the second event of a jQuery.event.trigger() and
// when an event is called after a page has unloaded
return typeof jQuery!=="undefined"&&(!e||jQuery.event.triggered!==e.type)?jQuery.event.dispatch.apply(eventHandle.elem,arguments):undefined};
// Add elem as a property of the handle fn to prevent a memory leak with IE non-native events
eventHandle.elem=elem}
// Handle multiple events separated by a space
// jQuery(...).bind("mouseover mouseout", fn);
types=jQuery.trim(hoverHack(types)).split(" ");for(t=0;t<types.length;t++){tns=rtypenamespace.exec(types[t])||[];type=tns[1];namespaces=(tns[2]||"").split(".").sort();
// If event changes its type, use the special event handlers for the changed type
special=jQuery.event.special[type]||{};
// If selector defined, determine special event api type, otherwise given type
type=(selector?special.delegateType:special.bindType)||type;
// Update special based on newly reset type
special=jQuery.event.special[type]||{};
// handleObj is passed to all event handlers
handleObj=jQuery.extend({type:type,origType:tns[1],data:data,handler:handler,guid:handler.guid,selector:selector,namespace:namespaces.join(".")},handleObjIn);
// Init the event handler queue if we're the first
handlers=events[type];if(!handlers){handlers=events[type]=[];handlers.delegateCount=0;
// Only use addEventListener/attachEvent if the special events handler returns false
if(!special.setup||special.setup.call(elem,data,namespaces,eventHandle)===false){
// Bind the global event handler to the element
if(elem.addEventListener){elem.addEventListener(type,eventHandle,false)}else if(elem.attachEvent){elem.attachEvent("on"+type,eventHandle)}}}if(special.add){special.add.call(elem,handleObj);if(!handleObj.handler.guid){handleObj.handler.guid=handler.guid}}
// Add to the element's handler list, delegates in front
if(selector){handlers.splice(handlers.delegateCount++,0,handleObj)}else{handlers.push(handleObj)}
// Keep track of which events have ever been used, for event optimization
jQuery.event.global[type]=true}
// Nullify elem to prevent memory leaks in IE
elem=null},global:{},
// Detach an event or set of events from an element
remove:function(elem,types,handler,selector,mappedTypes){var t,tns,type,origType,namespaces,origCount,j,events,special,eventType,handleObj,elemData=jQuery.hasData(elem)&&jQuery._data(elem);if(!elemData||!(events=elemData.events)){return}
// Once for each type.namespace in types; type may be omitted
types=jQuery.trim(hoverHack(types||"")).split(" ");for(t=0;t<types.length;t++){tns=rtypenamespace.exec(types[t])||[];type=origType=tns[1];namespaces=tns[2];
// Unbind all events (on this namespace, if provided) for the element
if(!type){for(type in events){jQuery.event.remove(elem,type+types[t],handler,selector,true)}continue}special=jQuery.event.special[type]||{};type=(selector?special.delegateType:special.bindType)||type;eventType=events[type]||[];origCount=eventType.length;namespaces=namespaces?new RegExp("(^|\\.)"+namespaces.split(".").sort().join("\\.(?:.*\\.|)")+"(\\.|$)"):null;
// Remove matching events
for(j=0;j<eventType.length;j++){handleObj=eventType[j];if((mappedTypes||origType===handleObj.origType)&&(!handler||handler.guid===handleObj.guid)&&(!namespaces||namespaces.test(handleObj.namespace))&&(!selector||selector===handleObj.selector||selector==="**"&&handleObj.selector)){eventType.splice(j--,1);if(handleObj.selector){eventType.delegateCount--}if(special.remove){special.remove.call(elem,handleObj)}}}
// Remove generic event handler if we removed something and no more handlers exist
// (avoids potential for endless recursion during removal of special event handlers)
if(eventType.length===0&&origCount!==eventType.length){if(!special.teardown||special.teardown.call(elem,namespaces,elemData.handle)===false){jQuery.removeEvent(elem,type,elemData.handle)}delete events[type]}}
// Remove the expando if it's no longer used
if(jQuery.isEmptyObject(events)){delete elemData.handle;
// removeData also checks for emptiness and clears the expando if empty
// so use it instead of delete
jQuery.removeData(elem,"events",true)}},
// Events that are safe to short-circuit if no handlers are attached.
// Native DOM events should not be added, they may have inline handlers.
customEvent:{getData:true,setData:true,changeData:true},trigger:function(event,data,elem,onlyHandlers){
// Don't do events on text and comment nodes
if(elem&&(elem.nodeType===3||elem.nodeType===8)){return}
// Event object or event type
var cache,exclusive,i,cur,old,ontype,special,handle,eventPath,bubbleType,type=event.type||event,namespaces=[];
// focus/blur morphs to focusin/out; ensure we're not firing them right now
if(rfocusMorph.test(type+jQuery.event.triggered)){return}if(type.indexOf("!")>=0){
// Exclusive events trigger only for the exact event (no namespaces)
type=type.slice(0,-1);exclusive=true}if(type.indexOf(".")>=0){
// Namespaced trigger; create a regexp to match event type in handle()
namespaces=type.split(".");type=namespaces.shift();namespaces.sort()}if((!elem||jQuery.event.customEvent[type])&&!jQuery.event.global[type]){
// No jQuery handlers for this event type, and it can't have inline handlers
return}
// Caller can pass in an Event, Object, or just an event type string
event=typeof event==="object"?
// jQuery.Event object
event[jQuery.expando]?event:
// Object literal
new jQuery.Event(type,event):
// Just the event type (string)
new jQuery.Event(type);event.type=type;event.isTrigger=true;event.exclusive=exclusive;event.namespace=namespaces.join(".");event.namespace_re=event.namespace?new RegExp("(^|\\.)"+namespaces.join("\\.(?:.*\\.|)")+"(\\.|$)"):null;ontype=type.indexOf(":")<0?"on"+type:"";
// Handle a global trigger
if(!elem){
// TODO: Stop taunting the data cache; remove global events and always attach to document
cache=jQuery.cache;for(i in cache){if(cache[i].events&&cache[i].events[type]){jQuery.event.trigger(event,data,cache[i].handle.elem,true)}}return}
// Clean up the event in case it is being reused
event.result=undefined;if(!event.target){event.target=elem}
// Clone any incoming data and prepend the event, creating the handler arg list
data=data!=null?jQuery.makeArray(data):[];data.unshift(event);
// Allow special events to draw outside the lines
special=jQuery.event.special[type]||{};if(special.trigger&&special.trigger.apply(elem,data)===false){return}
// Determine event propagation path in advance, per W3C events spec (#9951)
// Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
eventPath=[[elem,special.bindType||type]];if(!onlyHandlers&&!special.noBubble&&!jQuery.isWindow(elem)){bubbleType=special.delegateType||type;cur=rfocusMorph.test(bubbleType+type)?elem:elem.parentNode;for(old=elem;cur;cur=cur.parentNode){eventPath.push([cur,bubbleType]);old=cur}
// Only add window if we got to document (e.g., not plain obj or detached DOM)
if(old===(elem.ownerDocument||document)){eventPath.push([old.defaultView||old.parentWindow||window,bubbleType])}}
// Fire handlers on the event path
for(i=0;i<eventPath.length&&!event.isPropagationStopped();i++){cur=eventPath[i][0];event.type=eventPath[i][1];handle=(jQuery._data(cur,"events")||{})[event.type]&&jQuery._data(cur,"handle");if(handle){handle.apply(cur,data)}
// Note that this is a bare JS function and not a jQuery handler
handle=ontype&&cur[ontype];if(handle&&jQuery.acceptData(cur)&&handle.apply(cur,data)===false){event.preventDefault()}}event.type=type;
// If nobody prevented the default action, do it now
if(!onlyHandlers&&!event.isDefaultPrevented()){if((!special._default||special._default.apply(elem.ownerDocument,data)===false)&&!(type==="click"&&jQuery.nodeName(elem,"a"))&&jQuery.acceptData(elem)){
// Call a native DOM method on the target with the same name name as the event.
// Can't use an .isFunction() check here because IE6/7 fails that test.
// Don't do default actions on window, that's where global variables be (#6170)
// IE<9 dies on focus/blur to hidden element (#1486)
if(ontype&&elem[type]&&(type!=="focus"&&type!=="blur"||event.target.offsetWidth!==0)&&!jQuery.isWindow(elem)){
// Don't re-trigger an onFOO event when we call its FOO() method
old=elem[ontype];if(old){elem[ontype]=null}
// Prevent re-triggering of the same event, since we already bubbled it above
jQuery.event.triggered=type;elem[type]();jQuery.event.triggered=undefined;if(old){elem[ontype]=old}}}}return event.result},dispatch:function(event){
// Make a writable jQuery.Event from the native event object
event=jQuery.event.fix(event||window.event);var i,j,cur,ret,selMatch,matched,matches,handleObj,sel,related,handlers=(jQuery._data(this,"events")||{})[event.type]||[],delegateCount=handlers.delegateCount,args=[].slice.call(arguments),run_all=!event.exclusive&&!event.namespace,special=jQuery.event.special[event.type]||{},handlerQueue=[];
// Use the fix-ed jQuery.Event rather than the (read-only) native event
args[0]=event;event.delegateTarget=this;
// Call the preDispatch hook for the mapped type, and let it bail if desired
if(special.preDispatch&&special.preDispatch.call(this,event)===false){return}
// Determine handlers that should run if there are delegated events
// Avoid non-left-click bubbling in Firefox (#3861)
if(delegateCount&&!(event.button&&event.type==="click")){for(cur=event.target;cur!=this;cur=cur.parentNode||this){
// Don't process clicks (ONLY) on disabled elements (#6911, #8165, #11382, #11764)
if(cur.disabled!==true||event.type!=="click"){selMatch={};matches=[];for(i=0;i<delegateCount;i++){handleObj=handlers[i];sel=handleObj.selector;if(selMatch[sel]===undefined){selMatch[sel]=jQuery(sel,this).index(cur)>=0}if(selMatch[sel]){matches.push(handleObj)}}if(matches.length){handlerQueue.push({elem:cur,matches:matches})}}}}
// Add the remaining (directly-bound) handlers
if(handlers.length>delegateCount){handlerQueue.push({elem:this,matches:handlers.slice(delegateCount)})}
// Run delegates first; they may want to stop propagation beneath us
for(i=0;i<handlerQueue.length&&!event.isPropagationStopped();i++){matched=handlerQueue[i];event.currentTarget=matched.elem;for(j=0;j<matched.matches.length&&!event.isImmediatePropagationStopped();j++){handleObj=matched.matches[j];
// Triggered event must either 1) be non-exclusive and have no namespace, or
// 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace).
if(run_all||!event.namespace&&!handleObj.namespace||event.namespace_re&&event.namespace_re.test(handleObj.namespace)){event.data=handleObj.data;event.handleObj=handleObj;ret=((jQuery.event.special[handleObj.origType]||{}).handle||handleObj.handler).apply(matched.elem,args);if(ret!==undefined){event.result=ret;if(ret===false){event.preventDefault();event.stopPropagation()}}}}}
// Call the postDispatch hook for the mapped type
if(special.postDispatch){special.postDispatch.call(this,event)}return event.result},
// Includes some event props shared by KeyEvent and MouseEvent
// *** attrChange attrName relatedNode srcElement  are not normalized, non-W3C, deprecated, will be removed in 1.8 ***
props:"attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(event,original){
// Add which for key events
if(event.which==null){event.which=original.charCode!=null?original.charCode:original.keyCode}return event}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(event,original){var eventDoc,doc,body,button=original.button,fromElement=original.fromElement;
// Calculate pageX/Y if missing and clientX/Y available
if(event.pageX==null&&original.clientX!=null){eventDoc=event.target.ownerDocument||document;doc=eventDoc.documentElement;body=eventDoc.body;event.pageX=original.clientX+(doc&&doc.scrollLeft||body&&body.scrollLeft||0)-(doc&&doc.clientLeft||body&&body.clientLeft||0);event.pageY=original.clientY+(doc&&doc.scrollTop||body&&body.scrollTop||0)-(doc&&doc.clientTop||body&&body.clientTop||0)}
// Add relatedTarget, if necessary
if(!event.relatedTarget&&fromElement){event.relatedTarget=fromElement===event.target?original.toElement:fromElement}
// Add which for click: 1 === left; 2 === middle; 3 === right
// Note: button is not normalized, so don't use it
if(!event.which&&button!==undefined){event.which=button&1?1:button&2?3:button&4?2:0}return event}},fix:function(event){if(event[jQuery.expando]){return event}
// Create a writable copy of the event object and normalize some properties
var i,prop,originalEvent=event,fixHook=jQuery.event.fixHooks[event.type]||{},copy=fixHook.props?this.props.concat(fixHook.props):this.props;event=jQuery.Event(originalEvent);for(i=copy.length;i;){prop=copy[--i];event[prop]=originalEvent[prop]}
// Fix target property, if necessary (#1925, IE 6/7/8 & Safari2)
if(!event.target){event.target=originalEvent.srcElement||document}
// Target should not be a text node (#504, Safari)
if(event.target.nodeType===3){event.target=event.target.parentNode}
// For mouse/key events, metaKey==false if it's undefined (#3368, #11328; IE6/7/8)
event.metaKey=!!event.metaKey;return fixHook.filter?fixHook.filter(event,originalEvent):event},special:{load:{
// Prevent triggered image.load events from bubbling to window.load
noBubble:true},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(data,namespaces,eventHandle){
// We only want to do this special case on windows
if(jQuery.isWindow(this)){this.onbeforeunload=eventHandle}},teardown:function(namespaces,eventHandle){if(this.onbeforeunload===eventHandle){this.onbeforeunload=null}}}},simulate:function(type,elem,event,bubble){
// Piggyback on a donor event to simulate a different one.
// Fake originalEvent to avoid donor's stopPropagation, but if the
// simulated event prevents default then we do the same on the donor.
var e=jQuery.extend(new jQuery.Event,event,{type:type,isSimulated:true,originalEvent:{}});if(bubble){jQuery.event.trigger(e,null,elem)}else{jQuery.event.dispatch.call(elem,e)}if(e.isDefaultPrevented()){event.preventDefault()}}};
// Some plugins are using, but it's undocumented/deprecated and will be removed.
// The 1.7 special event interface should provide all the hooks needed now.
jQuery.event.handle=jQuery.event.dispatch;jQuery.removeEvent=document.removeEventListener?function(elem,type,handle){if(elem.removeEventListener){elem.removeEventListener(type,handle,false)}}:function(elem,type,handle){var name="on"+type;if(elem.detachEvent){
// #8545, #7054, preventing memory leaks for custom events in IE6-8 –
// detachEvent needed property on element, by name of that event, to properly expose it to GC
if(typeof elem[name]==="undefined"){elem[name]=null}elem.detachEvent(name,handle)}};jQuery.Event=function(src,props){
// Allow instantiation without the 'new' keyword
if(!(this instanceof jQuery.Event)){return new jQuery.Event(src,props)}
// Event object
if(src&&src.type){this.originalEvent=src;this.type=src.type;
// Events bubbling up the document may have been marked as prevented
// by a handler lower down the tree; reflect the correct value.
this.isDefaultPrevented=src.defaultPrevented||src.returnValue===false||src.getPreventDefault&&src.getPreventDefault()?returnTrue:returnFalse;
// Event type
}else{this.type=src}
// Put explicitly provided properties onto the event object
if(props){jQuery.extend(this,props)}
// Create a timestamp if incoming event doesn't have one
this.timeStamp=src&&src.timeStamp||jQuery.now();
// Mark it as fixed
this[jQuery.expando]=true};function returnFalse(){return false}function returnTrue(){return true}
// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
jQuery.Event.prototype={preventDefault:function(){this.isDefaultPrevented=returnTrue;var e=this.originalEvent;if(!e){return}
// if preventDefault exists run it on the original event
if(e.preventDefault){e.preventDefault();
// otherwise set the returnValue property of the original event to false (IE)
}else{e.returnValue=false}},stopPropagation:function(){this.isPropagationStopped=returnTrue;var e=this.originalEvent;if(!e){return}
// if stopPropagation exists run it on the original event
if(e.stopPropagation){e.stopPropagation()}
// otherwise set the cancelBubble property of the original event to true (IE)
e.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=returnTrue;this.stopPropagation()},isDefaultPrevented:returnFalse,isPropagationStopped:returnFalse,isImmediatePropagationStopped:returnFalse};
// Create mouseenter/leave events using mouseover/out and event-time checks
jQuery.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(orig,fix){jQuery.event.special[orig]={delegateType:fix,bindType:fix,handle:function(event){var ret,target=this,related=event.relatedTarget,handleObj=event.handleObj,selector=handleObj.selector;
// For mousenter/leave call the handler if related is outside the target.
// NB: No relatedTarget if the mouse left/entered the browser window
if(!related||related!==target&&!jQuery.contains(target,related)){event.type=handleObj.origType;ret=handleObj.handler.apply(this,arguments);event.type=fix}return ret}}});
// IE submit delegation
if(!jQuery.support.submitBubbles){jQuery.event.special.submit={setup:function(){
// Only need this for delegated form submit events
if(jQuery.nodeName(this,"form")){return false}
// Lazy-add a submit handler when a descendant form may potentially be submitted
jQuery.event.add(this,"click._submit keypress._submit",function(e){
// Node name check avoids a VML-related crash in IE (#9807)
var elem=e.target,form=jQuery.nodeName(elem,"input")||jQuery.nodeName(elem,"button")?elem.form:undefined;if(form&&!jQuery._data(form,"_submit_attached")){jQuery.event.add(form,"submit._submit",function(event){event._submit_bubble=true});jQuery._data(form,"_submit_attached",true)}});
// return undefined since we don't need an event listener
},postDispatch:function(event){
// If form was submitted by the user, bubble the event up the tree
if(event._submit_bubble){delete event._submit_bubble;if(this.parentNode&&!event.isTrigger){jQuery.event.simulate("submit",this.parentNode,event,true)}}},teardown:function(){
// Only need this for delegated form submit events
if(jQuery.nodeName(this,"form")){return false}
// Remove delegated handlers; cleanData eventually reaps submit handlers attached above
jQuery.event.remove(this,"._submit")}}}
// IE change delegation and checkbox/radio fix
if(!jQuery.support.changeBubbles){jQuery.event.special.change={setup:function(){if(rformElems.test(this.nodeName)){
// IE doesn't fire change on a check/radio until blur; trigger it on click
// after a propertychange. Eat the blur-change in special.change.handle.
// This still fires onchange a second time for check/radio after blur.
if(this.type==="checkbox"||this.type==="radio"){jQuery.event.add(this,"propertychange._change",function(event){if(event.originalEvent.propertyName==="checked"){this._just_changed=true}});jQuery.event.add(this,"click._change",function(event){if(this._just_changed&&!event.isTrigger){this._just_changed=false}
// Allow triggered, simulated change events (#11500)
jQuery.event.simulate("change",this,event,true)})}return false}
// Delegated event; lazy-add a change handler on descendant inputs
jQuery.event.add(this,"beforeactivate._change",function(e){var elem=e.target;if(rformElems.test(elem.nodeName)&&!jQuery._data(elem,"_change_attached")){jQuery.event.add(elem,"change._change",function(event){if(this.parentNode&&!event.isSimulated&&!event.isTrigger){jQuery.event.simulate("change",this.parentNode,event,true)}});jQuery._data(elem,"_change_attached",true)}})},handle:function(event){var elem=event.target;
// Swallow native change events from checkbox/radio, we already triggered them above
if(this!==elem||event.isSimulated||event.isTrigger||elem.type!=="radio"&&elem.type!=="checkbox"){return event.handleObj.handler.apply(this,arguments)}},teardown:function(){jQuery.event.remove(this,"._change");return!rformElems.test(this.nodeName)}}}
// Create "bubbling" focus and blur events
if(!jQuery.support.focusinBubbles){jQuery.each({focus:"focusin",blur:"focusout"},function(orig,fix){
// Attach a single capturing handler while someone wants focusin/focusout
var attaches=0,handler=function(event){jQuery.event.simulate(fix,event.target,jQuery.event.fix(event),true)};jQuery.event.special[fix]={setup:function(){if(attaches++===0){document.addEventListener(orig,handler,true)}},teardown:function(){if(--attaches===0){document.removeEventListener(orig,handler,true)}}}})}jQuery.fn.extend({on:function(types,selector,data,fn,/*INTERNAL*/one){var origFn,type;
// Types can be a map of types/handlers
if(typeof types==="object"){
// ( types-Object, selector, data )
if(typeof selector!=="string"){// && selector != null
// ( types-Object, data )
data=data||selector;selector=undefined}for(type in types){this.on(type,selector,data,types[type],one)}return this}if(data==null&&fn==null){
// ( types, fn )
fn=selector;data=selector=undefined}else if(fn==null){if(typeof selector==="string"){
// ( types, selector, fn )
fn=data;data=undefined}else{
// ( types, data, fn )
fn=data;data=selector;selector=undefined}}if(fn===false){fn=returnFalse}else if(!fn){return this}if(one===1){origFn=fn;fn=function(event){
// Can use an empty set, since event contains the info
jQuery().off(event);return origFn.apply(this,arguments)};
// Use same guid so caller can remove using origFn
fn.guid=origFn.guid||(origFn.guid=jQuery.guid++)}return this.each(function(){jQuery.event.add(this,types,fn,data,selector)})},one:function(types,selector,data,fn){return this.on(types,selector,data,fn,1)},off:function(types,selector,fn){var handleObj,type;if(types&&types.preventDefault&&types.handleObj){
// ( event )  dispatched jQuery.Event
handleObj=types.handleObj;jQuery(types.delegateTarget).off(handleObj.namespace?handleObj.origType+"."+handleObj.namespace:handleObj.origType,handleObj.selector,handleObj.handler);return this}if(typeof types==="object"){
// ( types-object [, selector] )
for(type in types){this.off(type,selector,types[type])}return this}if(selector===false||typeof selector==="function"){
// ( types [, fn] )
fn=selector;selector=undefined}if(fn===false){fn=returnFalse}return this.each(function(){jQuery.event.remove(this,types,fn,selector)})},bind:function(types,data,fn){return this.on(types,null,data,fn)},unbind:function(types,fn){return this.off(types,null,fn)},live:function(types,data,fn){jQuery(this.context).on(types,this.selector,data,fn);return this},die:function(types,fn){jQuery(this.context).off(types,this.selector||"**",fn);return this},delegate:function(selector,types,data,fn){return this.on(types,selector,data,fn)},undelegate:function(selector,types,fn){
// ( namespace ) or ( selector, types [, fn] )
return arguments.length==1?this.off(selector,"**"):this.off(types,selector||"**",fn)},trigger:function(type,data){return this.each(function(){jQuery.event.trigger(type,data,this)})},triggerHandler:function(type,data){if(this[0]){return jQuery.event.trigger(type,data,this[0],true)}},toggle:function(fn){
// Save reference to arguments for access in closure
var args=arguments,guid=fn.guid||jQuery.guid++,i=0,toggler=function(event){
// Figure out which function to execute
var lastToggle=(jQuery._data(this,"lastToggle"+fn.guid)||0)%i;jQuery._data(this,"lastToggle"+fn.guid,lastToggle+1);
// Make sure that clicks stop
event.preventDefault();
// and execute the function
return args[lastToggle].apply(this,arguments)||false};
// link all the functions, so any of them can unbind this click handler
toggler.guid=guid;while(i<args.length){args[i++].guid=guid}return this.click(toggler)},hover:function(fnOver,fnOut){return this.mouseenter(fnOver).mouseleave(fnOut||fnOver)}});jQuery.each(("blur focus focusin focusout load resize scroll unload click dblclick "+"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave "+"change select submit keydown keypress keyup error contextmenu").split(" "),function(i,name){
// Handle event binding
jQuery.fn[name]=function(data,fn){if(fn==null){fn=data;data=null}return arguments.length>0?this.on(name,null,data,fn):this.trigger(name)};if(rkeyEvent.test(name)){jQuery.event.fixHooks[name]=jQuery.event.keyHooks}if(rmouseEvent.test(name)){jQuery.event.fixHooks[name]=jQuery.event.mouseHooks}});
/*!
 * Sizzle CSS Selector Engine
 *  Copyright 2012 jQuery Foundation and other contributors
 *  Released under the MIT license
 *  http://sizzlejs.com/
 */
(function(window,undefined){var dirruns,cachedruns,assertGetIdNotName,Expr,getText,isXML,contains,compile,sortOrder,hasDuplicate,baseHasDuplicate=true,strundefined="undefined",expando=("sizcache"+Math.random()).replace(".",""),document=window.document,docElem=document.documentElement,done=0,slice=[].slice,push=[].push,
// Augment a function for special use by Sizzle
markFunction=function(fn,value){fn[expando]=value||true;return fn},createCache=function(){var cache={},keys=[];return markFunction(function(key,value){
// Only keep the most recent entries
if(keys.push(key)>Expr.cacheLength){delete cache[keys.shift()]}return cache[key]=value},cache)},classCache=createCache(),tokenCache=createCache(),compilerCache=createCache(),
// Regex
// Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace
whitespace="[\\x20\\t\\r\\n\\f]",
// http://www.w3.org/TR/css3-syntax/#characters
characterEncoding="(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+",
// Loosely modeled on CSS identifier characters
// An unquoted value should be a CSS identifier (http://www.w3.org/TR/css3-selectors/#attribute-selectors)
// Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
identifier=characterEncoding.replace("w","w#"),
// Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors
operators="([*^$|!~]?=)",attributes="\\["+whitespace+"*("+characterEncoding+")"+whitespace+"*(?:"+operators+whitespace+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+identifier+")|)|)"+whitespace+"*\\]",
// Prefer arguments not in parens/brackets,
//   then attribute selectors and non-pseudos (denoted by :),
//   then anything else
// These preferences are here to reduce the number of selectors
//   needing tokenize in the PSEUDO preFilter
pseudos=":("+characterEncoding+")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|([^()[\\]]*|(?:(?:"+attributes+")|[^:]|\\\\.)*|.*))\\)|)",
// For matchExpr.POS and matchExpr.needsContext
pos=":(nth|eq|gt|lt|first|last|even|odd)(?:\\(((?:-\\d)?\\d*)\\)|)(?=[^-]|$)",
// Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
rtrim=new RegExp("^"+whitespace+"+|((?:^|[^\\\\])(?:\\\\.)*)"+whitespace+"+$","g"),rcomma=new RegExp("^"+whitespace+"*,"+whitespace+"*"),rcombinators=new RegExp("^"+whitespace+"*([\\x20\\t\\r\\n\\f>+~])"+whitespace+"*"),rpseudo=new RegExp(pseudos),
// Easily-parseable/retrievable ID or TAG or CLASS selectors
rquickExpr=/^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/,rnot=/^:not/,rsibling=/[\x20\t\r\n\f]*[+~]/,rendsWithNot=/:not\($/,rheader=/h\d/i,rinputs=/input|select|textarea|button/i,rbackslash=/\\(?!\\)/g,matchExpr={ID:new RegExp("^#("+characterEncoding+")"),CLASS:new RegExp("^\\.("+characterEncoding+")"),NAME:new RegExp("^\\[name=['\"]?("+characterEncoding+")['\"]?\\]"),TAG:new RegExp("^("+characterEncoding.replace("w","w*")+")"),ATTR:new RegExp("^"+attributes),PSEUDO:new RegExp("^"+pseudos),CHILD:new RegExp("^:(only|nth|last|first)-child(?:\\("+whitespace+"*(even|odd|(([+-]|)(\\d*)n|)"+whitespace+"*(?:([+-]|)"+whitespace+"*(\\d+)|))"+whitespace+"*\\)|)","i"),POS:new RegExp(pos,"ig"),
// For use in libraries implementing .is()
needsContext:new RegExp("^"+whitespace+"*[>+~]|"+pos,"i")},
// Support
// Used for testing something on an element
assert=function(fn){var div=document.createElement("div");try{return fn(div)}catch(e){return false}finally{
// release memory in IE
div=null}},
// Check if getElementsByTagName("*") returns only elements
assertTagNameNoComments=assert(function(div){div.appendChild(document.createComment(""));return!div.getElementsByTagName("*").length}),
// Check if getAttribute returns normalized href attributes
assertHrefNotNormalized=assert(function(div){div.innerHTML="<a href='#'></a>";return div.firstChild&&typeof div.firstChild.getAttribute!==strundefined&&div.firstChild.getAttribute("href")==="#"}),
// Check if attributes should be retrieved by attribute nodes
assertAttributes=assert(function(div){div.innerHTML="<select></select>";var type=typeof div.lastChild.getAttribute("multiple");
// IE8 returns a string for some attributes even when not present
return type!=="boolean"&&type!=="string"}),
// Check if getElementsByClassName can be trusted
assertUsableClassName=assert(function(div){
// Opera can't find a second classname (in 9.6)
div.innerHTML="<div class='hidden e'></div><div class='hidden'></div>";if(!div.getElementsByClassName||!div.getElementsByClassName("e").length){return false}
// Safari 3.2 caches class attributes and doesn't catch changes
div.lastChild.className="e";return div.getElementsByClassName("e").length===2}),
// Check if getElementById returns elements by name
// Check if getElementsByName privileges form controls or returns elements by ID
assertUsableName=assert(function(div){
// Inject content
div.id=expando+0;div.innerHTML="<a name='"+expando+"'></a><div name='"+expando+"'></div>";docElem.insertBefore(div,docElem.firstChild);
// Test
var pass=document.getElementsByName&&
// buggy browsers will return fewer than the correct 2
document.getElementsByName(expando).length===2+
// buggy browsers will return more than the correct 0
document.getElementsByName(expando+0).length;assertGetIdNotName=!document.getElementById(expando);
// Cleanup
docElem.removeChild(div);return pass});
// If slice is not available, provide a backup
try{slice.call(docElem.childNodes,0)[0].nodeType}catch(e){slice=function(i){var elem,results=[];for(;elem=this[i];i++){results.push(elem)}return results}}function Sizzle(selector,context,results,seed){results=results||[];context=context||document;var match,elem,xml,m,nodeType=context.nodeType;if(nodeType!==1&&nodeType!==9){return[]}if(!selector||typeof selector!=="string"){return results}xml=isXML(context);if(!xml&&!seed){if(match=rquickExpr.exec(selector)){
// Speed-up: Sizzle("#ID")
if(m=match[1]){if(nodeType===9){elem=context.getElementById(m);
// Check parentNode to catch when Blackberry 4.6 returns
// nodes that are no longer in the document #6963
if(elem&&elem.parentNode){
// Handle the case where IE, Opera, and Webkit return items
// by name instead of ID
if(elem.id===m){results.push(elem);return results}}else{return results}}else{
// Context is not a document
if(context.ownerDocument&&(elem=context.ownerDocument.getElementById(m))&&contains(context,elem)&&elem.id===m){results.push(elem);return results}}
// Speed-up: Sizzle("TAG")
}else if(match[2]){push.apply(results,slice.call(context.getElementsByTagName(selector),0));return results;
// Speed-up: Sizzle(".CLASS")
}else if((m=match[3])&&assertUsableClassName&&context.getElementsByClassName){push.apply(results,slice.call(context.getElementsByClassName(m),0));return results}}}
// All others
return select(selector,context,results,seed,xml)}Sizzle.matches=function(expr,elements){return Sizzle(expr,null,null,elements)};Sizzle.matchesSelector=function(elem,expr){return Sizzle(expr,null,null,[elem]).length>0};
// Returns a function to use in pseudos for input types
function createInputPseudo(type){return function(elem){var name=elem.nodeName.toLowerCase();return name==="input"&&elem.type===type}}
// Returns a function to use in pseudos for buttons
function createButtonPseudo(type){return function(elem){var name=elem.nodeName.toLowerCase();return(name==="input"||name==="button")&&elem.type===type}}
/**
 * Utility function for retrieving the text value of an array of DOM nodes
 * @param {Array|Element} elem
 */getText=Sizzle.getText=function(elem){var node,ret="",i=0,nodeType=elem.nodeType;if(nodeType){if(nodeType===1||nodeType===9||nodeType===11){
// Use textContent for elements
// innerText usage removed for consistency of new lines (see #11153)
if(typeof elem.textContent==="string"){return elem.textContent}else{
// Traverse its children
for(elem=elem.firstChild;elem;elem=elem.nextSibling){ret+=getText(elem)}}}else if(nodeType===3||nodeType===4){return elem.nodeValue}
// Do not include comment or processing instruction nodes
}else{
// If no nodeType, this is expected to be an array
for(;node=elem[i];i++){
// Do not traverse comment nodes
ret+=getText(node)}}return ret};isXML=Sizzle.isXML=function isXML(elem){
// documentElement is verified for cases where it doesn't yet exist
// (such as loading iframes in IE - #4833)
var documentElement=elem&&(elem.ownerDocument||elem).documentElement;return documentElement?documentElement.nodeName!=="HTML":false};
// Element contains another
contains=Sizzle.contains=docElem.contains?function(a,b){var adown=a.nodeType===9?a.documentElement:a,bup=b&&b.parentNode;return a===bup||!!(bup&&bup.nodeType===1&&adown.contains&&adown.contains(bup))}:docElem.compareDocumentPosition?function(a,b){return b&&!!(a.compareDocumentPosition(b)&16)}:function(a,b){while(b=b.parentNode){if(b===a){return true}}return false};Sizzle.attr=function(elem,name){var attr,xml=isXML(elem);if(!xml){name=name.toLowerCase()}if(Expr.attrHandle[name]){return Expr.attrHandle[name](elem)}if(assertAttributes||xml){return elem.getAttribute(name)}attr=elem.getAttributeNode(name);return attr?typeof elem[name]==="boolean"?elem[name]?name:null:attr.specified?attr.value:null:null};Expr=Sizzle.selectors={
// Can be adjusted by the user
cacheLength:50,createPseudo:markFunction,match:matchExpr,order:new RegExp("ID|TAG"+(assertUsableName?"|NAME":"")+(assertUsableClassName?"|CLASS":"")),
// IE6/7 return a modified href
attrHandle:assertHrefNotNormalized?{}:{href:function(elem){return elem.getAttribute("href",2)},type:function(elem){return elem.getAttribute("type")}},find:{ID:assertGetIdNotName?function(id,context,xml){if(typeof context.getElementById!==strundefined&&!xml){var m=context.getElementById(id);
// Check parentNode to catch when Blackberry 4.6 returns
// nodes that are no longer in the document #6963
return m&&m.parentNode?[m]:[]}}:function(id,context,xml){if(typeof context.getElementById!==strundefined&&!xml){var m=context.getElementById(id);return m?m.id===id||typeof m.getAttributeNode!==strundefined&&m.getAttributeNode("id").value===id?[m]:undefined:[]}},TAG:assertTagNameNoComments?function(tag,context){if(typeof context.getElementsByTagName!==strundefined){return context.getElementsByTagName(tag)}}:function(tag,context){var results=context.getElementsByTagName(tag);
// Filter out possible comments
if(tag==="*"){var elem,tmp=[],i=0;for(;elem=results[i];i++){if(elem.nodeType===1){tmp.push(elem)}}return tmp}return results},NAME:function(tag,context){if(typeof context.getElementsByName!==strundefined){return context.getElementsByName(name)}},CLASS:function(className,context,xml){if(typeof context.getElementsByClassName!==strundefined&&!xml){return context.getElementsByClassName(className)}}},relative:{">":{dir:"parentNode",first:true}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:true},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(match){match[1]=match[1].replace(rbackslash,"");
// Move the given value to match[3] whether quoted or unquoted
match[3]=(match[4]||match[5]||"").replace(rbackslash,"");if(match[2]==="~="){match[3]=" "+match[3]+" "}return match.slice(0,4)},CHILD:function(match){
/* matches from matchExpr.CHILD
				1 type (only|nth|...)
				2 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
				3 xn-component of xn+y argument ([+-]?\d*n|)
				4 sign of xn-component
				5 x of xn-component
				6 sign of y-component
				7 y of y-component
			*/
match[1]=match[1].toLowerCase();if(match[1]==="nth"){
// nth-child requires argument
if(!match[2]){Sizzle.error(match[0])}
// numeric x and y parameters for Expr.filter.CHILD
// remember that false/true cast respectively to 0/1
match[3]=+(match[3]?match[4]+(match[5]||1):2*(match[2]==="even"||match[2]==="odd"));match[4]=+(match[6]+match[7]||match[2]==="odd");
// other types prohibit arguments
}else if(match[2]){Sizzle.error(match[0])}return match},PSEUDO:function(match,context,xml){var unquoted,excess;if(matchExpr["CHILD"].test(match[0])){return null}if(match[3]){match[2]=match[3]}else if(unquoted=match[4]){
// Only check arguments that contain a pseudo
if(rpseudo.test(unquoted)&&(
// Get excess from tokenize (recursively)
excess=tokenize(unquoted,context,xml,true))&&(
// advance to the next closing parenthesis
excess=unquoted.indexOf(")",unquoted.length-excess)-unquoted.length)){
// excess is a negative index
unquoted=unquoted.slice(0,excess);match[0]=match[0].slice(0,excess)}match[2]=unquoted}
// Return only captures needed by the pseudo filter method (type and argument)
return match.slice(0,3)}},filter:{ID:assertGetIdNotName?function(id){id=id.replace(rbackslash,"");return function(elem){return elem.getAttribute("id")===id}}:function(id){id=id.replace(rbackslash,"");return function(elem){var node=typeof elem.getAttributeNode!==strundefined&&elem.getAttributeNode("id");return node&&node.value===id}},TAG:function(nodeName){if(nodeName==="*"){return function(){return true}}nodeName=nodeName.replace(rbackslash,"").toLowerCase();return function(elem){return elem.nodeName&&elem.nodeName.toLowerCase()===nodeName}},CLASS:function(className){var pattern=classCache[expando][className];if(!pattern){pattern=classCache(className,new RegExp("(^|"+whitespace+")"+className+"("+whitespace+"|$)"))}return function(elem){return pattern.test(elem.className||typeof elem.getAttribute!==strundefined&&elem.getAttribute("class")||"")}},ATTR:function(name,operator,check){if(!operator){return function(elem){return Sizzle.attr(elem,name)!=null}}return function(elem){var result=Sizzle.attr(elem,name),value=result+"";if(result==null){return operator==="!="}switch(operator){case"=":return value===check;case"!=":return value!==check;case"^=":return check&&value.indexOf(check)===0;case"*=":return check&&value.indexOf(check)>-1;case"$=":return check&&value.substr(value.length-check.length)===check;case"~=":return(" "+value+" ").indexOf(check)>-1;case"|=":return value===check||value.substr(0,check.length+1)===check+"-"}}},CHILD:function(type,argument,first,last){if(type==="nth"){var doneName=done++;return function(elem){var parent,diff,count=0,node=elem;if(first===1&&last===0){return true}parent=elem.parentNode;if(parent&&(parent[expando]!==doneName||!elem.sizset)){for(node=parent.firstChild;node;node=node.nextSibling){if(node.nodeType===1){node.sizset=++count;if(node===elem){break}}}parent[expando]=doneName}diff=elem.sizset-last;if(first===0){return diff===0}else{return diff%first===0&&diff/first>=0}}}return function(elem){var node=elem;switch(type){case"only":case"first":while(node=node.previousSibling){if(node.nodeType===1){return false}}if(type==="first"){return true}node=elem;
/* falls through */case"last":while(node=node.nextSibling){if(node.nodeType===1){return false}}return true}}},PSEUDO:function(pseudo,argument,context,xml){
// pseudo-class names are case-insensitive
// http://www.w3.org/TR/selectors/#pseudo-classes
// Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
var args,fn=Expr.pseudos[pseudo]||Expr.pseudos[pseudo.toLowerCase()];if(!fn){Sizzle.error("unsupported pseudo: "+pseudo)}
// The user may use createPseudo to indicate that
// arguments are needed to create the filter function
// just as Sizzle does
if(!fn[expando]){if(fn.length>1){args=[pseudo,pseudo,"",argument];return function(elem){return fn(elem,0,args)}}return fn}return fn(argument,context,xml)}},pseudos:{not:markFunction(function(selector,context,xml){
// Trim the selector passed to compile
// to avoid treating leading and trailing
// spaces as combinators
var matcher=compile(selector.replace(rtrim,"$1"),context,xml);return function(elem){return!matcher(elem)}}),enabled:function(elem){return elem.disabled===false},disabled:function(elem){return elem.disabled===true},checked:function(elem){
// In CSS3, :checked should return both checked and selected elements
// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
var nodeName=elem.nodeName.toLowerCase();return nodeName==="input"&&!!elem.checked||nodeName==="option"&&!!elem.selected},selected:function(elem){
// Accessing this property makes selected-by-default
// options in Safari work properly
if(elem.parentNode){elem.parentNode.selectedIndex}return elem.selected===true},parent:function(elem){return!Expr.pseudos["empty"](elem)},empty:function(elem){
// http://www.w3.org/TR/selectors/#empty-pseudo
// :empty is only affected by element nodes and content nodes(including text(3), cdata(4)),
//   not comment, processing instructions, or others
// Thanks to Diego Perini for the nodeName shortcut
//   Greater than "@" means alpha characters (specifically not starting with "#" or "?")
var nodeType;elem=elem.firstChild;while(elem){if(elem.nodeName>"@"||(nodeType=elem.nodeType)===3||nodeType===4){return false}elem=elem.nextSibling}return true},contains:markFunction(function(text){return function(elem){return(elem.textContent||elem.innerText||getText(elem)).indexOf(text)>-1}}),has:markFunction(function(selector){return function(elem){return Sizzle(selector,elem).length>0}}),header:function(elem){return rheader.test(elem.nodeName)},text:function(elem){var type,attr;
// IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)
// use getAttribute instead to test this case
return elem.nodeName.toLowerCase()==="input"&&(type=elem.type)==="text"&&((attr=elem.getAttribute("type"))==null||attr.toLowerCase()===type)},
// Input types
radio:createInputPseudo("radio"),checkbox:createInputPseudo("checkbox"),file:createInputPseudo("file"),password:createInputPseudo("password"),image:createInputPseudo("image"),submit:createButtonPseudo("submit"),reset:createButtonPseudo("reset"),button:function(elem){var name=elem.nodeName.toLowerCase();return name==="input"&&elem.type==="button"||name==="button"},input:function(elem){return rinputs.test(elem.nodeName)},focus:function(elem){var doc=elem.ownerDocument;return elem===doc.activeElement&&(!doc.hasFocus||doc.hasFocus())&&!!(elem.type||elem.href)},active:function(elem){return elem===elem.ownerDocument.activeElement}},setFilters:{first:function(elements,argument,not){return not?elements.slice(1):[elements[0]]},last:function(elements,argument,not){var elem=elements.pop();return not?elements:[elem]},even:function(elements,argument,not){var results=[],i=not?1:0,len=elements.length;for(;i<len;i=i+2){results.push(elements[i])}return results},odd:function(elements,argument,not){var results=[],i=not?0:1,len=elements.length;for(;i<len;i=i+2){results.push(elements[i])}return results},lt:function(elements,argument,not){return not?elements.slice(+argument):elements.slice(0,+argument)},gt:function(elements,argument,not){return not?elements.slice(0,+argument+1):elements.slice(+argument+1)},eq:function(elements,argument,not){var elem=elements.splice(+argument,1);return not?elements:elem}}};function siblingCheck(a,b,ret){if(a===b){return ret}var cur=a.nextSibling;while(cur){if(cur===b){return-1}cur=cur.nextSibling}return 1}sortOrder=docElem.compareDocumentPosition?function(a,b){if(a===b){hasDuplicate=true;return 0}return(!a.compareDocumentPosition||!b.compareDocumentPosition?a.compareDocumentPosition:a.compareDocumentPosition(b)&4)?-1:1}:function(a,b){
// The nodes are identical, we can exit early
if(a===b){hasDuplicate=true;return 0;
// Fallback to using sourceIndex (in IE) if it's available on both nodes
}else if(a.sourceIndex&&b.sourceIndex){return a.sourceIndex-b.sourceIndex}var al,bl,ap=[],bp=[],aup=a.parentNode,bup=b.parentNode,cur=aup;
// If the nodes are siblings (or identical) we can do a quick check
if(aup===bup){return siblingCheck(a,b);
// If no parents were found then the nodes are disconnected
}else if(!aup){return-1}else if(!bup){return 1}
// Otherwise they're somewhere else in the tree so we need
// to build up a full list of the parentNodes for comparison
while(cur){ap.unshift(cur);cur=cur.parentNode}cur=bup;while(cur){bp.unshift(cur);cur=cur.parentNode}al=ap.length;bl=bp.length;
// Start walking down the tree looking for a discrepancy
for(var i=0;i<al&&i<bl;i++){if(ap[i]!==bp[i]){return siblingCheck(ap[i],bp[i])}}
// We ended someplace up the tree so do a sibling check
return i===al?siblingCheck(a,bp[i],-1):siblingCheck(ap[i],b,1)};
// Always assume the presence of duplicates if sort doesn't
// pass them to our comparison function (as in Google Chrome).
[0,0].sort(sortOrder);baseHasDuplicate=!hasDuplicate;
// Document sorting and removing duplicates
Sizzle.uniqueSort=function(results){var elem,i=1;hasDuplicate=baseHasDuplicate;results.sort(sortOrder);if(hasDuplicate){for(;elem=results[i];i++){if(elem===results[i-1]){results.splice(i--,1)}}}return results};Sizzle.error=function(msg){throw new Error("Syntax error, unrecognized expression: "+msg)};function tokenize(selector,context,xml,parseOnly){var matched,match,tokens,type,soFar,groups,group,i,preFilters,filters,checkContext=!xml&&context!==document,
// Token cache should maintain spaces
key=(checkContext?"<s>":"")+selector.replace(rtrim,"$1<s>"),cached=tokenCache[expando][key];if(cached){return parseOnly?0:slice.call(cached,0)}soFar=selector;groups=[];i=0;preFilters=Expr.preFilter;filters=Expr.filter;while(soFar){
// Comma and first run
if(!matched||(match=rcomma.exec(soFar))){if(match){soFar=soFar.slice(match[0].length);tokens.selector=group}groups.push(tokens=[]);group="";
// Need to make sure we're within a narrower context if necessary
// Adding a descendant combinator will generate what is needed
if(checkContext){soFar=" "+soFar}}matched=false;
// Combinators
if(match=rcombinators.exec(soFar)){group+=match[0];soFar=soFar.slice(match[0].length);
// Cast descendant combinators to space
matched=tokens.push({part:match.pop().replace(rtrim," "),string:match[0],captures:match})}
// Filters
for(type in filters){if((match=matchExpr[type].exec(soFar))&&(!preFilters[type]||(match=preFilters[type](match,context,xml)))){group+=match[0];soFar=soFar.slice(match[0].length);matched=tokens.push({part:type,string:match.shift(),captures:match})}}if(!matched){break}}
// Attach the full group as a selector
if(group){tokens.selector=group}
// Return the length of the invalid excess
// if we're just parsing
// Otherwise, throw an error or return tokens
return parseOnly?soFar.length:soFar?Sizzle.error(selector):
// Cache the tokens
slice.call(tokenCache(key,groups),0)}function addCombinator(matcher,combinator,context,xml){var dir=combinator.dir,doneName=done++;if(!matcher){
// If there is no matcher to check, check against the context
matcher=function(elem){return elem===context}}return combinator.first?function(elem){while(elem=elem[dir]){if(elem.nodeType===1){return matcher(elem)&&elem}}}:xml?function(elem){while(elem=elem[dir]){if(elem.nodeType===1){if(matcher(elem)){return elem}}}}:function(elem){var cache,dirkey=doneName+"."+dirruns,cachedkey=dirkey+"."+cachedruns;while(elem=elem[dir]){if(elem.nodeType===1){if((cache=elem[expando])===cachedkey){return elem.sizset}else if(typeof cache==="string"&&cache.indexOf(dirkey)===0){if(elem.sizset){return elem}}else{elem[expando]=cachedkey;if(matcher(elem)){elem.sizset=true;return elem}elem.sizset=false}}}}}function addMatcher(higher,deeper){return higher?function(elem){var result=deeper(elem);return result&&higher(result===true?elem:result)}:deeper}
// ["TAG", ">", "ID", " ", "CLASS"]
function matcherFromTokens(tokens,context,xml){var token,matcher,i=0;for(;token=tokens[i];i++){if(Expr.relative[token.part]){matcher=addCombinator(matcher,Expr.relative[token.part],context,xml)}else{matcher=addMatcher(matcher,Expr.filter[token.part].apply(null,token.captures.concat(context,xml)))}}return matcher}function matcherFromGroupMatchers(matchers){return function(elem){var matcher,j=0;for(;matcher=matchers[j];j++){if(matcher(elem)){return true}}return false}}compile=Sizzle.compile=function(selector,context,xml){var group,i,len,cached=compilerCache[expando][selector];
// Return a cached group function if already generated (context dependent)
if(cached&&cached.context===context){return cached}
// Generate a function of recursive functions that can be used to check each element
group=tokenize(selector,context,xml);for(i=0,len=group.length;i<len;i++){group[i]=matcherFromTokens(group[i],context,xml)}
// Cache the compiled function
cached=compilerCache(selector,matcherFromGroupMatchers(group));cached.context=context;cached.runs=cached.dirruns=0;return cached};function multipleContexts(selector,contexts,results,seed){var i=0,len=contexts.length;for(;i<len;i++){Sizzle(selector,contexts[i],results,seed)}}function handlePOSGroup(selector,posfilter,argument,contexts,seed,not){var results,fn=Expr.setFilters[posfilter.toLowerCase()];if(!fn){Sizzle.error(posfilter)}if(selector||!(results=seed)){multipleContexts(selector||"*",contexts,results=[],seed)}return results.length>0?fn(results,argument,not):[]}function handlePOS(groups,context,results,seed){var group,part,j,groupLen,token,selector,anchor,elements,match,matched,lastIndex,currentContexts,not,i=0,len=groups.length,rpos=matchExpr["POS"],
// This is generated here in case matchExpr["POS"] is extended
rposgroups=new RegExp("^"+rpos.source+"(?!"+whitespace+")","i"),
// This is for making sure non-participating
// matching groups are represented cross-browser (IE6-8)
setUndefined=function(){var i=1,len=arguments.length-2;for(;i<len;i++){if(arguments[i]===undefined){match[i]=undefined}}};for(;i<len;i++){group=groups[i];part="";elements=seed;for(j=0,groupLen=group.length;j<groupLen;j++){token=group[j];selector=token.string;if(token.part==="PSEUDO"){
// Reset regex index to 0
rpos.exec("");anchor=0;while(match=rpos.exec(selector)){matched=true;lastIndex=rpos.lastIndex=match.index+match[0].length;if(lastIndex>anchor){part+=selector.slice(anchor,match.index);anchor=lastIndex;currentContexts=[context];if(rcombinators.test(part)){if(elements){currentContexts=elements}elements=seed}if(not=rendsWithNot.test(part)){part=part.slice(0,-5).replace(rcombinators,"$&*");anchor++}if(match.length>1){match[0].replace(rposgroups,setUndefined)}elements=handlePOSGroup(part,match[1],match[2],currentContexts,elements,not)}part=""}}if(!matched){part+=selector}matched=false}if(part){if(rcombinators.test(part)){multipleContexts(part,elements||[context],results,seed)}else{Sizzle(part,context,results,seed?seed.concat(elements):elements)}}else{push.apply(results,elements)}}
// Do not sort if this is a single filter
return len===1?results:Sizzle.uniqueSort(results)}function select(selector,context,results,seed,xml){
// Remove excessive whitespace
selector=selector.replace(rtrim,"$1");var elements,matcher,cached,elem,i,tokens,token,lastToken,findContext,type,match=tokenize(selector,context,xml),contextNodeType=context.nodeType;
// POS handling
if(matchExpr["POS"].test(selector)){return handlePOS(match,context,results,seed)}if(seed){elements=slice.call(seed,0);
// To maintain document order, only narrow the
// set if there is one group
}else if(match.length===1){
// Take a shortcut and set the context if the root selector is an ID
if((tokens=slice.call(match[0],0)).length>2&&(token=tokens[0]).part==="ID"&&contextNodeType===9&&!xml&&Expr.relative[tokens[1].part]){context=Expr.find["ID"](token.captures[0].replace(rbackslash,""),context,xml)[0];if(!context){return results}selector=selector.slice(tokens.shift().string.length)}findContext=(match=rsibling.exec(tokens[0].string))&&!match.index&&context.parentNode||context;
// Reduce the set if possible
lastToken="";for(i=tokens.length-1;i>=0;i--){token=tokens[i];type=token.part;lastToken=token.string+lastToken;if(Expr.relative[type]){break}if(Expr.order.test(type)){elements=Expr.find[type](token.captures[0].replace(rbackslash,""),findContext,xml);if(elements==null){continue}else{selector=selector.slice(0,selector.length-lastToken.length)+lastToken.replace(matchExpr[type],"");if(!selector){push.apply(results,slice.call(elements,0))}break}}}}
// Only loop over the given elements once
if(selector){matcher=compile(selector,context,xml);dirruns=matcher.dirruns++;if(elements==null){elements=Expr.find["TAG"]("*",rsibling.test(selector)&&context.parentNode||context)}for(i=0;elem=elements[i];i++){cachedruns=matcher.runs++;if(matcher(elem)){results.push(elem)}}}return results}if(document.querySelectorAll){(function(){var disconnectedMatch,oldSelect=select,rescape=/'|\\/g,rattributeQuotes=/\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,rbuggyQSA=[],
// matchesSelector(:active) reports false when true (IE9/Opera 11.5)
// A support test would require too much code (would include document ready)
// just skip matchesSelector for :active
rbuggyMatches=[":active"],matches=docElem.matchesSelector||docElem.mozMatchesSelector||docElem.webkitMatchesSelector||docElem.oMatchesSelector||docElem.msMatchesSelector;
// Build QSA regex
// Regex strategy adopted from Diego Perini
assert(function(div){
// Select is set to empty string on purpose
// This is to test IE's treatment of not explictly
// setting a boolean content attribute,
// since its presence should be enough
// http://bugs.jquery.com/ticket/12359
div.innerHTML="<select><option selected=''></option></select>";
// IE8 - Some boolean attributes are not treated correctly
if(!div.querySelectorAll("[selected]").length){rbuggyQSA.push("\\["+whitespace+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)")}
// Webkit/Opera - :checked should return selected option elements
// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
// IE8 throws error here (do not put tests after this one)
if(!div.querySelectorAll(":checked").length){rbuggyQSA.push(":checked")}});assert(function(div){
// Opera 10-12/IE9 - ^= $= *= and empty values
// Should not select anything
div.innerHTML="<p test=''></p>";if(div.querySelectorAll("[test^='']").length){rbuggyQSA.push("[*^$]="+whitespace+"*(?:\"\"|'')")}
// FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
// IE8 throws error here (do not put tests after this one)
div.innerHTML="<input type='hidden'/>";if(!div.querySelectorAll(":enabled").length){rbuggyQSA.push(":enabled",":disabled")}});rbuggyQSA=rbuggyQSA.length&&new RegExp(rbuggyQSA.join("|"));select=function(selector,context,results,seed,xml){
// Only use querySelectorAll when not filtering,
// when this is not xml,
// and when no QSA bugs apply
if(!seed&&!xml&&(!rbuggyQSA||!rbuggyQSA.test(selector))){if(context.nodeType===9){try{push.apply(results,slice.call(context.querySelectorAll(selector),0));return results}catch(qsaError){}
// qSA works strangely on Element-rooted queries
// We can work around this by specifying an extra ID on the root
// and working up from there (Thanks to Andrew Dupont for the technique)
// IE 8 doesn't work on object elements
}else if(context.nodeType===1&&context.nodeName.toLowerCase()!=="object"){var groups,i,len,old=context.getAttribute("id"),nid=old||expando,newContext=rsibling.test(selector)&&context.parentNode||context;if(old){nid=nid.replace(rescape,"\\$&")}else{context.setAttribute("id",nid)}groups=tokenize(selector,context,xml);
// Trailing space is unnecessary
// There is always a context check
nid="[id='"+nid+"']";for(i=0,len=groups.length;i<len;i++){groups[i]=nid+groups[i].selector}try{push.apply(results,slice.call(newContext.querySelectorAll(groups.join(",")),0));return results}catch(qsaError){}finally{if(!old){context.removeAttribute("id")}}}}return oldSelect(selector,context,results,seed,xml)};if(matches){assert(function(div){
// Check to see if it's possible to do matchesSelector
// on a disconnected node (IE 9)
disconnectedMatch=matches.call(div,"div");
// This should fail with an exception
// Gecko does not error, returns false instead
try{matches.call(div,"[test!='']:sizzle");rbuggyMatches.push(matchExpr["PSEUDO"].source,matchExpr["POS"].source,"!=")}catch(e){}});
// rbuggyMatches always contains :active, so no need for a length check
rbuggyMatches=/* rbuggyMatches.length && */new RegExp(rbuggyMatches.join("|"));Sizzle.matchesSelector=function(elem,expr){
// Make sure that attribute selectors are quoted
expr=expr.replace(rattributeQuotes,"='$1']");
// rbuggyMatches always contains :active, so no need for an existence check
if(!isXML(elem)&&!rbuggyMatches.test(expr)&&(!rbuggyQSA||!rbuggyQSA.test(expr))){try{var ret=matches.call(elem,expr);
// IE 9's matchesSelector returns false on disconnected nodes
if(ret||disconnectedMatch||
// As well, disconnected nodes are said to be in a document
// fragment in IE 9
elem.document&&elem.document.nodeType!==11){return ret}}catch(e){}}return Sizzle(expr,null,null,[elem]).length>0}}})()}
// Deprecated
Expr.setFilters["nth"]=Expr.setFilters["eq"];
// Back-compat
Expr.filters=Expr.pseudos;
// Override sizzle attribute retrieval
Sizzle.attr=jQuery.attr;jQuery.find=Sizzle;jQuery.expr=Sizzle.selectors;jQuery.expr[":"]=jQuery.expr.pseudos;jQuery.unique=Sizzle.uniqueSort;jQuery.text=Sizzle.getText;jQuery.isXMLDoc=Sizzle.isXML;jQuery.contains=Sizzle.contains})(window);var runtil=/Until$/,rparentsprev=/^(?:parents|prev(?:Until|All))/,isSimple=/^.[^:#\[\.,]*$/,rneedsContext=jQuery.expr.match.needsContext,
// methods guaranteed to produce a unique set when starting from a unique set
guaranteedUnique={children:true,contents:true,next:true,prev:true};jQuery.fn.extend({find:function(selector){var i,l,length,n,r,ret,self=this;if(typeof selector!=="string"){return jQuery(selector).filter(function(){for(i=0,l=self.length;i<l;i++){if(jQuery.contains(self[i],this)){return true}}})}ret=this.pushStack("","find",selector);for(i=0,l=this.length;i<l;i++){length=ret.length;jQuery.find(selector,this[i],ret);if(i>0){
// Make sure that the results are unique
for(n=length;n<ret.length;n++){for(r=0;r<length;r++){if(ret[r]===ret[n]){ret.splice(n--,1);break}}}}}return ret},has:function(target){var i,targets=jQuery(target,this),len=targets.length;return this.filter(function(){for(i=0;i<len;i++){if(jQuery.contains(this,targets[i])){return true}}})},not:function(selector){return this.pushStack(winnow(this,selector,false),"not",selector)},filter:function(selector){return this.pushStack(winnow(this,selector,true),"filter",selector)},is:function(selector){return!!selector&&(typeof selector==="string"?
// If this is a positional/relative selector, check membership in the returned set
// so $("p:first").is("p:last") won't return true for a doc with two "p".
rneedsContext.test(selector)?jQuery(selector,this.context).index(this[0])>=0:jQuery.filter(selector,this).length>0:this.filter(selector).length>0)},closest:function(selectors,context){var cur,i=0,l=this.length,ret=[],pos=rneedsContext.test(selectors)||typeof selectors!=="string"?jQuery(selectors,context||this.context):0;for(;i<l;i++){cur=this[i];while(cur&&cur.ownerDocument&&cur!==context&&cur.nodeType!==11){if(pos?pos.index(cur)>-1:jQuery.find.matchesSelector(cur,selectors)){ret.push(cur);break}cur=cur.parentNode}}ret=ret.length>1?jQuery.unique(ret):ret;return this.pushStack(ret,"closest",selectors)},
// Determine the position of an element within
// the matched set of elements
index:function(elem){
// No argument, return index in parent
if(!elem){return this[0]&&this[0].parentNode?this.prevAll().length:-1}
// index in selector
if(typeof elem==="string"){return jQuery.inArray(this[0],jQuery(elem))}
// Locate the position of the desired element
return jQuery.inArray(
// If it receives a jQuery object, the first element is used
elem.jquery?elem[0]:elem,this)},add:function(selector,context){var set=typeof selector==="string"?jQuery(selector,context):jQuery.makeArray(selector&&selector.nodeType?[selector]:selector),all=jQuery.merge(this.get(),set);return this.pushStack(isDisconnected(set[0])||isDisconnected(all[0])?all:jQuery.unique(all))},addBack:function(selector){return this.add(selector==null?this.prevObject:this.prevObject.filter(selector))}});jQuery.fn.andSelf=jQuery.fn.addBack;
// A painfully simple check to see if an element is disconnected
// from a document (should be improved, where feasible).
function isDisconnected(node){return!node||!node.parentNode||node.parentNode.nodeType===11}function sibling(cur,dir){do{cur=cur[dir]}while(cur&&cur.nodeType!==1);return cur}jQuery.each({parent:function(elem){var parent=elem.parentNode;return parent&&parent.nodeType!==11?parent:null},parents:function(elem){return jQuery.dir(elem,"parentNode")},parentsUntil:function(elem,i,until){return jQuery.dir(elem,"parentNode",until)},next:function(elem){return sibling(elem,"nextSibling")},prev:function(elem){return sibling(elem,"previousSibling")},nextAll:function(elem){return jQuery.dir(elem,"nextSibling")},prevAll:function(elem){return jQuery.dir(elem,"previousSibling")},nextUntil:function(elem,i,until){return jQuery.dir(elem,"nextSibling",until)},prevUntil:function(elem,i,until){return jQuery.dir(elem,"previousSibling",until)},siblings:function(elem){return jQuery.sibling((elem.parentNode||{}).firstChild,elem)},children:function(elem){return jQuery.sibling(elem.firstChild)},contents:function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.merge([],elem.childNodes)}},function(name,fn){jQuery.fn[name]=function(until,selector){var ret=jQuery.map(this,fn,until);if(!runtil.test(name)){selector=until}if(selector&&typeof selector==="string"){ret=jQuery.filter(selector,ret)}ret=this.length>1&&!guaranteedUnique[name]?jQuery.unique(ret):ret;if(this.length>1&&rparentsprev.test(name)){ret=ret.reverse()}return this.pushStack(ret,name,core_slice.call(arguments).join(","))}});jQuery.extend({filter:function(expr,elems,not){if(not){expr=":not("+expr+")"}return elems.length===1?jQuery.find.matchesSelector(elems[0],expr)?[elems[0]]:[]:jQuery.find.matches(expr,elems)},dir:function(elem,dir,until){var matched=[],cur=elem[dir];while(cur&&cur.nodeType!==9&&(until===undefined||cur.nodeType!==1||!jQuery(cur).is(until))){if(cur.nodeType===1){matched.push(cur)}cur=cur[dir]}return matched},sibling:function(n,elem){var r=[];for(;n;n=n.nextSibling){if(n.nodeType===1&&n!==elem){r.push(n)}}return r}});
// Implement the identical functionality for filter and not
function winnow(elements,qualifier,keep){
// Can't pass null or undefined to indexOf in Firefox 4
// Set to 0 to skip string check
qualifier=qualifier||0;if(jQuery.isFunction(qualifier)){return jQuery.grep(elements,function(elem,i){var retVal=!!qualifier.call(elem,i,elem);return retVal===keep})}else if(qualifier.nodeType){return jQuery.grep(elements,function(elem,i){return elem===qualifier===keep})}else if(typeof qualifier==="string"){var filtered=jQuery.grep(elements,function(elem){return elem.nodeType===1});if(isSimple.test(qualifier)){return jQuery.filter(qualifier,filtered,!keep)}else{qualifier=jQuery.filter(qualifier,filtered)}}return jQuery.grep(elements,function(elem,i){return jQuery.inArray(elem,qualifier)>=0===keep})}function createSafeFragment(document){var list=nodeNames.split("|"),safeFrag=document.createDocumentFragment();if(safeFrag.createElement){while(list.length){safeFrag.createElement(list.pop())}}return safeFrag}var nodeNames="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|"+"header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",rinlinejQuery=/ jQuery\d+="(?:null|\d+)"/g,rleadingWhitespace=/^\s+/,rxhtmlTag=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,rtagName=/<([\w:]+)/,rtbody=/<tbody/i,rhtml=/<|&#?\w+;/,rnoInnerhtml=/<(?:script|style|link)/i,rnocache=/<(?:script|object|embed|option|style)/i,rnoshimcache=new RegExp("<(?:"+nodeNames+")[\\s/>]","i"),rcheckableType=/^(?:checkbox|radio)$/,
// checked="checked" or checked
rchecked=/checked\s*(?:[^=]|=\s*.checked.)/i,rscriptType=/\/(java|ecma)script/i,rcleanScript=/^\s*<!(?:\[CDATA\[|\-\-)|[\]\-]{2}>\s*$/g,wrapMap={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]},safeFragment=createSafeFragment(document),fragmentDiv=safeFragment.appendChild(document.createElement("div"));wrapMap.optgroup=wrapMap.option;wrapMap.tbody=wrapMap.tfoot=wrapMap.colgroup=wrapMap.caption=wrapMap.thead;wrapMap.th=wrapMap.td;
// IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags,
// unless wrapped in a div with non-breaking characters in front of it.
if(!jQuery.support.htmlSerialize){wrapMap._default=[1,"X<div>","</div>"]}jQuery.fn.extend({text:function(value){return jQuery.access(this,function(value){return value===undefined?jQuery.text(this):this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(value))},null,value,arguments.length)},wrapAll:function(html){if(jQuery.isFunction(html)){return this.each(function(i){jQuery(this).wrapAll(html.call(this,i))})}if(this[0]){
// The elements to wrap the target around
var wrap=jQuery(html,this[0].ownerDocument).eq(0).clone(true);if(this[0].parentNode){wrap.insertBefore(this[0])}wrap.map(function(){var elem=this;while(elem.firstChild&&elem.firstChild.nodeType===1){elem=elem.firstChild}return elem}).append(this)}return this},wrapInner:function(html){if(jQuery.isFunction(html)){return this.each(function(i){jQuery(this).wrapInner(html.call(this,i))})}return this.each(function(){var self=jQuery(this),contents=self.contents();if(contents.length){contents.wrapAll(html)}else{self.append(html)}})},wrap:function(html){var isFunction=jQuery.isFunction(html);return this.each(function(i){jQuery(this).wrapAll(isFunction?html.call(this,i):html)})},unwrap:function(){return this.parent().each(function(){if(!jQuery.nodeName(this,"body")){jQuery(this).replaceWith(this.childNodes)}}).end()},append:function(){return this.domManip(arguments,true,function(elem){if(this.nodeType===1||this.nodeType===11){this.appendChild(elem)}})},prepend:function(){return this.domManip(arguments,true,function(elem){if(this.nodeType===1||this.nodeType===11){this.insertBefore(elem,this.firstChild)}})},before:function(){if(!isDisconnected(this[0])){return this.domManip(arguments,false,function(elem){this.parentNode.insertBefore(elem,this)})}if(arguments.length){var set=jQuery.clean(arguments);return this.pushStack(jQuery.merge(set,this),"before",this.selector)}},after:function(){if(!isDisconnected(this[0])){return this.domManip(arguments,false,function(elem){this.parentNode.insertBefore(elem,this.nextSibling)})}if(arguments.length){var set=jQuery.clean(arguments);return this.pushStack(jQuery.merge(this,set),"after",this.selector)}},
// keepData is for internal use only--do not document
remove:function(selector,keepData){var elem,i=0;for(;(elem=this[i])!=null;i++){if(!selector||jQuery.filter(selector,[elem]).length){if(!keepData&&elem.nodeType===1){jQuery.cleanData(elem.getElementsByTagName("*"));jQuery.cleanData([elem])}if(elem.parentNode){elem.parentNode.removeChild(elem)}}}return this},empty:function(){var elem,i=0;for(;(elem=this[i])!=null;i++){
// Remove element nodes and prevent memory leaks
if(elem.nodeType===1){jQuery.cleanData(elem.getElementsByTagName("*"))}
// Remove any remaining nodes
while(elem.firstChild){elem.removeChild(elem.firstChild)}}return this},clone:function(dataAndEvents,deepDataAndEvents){dataAndEvents=dataAndEvents==null?false:dataAndEvents;deepDataAndEvents=deepDataAndEvents==null?dataAndEvents:deepDataAndEvents;return this.map(function(){return jQuery.clone(this,dataAndEvents,deepDataAndEvents)})},html:function(value){return jQuery.access(this,function(value){var elem=this[0]||{},i=0,l=this.length;if(value===undefined){return elem.nodeType===1?elem.innerHTML.replace(rinlinejQuery,""):undefined}
// See if we can take a shortcut and just use innerHTML
if(typeof value==="string"&&!rnoInnerhtml.test(value)&&(jQuery.support.htmlSerialize||!rnoshimcache.test(value))&&(jQuery.support.leadingWhitespace||!rleadingWhitespace.test(value))&&!wrapMap[(rtagName.exec(value)||["",""])[1].toLowerCase()]){value=value.replace(rxhtmlTag,"<$1></$2>");try{for(;i<l;i++){
// Remove element nodes and prevent memory leaks
elem=this[i]||{};if(elem.nodeType===1){jQuery.cleanData(elem.getElementsByTagName("*"));elem.innerHTML=value}}elem=0;
// If using innerHTML throws an exception, use the fallback method
}catch(e){}}if(elem){this.empty().append(value)}},null,value,arguments.length)},replaceWith:function(value){if(!isDisconnected(this[0])){
// Make sure that the elements are removed from the DOM before they are inserted
// this can help fix replacing a parent with child elements
if(jQuery.isFunction(value)){return this.each(function(i){var self=jQuery(this),old=self.html();self.replaceWith(value.call(this,i,old))})}if(typeof value!=="string"){value=jQuery(value).detach()}return this.each(function(){var next=this.nextSibling,parent=this.parentNode;jQuery(this).remove();if(next){jQuery(next).before(value)}else{jQuery(parent).append(value)}})}return this.length?this.pushStack(jQuery(jQuery.isFunction(value)?value():value),"replaceWith",value):this},detach:function(selector){return this.remove(selector,true)},domManip:function(args,table,callback){
// Flatten any nested arrays
args=[].concat.apply([],args);var results,first,fragment,iNoClone,i=0,value=args[0],scripts=[],l=this.length;
// We can't cloneNode fragments that contain checked, in WebKit
if(!jQuery.support.checkClone&&l>1&&typeof value==="string"&&rchecked.test(value)){return this.each(function(){jQuery(this).domManip(args,table,callback)})}if(jQuery.isFunction(value)){return this.each(function(i){var self=jQuery(this);args[0]=value.call(this,i,table?self.html():undefined);self.domManip(args,table,callback)})}if(this[0]){results=jQuery.buildFragment(args,this,scripts);fragment=results.fragment;first=fragment.firstChild;if(fragment.childNodes.length===1){fragment=first}if(first){table=table&&jQuery.nodeName(first,"tr");
// Use the original fragment for the last item instead of the first because it can end up
// being emptied incorrectly in certain situations (#8070).
// Fragments from the fragment cache must always be cloned and never used in place.
for(iNoClone=results.cacheable||l-1;i<l;i++){callback.call(table&&jQuery.nodeName(this[i],"table")?findOrAppend(this[i],"tbody"):this[i],i===iNoClone?fragment:jQuery.clone(fragment,true,true))}}
// Fix #11809: Avoid leaking memory
fragment=first=null;if(scripts.length){jQuery.each(scripts,function(i,elem){if(elem.src){if(jQuery.ajax){jQuery.ajax({url:elem.src,type:"GET",dataType:"script",async:false,global:false,throws:true})}else{jQuery.error("no ajax")}}else{jQuery.globalEval((elem.text||elem.textContent||elem.innerHTML||"").replace(rcleanScript,""))}if(elem.parentNode){elem.parentNode.removeChild(elem)}})}}return this}});function findOrAppend(elem,tag){return elem.getElementsByTagName(tag)[0]||elem.appendChild(elem.ownerDocument.createElement(tag))}function cloneCopyEvent(src,dest){if(dest.nodeType!==1||!jQuery.hasData(src)){return}var type,i,l,oldData=jQuery._data(src),curData=jQuery._data(dest,oldData),events=oldData.events;if(events){delete curData.handle;curData.events={};for(type in events){for(i=0,l=events[type].length;i<l;i++){jQuery.event.add(dest,type,events[type][i])}}}
// make the cloned public data object a copy from the original
if(curData.data){curData.data=jQuery.extend({},curData.data)}}function cloneFixAttributes(src,dest){var nodeName;
// We do not need to do anything for non-Elements
if(dest.nodeType!==1){return}
// clearAttributes removes the attributes, which we don't want,
// but also removes the attachEvent events, which we *do* want
if(dest.clearAttributes){dest.clearAttributes()}
// mergeAttributes, in contrast, only merges back on the
// original attributes, not the events
if(dest.mergeAttributes){dest.mergeAttributes(src)}nodeName=dest.nodeName.toLowerCase();if(nodeName==="object"){
// IE6-10 improperly clones children of object elements using classid.
// IE10 throws NoModificationAllowedError if parent is null, #12132.
if(dest.parentNode){dest.outerHTML=src.outerHTML}
// This path appears unavoidable for IE9. When cloning an object
// element in IE9, the outerHTML strategy above is not sufficient.
// If the src has innerHTML and the destination does not,
// copy the src.innerHTML into the dest.innerHTML. #10324
if(jQuery.support.html5Clone&&(src.innerHTML&&!jQuery.trim(dest.innerHTML))){dest.innerHTML=src.innerHTML}}else if(nodeName==="input"&&rcheckableType.test(src.type)){
// IE6-8 fails to persist the checked state of a cloned checkbox
// or radio button. Worse, IE6-7 fail to give the cloned element
// a checked appearance if the defaultChecked value isn't also set
dest.defaultChecked=dest.checked=src.checked;
// IE6-7 get confused and end up setting the value of a cloned
// checkbox/radio button to an empty string instead of "on"
if(dest.value!==src.value){dest.value=src.value}
// IE6-8 fails to return the selected option to the default selected
// state when cloning options
}else if(nodeName==="option"){dest.selected=src.defaultSelected;
// IE6-8 fails to set the defaultValue to the correct value when
// cloning other types of input fields
}else if(nodeName==="input"||nodeName==="textarea"){dest.defaultValue=src.defaultValue;
// IE blanks contents when cloning scripts
}else if(nodeName==="script"&&dest.text!==src.text){dest.text=src.text}
// Event data gets referenced instead of copied if the expando
// gets copied too
dest.removeAttribute(jQuery.expando)}jQuery.buildFragment=function(args,context,scripts){var fragment,cacheable,cachehit,first=args[0];
// Set context from what may come in as undefined or a jQuery collection or a node
// Updated to fix #12266 where accessing context[0] could throw an exception in IE9/10 &
// also doubles as fix for #8950 where plain objects caused createDocumentFragment exception
context=context||document;context=!context.nodeType&&context[0]||context;context=context.ownerDocument||context;
// Only cache "small" (1/2 KB) HTML strings that are associated with the main document
// Cloning options loses the selected state, so don't cache them
// IE 6 doesn't like it when you put <object> or <embed> elements in a fragment
// Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache
// Lastly, IE6,7,8 will not correctly reuse cached fragments that were created from unknown elems #10501
if(args.length===1&&typeof first==="string"&&first.length<512&&context===document&&first.charAt(0)==="<"&&!rnocache.test(first)&&(jQuery.support.checkClone||!rchecked.test(first))&&(jQuery.support.html5Clone||!rnoshimcache.test(first))){
// Mark cacheable and look for a hit
cacheable=true;fragment=jQuery.fragments[first];cachehit=fragment!==undefined}if(!fragment){fragment=context.createDocumentFragment();jQuery.clean(args,context,fragment,scripts);
// Update the cache, but only store false
// unless this is a second parsing of the same content
if(cacheable){jQuery.fragments[first]=cachehit&&fragment}}return{fragment:fragment,cacheable:cacheable}};jQuery.fragments={};jQuery.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(name,original){jQuery.fn[name]=function(selector){var elems,i=0,ret=[],insert=jQuery(selector),l=insert.length,parent=this.length===1&&this[0].parentNode;if((parent==null||parent&&parent.nodeType===11&&parent.childNodes.length===1)&&l===1){insert[original](this[0]);return this}else{for(;i<l;i++){elems=(i>0?this.clone(true):this).get();jQuery(insert[i])[original](elems);ret=ret.concat(elems)}return this.pushStack(ret,name,insert.selector)}}});function getAll(elem){if(typeof elem.getElementsByTagName!=="undefined"){return elem.getElementsByTagName("*")}else if(typeof elem.querySelectorAll!=="undefined"){return elem.querySelectorAll("*")}else{return[]}}
// Used in clean, fixes the defaultChecked property
function fixDefaultChecked(elem){if(rcheckableType.test(elem.type)){elem.defaultChecked=elem.checked}}jQuery.extend({clone:function(elem,dataAndEvents,deepDataAndEvents){var srcElements,destElements,i,clone;if(jQuery.support.html5Clone||jQuery.isXMLDoc(elem)||!rnoshimcache.test("<"+elem.nodeName+">")){clone=elem.cloneNode(true);
// IE<=8 does not properly clone detached, unknown element nodes
}else{fragmentDiv.innerHTML=elem.outerHTML;fragmentDiv.removeChild(clone=fragmentDiv.firstChild)}if((!jQuery.support.noCloneEvent||!jQuery.support.noCloneChecked)&&(elem.nodeType===1||elem.nodeType===11)&&!jQuery.isXMLDoc(elem)){
// IE copies events bound via attachEvent when using cloneNode.
// Calling detachEvent on the clone will also remove the events
// from the original. In order to get around this, we use some
// proprietary methods to clear the events. Thanks to MooTools
// guys for this hotness.
cloneFixAttributes(elem,clone);
// Using Sizzle here is crazy slow, so we use getElementsByTagName instead
srcElements=getAll(elem);destElements=getAll(clone);
// Weird iteration because IE will replace the length property
// with an element if you are cloning the body and one of the
// elements on the page has a name or id of "length"
for(i=0;srcElements[i];++i){
// Ensure that the destination node is not null; Fixes #9587
if(destElements[i]){cloneFixAttributes(srcElements[i],destElements[i])}}}
// Copy the events from the original to the clone
if(dataAndEvents){cloneCopyEvent(elem,clone);if(deepDataAndEvents){srcElements=getAll(elem);destElements=getAll(clone);for(i=0;srcElements[i];++i){cloneCopyEvent(srcElements[i],destElements[i])}}}srcElements=destElements=null;
// Return the cloned set
return clone},clean:function(elems,context,fragment,scripts){var i,j,elem,tag,wrap,depth,div,hasBody,tbody,len,handleScript,jsTags,safe=context===document&&safeFragment,ret=[];
// Ensure that context is a document
if(!context||typeof context.createDocumentFragment==="undefined"){context=document}
// Use the already-created safe fragment if context permits
for(i=0;(elem=elems[i])!=null;i++){if(typeof elem==="number"){elem+=""}if(!elem){continue}
// Convert html string into DOM nodes
if(typeof elem==="string"){if(!rhtml.test(elem)){elem=context.createTextNode(elem)}else{
// Ensure a safe container in which to render the html
safe=safe||createSafeFragment(context);div=context.createElement("div");safe.appendChild(div);
// Fix "XHTML"-style tags in all browsers
elem=elem.replace(rxhtmlTag,"<$1></$2>");
// Go to html and back, then peel off extra wrappers
tag=(rtagName.exec(elem)||["",""])[1].toLowerCase();wrap=wrapMap[tag]||wrapMap._default;depth=wrap[0];div.innerHTML=wrap[1]+elem+wrap[2];
// Move to the right depth
while(depth--){div=div.lastChild}
// Remove IE's autoinserted <tbody> from table fragments
if(!jQuery.support.tbody){
// String was a <table>, *may* have spurious <tbody>
hasBody=rtbody.test(elem);tbody=tag==="table"&&!hasBody?div.firstChild&&div.firstChild.childNodes:
// String was a bare <thead> or <tfoot>
wrap[1]==="<table>"&&!hasBody?div.childNodes:[];for(j=tbody.length-1;j>=0;--j){if(jQuery.nodeName(tbody[j],"tbody")&&!tbody[j].childNodes.length){tbody[j].parentNode.removeChild(tbody[j])}}}
// IE completely kills leading whitespace when innerHTML is used
if(!jQuery.support.leadingWhitespace&&rleadingWhitespace.test(elem)){div.insertBefore(context.createTextNode(rleadingWhitespace.exec(elem)[0]),div.firstChild)}elem=div.childNodes;
// Take out of fragment container (we need a fresh div each time)
div.parentNode.removeChild(div)}}if(elem.nodeType){ret.push(elem)}else{jQuery.merge(ret,elem)}}
// Fix #11356: Clear elements from safeFragment
if(div){elem=div=safe=null}
// Reset defaultChecked for any radios and checkboxes
// about to be appended to the DOM in IE 6/7 (#8060)
if(!jQuery.support.appendChecked){for(i=0;(elem=ret[i])!=null;i++){if(jQuery.nodeName(elem,"input")){fixDefaultChecked(elem)}else if(typeof elem.getElementsByTagName!=="undefined"){jQuery.grep(elem.getElementsByTagName("input"),fixDefaultChecked)}}}
// Append elements to a provided document fragment
if(fragment){
// Special handling of each script element
handleScript=function(elem){
// Check if we consider it executable
if(!elem.type||rscriptType.test(elem.type)){
// Detach the script and store it in the scripts array (if provided) or the fragment
// Return truthy to indicate that it has been handled
return scripts?scripts.push(elem.parentNode?elem.parentNode.removeChild(elem):elem):fragment.appendChild(elem)}};for(i=0;(elem=ret[i])!=null;i++){
// Check if we're done after handling an executable script
if(!(jQuery.nodeName(elem,"script")&&handleScript(elem))){
// Append to fragment and handle embedded scripts
fragment.appendChild(elem);if(typeof elem.getElementsByTagName!=="undefined"){
// handleScript alters the DOM, so use jQuery.merge to ensure snapshot iteration
jsTags=jQuery.grep(jQuery.merge([],elem.getElementsByTagName("script")),handleScript);
// Splice the scripts into ret after their former ancestor and advance our index beyond them
ret.splice.apply(ret,[i+1,0].concat(jsTags));i+=jsTags.length}}}}return ret},cleanData:function(elems,/* internal */acceptData){var data,id,elem,type,i=0,internalKey=jQuery.expando,cache=jQuery.cache,deleteExpando=jQuery.support.deleteExpando,special=jQuery.event.special;for(;(elem=elems[i])!=null;i++){if(acceptData||jQuery.acceptData(elem)){id=elem[internalKey];data=id&&cache[id];if(data){if(data.events){for(type in data.events){if(special[type]){jQuery.event.remove(elem,type);
// This is a shortcut to avoid jQuery.event.remove's overhead
}else{jQuery.removeEvent(elem,type,data.handle)}}}
// Remove cache only if it was not already removed by jQuery.event.remove
if(cache[id]){delete cache[id];
// IE does not allow us to delete expando properties from nodes,
// nor does it have a removeAttribute function on Document nodes;
// we must handle all of these cases
if(deleteExpando){delete elem[internalKey]}else if(elem.removeAttribute){elem.removeAttribute(internalKey)}else{elem[internalKey]=null}jQuery.deletedIds.push(id)}}}}}});
// Limit scope pollution from any deprecated API
(function(){var matched,browser;
// Use of jQuery.browser is frowned upon.
// More details: http://api.jquery.com/jQuery.browser
// jQuery.uaMatch maintained for back-compat
jQuery.uaMatch=function(ua){ua=ua.toLowerCase();var match=/(chrome)[ \/]([\w.]+)/.exec(ua)||/(webkit)[ \/]([\w.]+)/.exec(ua)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua)||/(msie) ([\w.]+)/.exec(ua)||ua.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua)||[];return{browser:match[1]||"",version:match[2]||"0"}};matched=jQuery.uaMatch(navigator.userAgent);browser={};if(matched.browser){browser[matched.browser]=true;browser.version=matched.version}
// Chrome is Webkit, but Webkit is also Safari.
if(browser.chrome){browser.webkit=true}else if(browser.webkit){browser.safari=true}jQuery.browser=browser;jQuery.sub=function(){function jQuerySub(selector,context){return new jQuerySub.fn.init(selector,context)}jQuery.extend(true,jQuerySub,this);jQuerySub.superclass=this;jQuerySub.fn=jQuerySub.prototype=this();jQuerySub.fn.constructor=jQuerySub;jQuerySub.sub=this.sub;jQuerySub.fn.init=function init(selector,context){if(context&&context instanceof jQuery&&!(context instanceof jQuerySub)){context=jQuerySub(context)}return jQuery.fn.init.call(this,selector,context,rootjQuerySub)};jQuerySub.fn.init.prototype=jQuerySub.fn;var rootjQuerySub=jQuerySub(document);return jQuerySub}})();var curCSS,iframe,iframeDoc,ralpha=/alpha\([^)]*\)/i,ropacity=/opacity=([^)]*)/,rposition=/^(top|right|bottom|left)$/,
// swappable if display is none or starts with table except "table", "table-cell", or "table-caption"
// see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
rdisplayswap=/^(none|table(?!-c[ea]).+)/,rmargin=/^margin/,rnumsplit=new RegExp("^("+core_pnum+")(.*)$","i"),rnumnonpx=new RegExp("^("+core_pnum+")(?!px)[a-z%]+$","i"),rrelNum=new RegExp("^([-+])=("+core_pnum+")","i"),elemdisplay={},cssShow={position:"absolute",visibility:"hidden",display:"block"},cssNormalTransform={letterSpacing:0,fontWeight:400},cssExpand=["Top","Right","Bottom","Left"],cssPrefixes=["Webkit","O","Moz","ms"],eventsToggle=jQuery.fn.toggle;
// return a css property mapped to a potentially vendor prefixed property
function vendorPropName(style,name){
// shortcut for names that are not vendor prefixed
if(name in style){return name}
// check for vendor prefixed names
var capName=name.charAt(0).toUpperCase()+name.slice(1),origName=name,i=cssPrefixes.length;while(i--){name=cssPrefixes[i]+capName;if(name in style){return name}}return origName}function isHidden(elem,el){elem=el||elem;return jQuery.css(elem,"display")==="none"||!jQuery.contains(elem.ownerDocument,elem)}function showHide(elements,show){var elem,display,values=[],index=0,length=elements.length;for(;index<length;index++){elem=elements[index];if(!elem.style){continue}values[index]=jQuery._data(elem,"olddisplay");if(show){
// Reset the inline display of this element to learn if it is
// being hidden by cascaded rules or not
if(!values[index]&&elem.style.display==="none"){elem.style.display=""}
// Set elements which have been overridden with display: none
// in a stylesheet to whatever the default browser style is
// for such an element
if(elem.style.display===""&&isHidden(elem)){values[index]=jQuery._data(elem,"olddisplay",css_defaultDisplay(elem.nodeName))}}else{display=curCSS(elem,"display");if(!values[index]&&display!=="none"){jQuery._data(elem,"olddisplay",display)}}}
// Set the display of most of the elements in a second loop
// to avoid the constant reflow
for(index=0;index<length;index++){elem=elements[index];if(!elem.style){continue}if(!show||elem.style.display==="none"||elem.style.display===""){elem.style.display=show?values[index]||"":"none"}}return elements}jQuery.fn.extend({css:function(name,value){return jQuery.access(this,function(elem,name,value){return value!==undefined?jQuery.style(elem,name,value):jQuery.css(elem,name)},name,value,arguments.length>1)},show:function(){return showHide(this,true)},hide:function(){return showHide(this)},toggle:function(state,fn2){var bool=typeof state==="boolean";if(jQuery.isFunction(state)&&jQuery.isFunction(fn2)){return eventsToggle.apply(this,arguments)}return this.each(function(){if(bool?state:isHidden(this)){jQuery(this).show()}else{jQuery(this).hide()}})}});jQuery.extend({
// Add in style property hooks for overriding the default
// behavior of getting and setting a style property
cssHooks:{opacity:{get:function(elem,computed){if(computed){
// We should always get a number back from opacity
var ret=curCSS(elem,"opacity");return ret===""?"1":ret}}}},
// Exclude the following css properties to add px
cssNumber:{fillOpacity:true,fontWeight:true,lineHeight:true,opacity:true,orphans:true,widows:true,zIndex:true,zoom:true},
// Add in properties whose names you wish to fix before
// setting or getting the value
cssProps:{
// normalize float css property
float:jQuery.support.cssFloat?"cssFloat":"styleFloat"},
// Get and set the style property on a DOM Node
style:function(elem,name,value,extra){
// Don't set styles on text and comment nodes
if(!elem||elem.nodeType===3||elem.nodeType===8||!elem.style){return}
// Make sure that we're working with the right name
var ret,type,hooks,origName=jQuery.camelCase(name),style=elem.style;name=jQuery.cssProps[origName]||(jQuery.cssProps[origName]=vendorPropName(style,origName));
// gets hook for the prefixed version
// followed by the unprefixed version
hooks=jQuery.cssHooks[name]||jQuery.cssHooks[origName];
// Check if we're setting a value
if(value!==undefined){type=typeof value;
// convert relative number strings (+= or -=) to relative numbers. #7345
if(type==="string"&&(ret=rrelNum.exec(value))){value=(ret[1]+1)*ret[2]+parseFloat(jQuery.css(elem,name));
// Fixes bug #9237
type="number"}
// Make sure that NaN and null values aren't set. See: #7116
if(value==null||type==="number"&&isNaN(value)){return}
// If a number was passed in, add 'px' to the (except for certain CSS properties)
if(type==="number"&&!jQuery.cssNumber[origName]){value+="px"}
// If a hook was provided, use that value, otherwise just set the specified value
if(!hooks||!("set"in hooks)||(value=hooks.set(elem,value,extra))!==undefined){
// Wrapped to prevent IE from throwing errors when 'invalid' values are provided
// Fixes bug #5509
try{style[name]=value}catch(e){}}}else{
// If a hook was provided get the non-computed value from there
if(hooks&&"get"in hooks&&(ret=hooks.get(elem,false,extra))!==undefined){return ret}
// Otherwise just get the value from the style object
return style[name]}},css:function(elem,name,numeric,extra){var val,num,hooks,origName=jQuery.camelCase(name);
// Make sure that we're working with the right name
name=jQuery.cssProps[origName]||(jQuery.cssProps[origName]=vendorPropName(elem.style,origName));
// gets hook for the prefixed version
// followed by the unprefixed version
hooks=jQuery.cssHooks[name]||jQuery.cssHooks[origName];
// If a hook was provided get the computed value from there
if(hooks&&"get"in hooks){val=hooks.get(elem,true,extra)}
// Otherwise, if a way to get the computed value exists, use that
if(val===undefined){val=curCSS(elem,name)}
//convert "normal" to computed value
if(val==="normal"&&name in cssNormalTransform){val=cssNormalTransform[name]}
// Return, converting to number if forced or a qualifier was provided and val looks numeric
if(numeric||extra!==undefined){num=parseFloat(val);return numeric||jQuery.isNumeric(num)?num||0:val}return val},
// A method for quickly swapping in/out CSS properties to get correct calculations
swap:function(elem,options,callback){var ret,name,old={};
// Remember the old values, and insert the new ones
for(name in options){old[name]=elem.style[name];elem.style[name]=options[name]}ret=callback.call(elem);
// Revert the old values
for(name in options){elem.style[name]=old[name]}return ret}});
// NOTE: To any future maintainer, we've window.getComputedStyle
// because jsdom on node.js will break without it.
if(window.getComputedStyle){curCSS=function(elem,name){var ret,width,minWidth,maxWidth,computed=window.getComputedStyle(elem,null),style=elem.style;if(computed){ret=computed[name];if(ret===""&&!jQuery.contains(elem.ownerDocument,elem)){ret=jQuery.style(elem,name)}
// A tribute to the "awesome hack by Dean Edwards"
// Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right
// Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels
// this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values
if(rnumnonpx.test(ret)&&rmargin.test(name)){width=style.width;minWidth=style.minWidth;maxWidth=style.maxWidth;style.minWidth=style.maxWidth=style.width=ret;ret=computed.width;style.width=width;style.minWidth=minWidth;style.maxWidth=maxWidth}}return ret}}else if(document.documentElement.currentStyle){curCSS=function(elem,name){var left,rsLeft,ret=elem.currentStyle&&elem.currentStyle[name],style=elem.style;
// Avoid setting ret to empty string here
// so we don't default to auto
if(ret==null&&style&&style[name]){ret=style[name]}
// From the awesome hack by Dean Edwards
// http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
// If we're not dealing with a regular pixel number
// but a number that has a weird ending, we need to convert it to pixels
// but not position css attributes, as those are proportional to the parent element instead
// and we can't measure the parent instead because it might trigger a "stacking dolls" problem
if(rnumnonpx.test(ret)&&!rposition.test(name)){
// Remember the original values
left=style.left;rsLeft=elem.runtimeStyle&&elem.runtimeStyle.left;
// Put in the new values to get a computed value out
if(rsLeft){elem.runtimeStyle.left=elem.currentStyle.left}style.left=name==="fontSize"?"1em":ret;ret=style.pixelLeft+"px";
// Revert the changed values
style.left=left;if(rsLeft){elem.runtimeStyle.left=rsLeft}}return ret===""?"auto":ret}}function setPositiveNumber(elem,value,subtract){var matches=rnumsplit.exec(value);return matches?Math.max(0,matches[1]-(subtract||0))+(matches[2]||"px"):value}function augmentWidthOrHeight(elem,name,extra,isBorderBox){var i=extra===(isBorderBox?"border":"content")?
// If we already have the right measurement, avoid augmentation
4:
// Otherwise initialize for horizontal or vertical properties
name==="width"?1:0,val=0;for(;i<4;i+=2){
// both box models exclude margin, so add it if we want it
if(extra==="margin"){
// we use jQuery.css instead of curCSS here
// because of the reliableMarginRight CSS hook!
val+=jQuery.css(elem,extra+cssExpand[i],true)}
// From this point on we use curCSS for maximum performance (relevant in animations)
if(isBorderBox){
// border-box includes padding, so remove it if we want content
if(extra==="content"){val-=parseFloat(curCSS(elem,"padding"+cssExpand[i]))||0}
// at this point, extra isn't border nor margin, so remove border
if(extra!=="margin"){val-=parseFloat(curCSS(elem,"border"+cssExpand[i]+"Width"))||0}}else{
// at this point, extra isn't content, so add padding
val+=parseFloat(curCSS(elem,"padding"+cssExpand[i]))||0;
// at this point, extra isn't content nor padding, so add border
if(extra!=="padding"){val+=parseFloat(curCSS(elem,"border"+cssExpand[i]+"Width"))||0}}}return val}function getWidthOrHeight(elem,name,extra){
// Start with offset property, which is equivalent to the border-box value
var val=name==="width"?elem.offsetWidth:elem.offsetHeight,valueIsBorderBox=true,isBorderBox=jQuery.support.boxSizing&&jQuery.css(elem,"boxSizing")==="border-box";
// some non-html elements return undefined for offsetWidth, so check for null/undefined
// svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
// MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
if(val<=0||val==null){
// Fall back to computed then uncomputed css if necessary
val=curCSS(elem,name);if(val<0||val==null){val=elem.style[name]}
// Computed unit is not pixels. Stop here and return.
if(rnumnonpx.test(val)){return val}
// we need the check for style in case a browser which returns unreliable values
// for getComputedStyle silently falls back to the reliable elem.style
valueIsBorderBox=isBorderBox&&(jQuery.support.boxSizingReliable||val===elem.style[name]);
// Normalize "", auto, and prepare for extra
val=parseFloat(val)||0}
// use the active box-sizing model to add/subtract irrelevant styles
return val+augmentWidthOrHeight(elem,name,extra||(isBorderBox?"border":"content"),valueIsBorderBox)+"px"}
// Try to determine the default display value of an element
function css_defaultDisplay(nodeName){if(elemdisplay[nodeName]){return elemdisplay[nodeName]}var elem=jQuery("<"+nodeName+">").appendTo(document.body),display=elem.css("display");elem.remove();
// If the simple way fails,
// get element's real default display by attaching it to a temp iframe
if(display==="none"||display===""){
// Use the already-created iframe if possible
iframe=document.body.appendChild(iframe||jQuery.extend(document.createElement("iframe"),{frameBorder:0,width:0,height:0}));
// Create a cacheable copy of the iframe document on first call.
// IE and Opera will allow us to reuse the iframeDoc without re-writing the fake HTML
// document to it; WebKit & Firefox won't allow reusing the iframe document.
if(!iframeDoc||!iframe.createElement){iframeDoc=(iframe.contentWindow||iframe.contentDocument).document;iframeDoc.write("<!doctype html><html><body>");iframeDoc.close()}elem=iframeDoc.body.appendChild(iframeDoc.createElement(nodeName));display=curCSS(elem,"display");document.body.removeChild(iframe)}
// Store the correct default display
elemdisplay[nodeName]=display;return display}jQuery.each(["height","width"],function(i,name){jQuery.cssHooks[name]={get:function(elem,computed,extra){if(computed){
// certain elements can have dimension info if we invisibly show them
// however, it must have a current display style that would benefit from this
if(elem.offsetWidth===0&&rdisplayswap.test(curCSS(elem,"display"))){return jQuery.swap(elem,cssShow,function(){return getWidthOrHeight(elem,name,extra)})}else{return getWidthOrHeight(elem,name,extra)}}},set:function(elem,value,extra){return setPositiveNumber(elem,value,extra?augmentWidthOrHeight(elem,name,extra,jQuery.support.boxSizing&&jQuery.css(elem,"boxSizing")==="border-box"):0)}}});if(!jQuery.support.opacity){jQuery.cssHooks.opacity={get:function(elem,computed){
// IE uses filters for opacity
return ropacity.test((computed&&elem.currentStyle?elem.currentStyle.filter:elem.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":computed?"1":""},set:function(elem,value){var style=elem.style,currentStyle=elem.currentStyle,opacity=jQuery.isNumeric(value)?"alpha(opacity="+value*100+")":"",filter=currentStyle&&currentStyle.filter||style.filter||"";
// IE has trouble with opacity if it does not have layout
// Force it by setting the zoom level
style.zoom=1;
// if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652
if(value>=1&&jQuery.trim(filter.replace(ralpha,""))===""&&style.removeAttribute){
// Setting style.filter to null, "" & " " still leave "filter:" in the cssText
// if "filter:" is present at all, clearType is disabled, we want to avoid this
// style.removeAttribute is IE Only, but so apparently is this code path...
style.removeAttribute("filter");
// if there there is no filter style applied in a css rule, we are done
if(currentStyle&&!currentStyle.filter){return}}
// otherwise, set new filter values
style.filter=ralpha.test(filter)?filter.replace(ralpha,opacity):filter+" "+opacity}}}
// These hooks cannot be added until DOM ready because the support test
// for it is not run until after DOM ready
jQuery(function(){if(!jQuery.support.reliableMarginRight){jQuery.cssHooks.marginRight={get:function(elem,computed){
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
// Work around by temporarily setting element display to inline-block
return jQuery.swap(elem,{display:"inline-block"},function(){if(computed){return curCSS(elem,"marginRight")}})}}}
// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
// getComputedStyle returns percent when specified for top/left/bottom/right
// rather than make the css module depend on the offset module, we just check for it here
if(!jQuery.support.pixelPosition&&jQuery.fn.position){jQuery.each(["top","left"],function(i,prop){jQuery.cssHooks[prop]={get:function(elem,computed){if(computed){var ret=curCSS(elem,prop);
// if curCSS returns percentage, fallback to offset
return rnumnonpx.test(ret)?jQuery(elem).position()[prop]+"px":ret}}}})}});if(jQuery.expr&&jQuery.expr.filters){jQuery.expr.filters.hidden=function(elem){return elem.offsetWidth===0&&elem.offsetHeight===0||!jQuery.support.reliableHiddenOffsets&&(elem.style&&elem.style.display||curCSS(elem,"display"))==="none"};jQuery.expr.filters.visible=function(elem){return!jQuery.expr.filters.hidden(elem)}}
// These hooks are used by animate to expand properties
jQuery.each({margin:"",padding:"",border:"Width"},function(prefix,suffix){jQuery.cssHooks[prefix+suffix]={expand:function(value){var i,
// assumes a single number if not a string
parts=typeof value==="string"?value.split(" "):[value],expanded={};for(i=0;i<4;i++){expanded[prefix+cssExpand[i]+suffix]=parts[i]||parts[i-2]||parts[0]}return expanded}};if(!rmargin.test(prefix)){jQuery.cssHooks[prefix+suffix].set=setPositiveNumber}});var r20=/%20/g,rbracket=/\[\]$/,rCRLF=/\r?\n/g,rinput=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,rselectTextarea=/^(?:select|textarea)/i;jQuery.fn.extend({serialize:function(){return jQuery.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?jQuery.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||rselectTextarea.test(this.nodeName)||rinput.test(this.type))}).map(function(i,elem){var val=jQuery(this).val();return val==null?null:jQuery.isArray(val)?jQuery.map(val,function(val,i){return{name:elem.name,value:val.replace(rCRLF,"\r\n")}}):{name:elem.name,value:val.replace(rCRLF,"\r\n")}}).get()}});
//Serialize an array of form elements or a set of
//key/values into a query string
jQuery.param=function(a,traditional){var prefix,s=[],add=function(key,value){
// If value is a function, invoke it and return its value
value=jQuery.isFunction(value)?value():value==null?"":value;s[s.length]=encodeURIComponent(key)+"="+encodeURIComponent(value)};
// Set traditional to true for jQuery <= 1.3.2 behavior.
if(traditional===undefined){traditional=jQuery.ajaxSettings&&jQuery.ajaxSettings.traditional}
// If an array was passed in, assume that it is an array of form elements.
if(jQuery.isArray(a)||a.jquery&&!jQuery.isPlainObject(a)){
// Serialize the form elements
jQuery.each(a,function(){add(this.name,this.value)})}else{
// If traditional, encode the "old" way (the way 1.3.2 or older
// did it), otherwise encode params recursively.
for(prefix in a){buildParams(prefix,a[prefix],traditional,add)}}
// Return the resulting serialization
return s.join("&").replace(r20,"+")};function buildParams(prefix,obj,traditional,add){var name;if(jQuery.isArray(obj)){
// Serialize array item.
jQuery.each(obj,function(i,v){if(traditional||rbracket.test(prefix)){
// Treat each array item as a scalar.
add(prefix,v)}else{
// If array item is non-scalar (array or object), encode its
// numeric index to resolve deserialization ambiguity issues.
// Note that rack (as of 1.0.0) can't currently deserialize
// nested arrays properly, and attempting to do so may cause
// a server error. Possible fixes are to modify rack's
// deserialization algorithm or to provide an option or flag
// to force array serialization to be shallow.
buildParams(prefix+"["+(typeof v==="object"?i:"")+"]",v,traditional,add)}})}else if(!traditional&&jQuery.type(obj)==="object"){
// Serialize object item.
for(name in obj){buildParams(prefix+"["+name+"]",obj[name],traditional,add)}}else{
// Serialize scalar item.
add(prefix,obj)}}var// Document location
ajaxLocation,
// Document location segments
ajaxLocParts,rhash=/#.*$/,rheaders=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,// IE leaves an \r character at EOL
// #7653, #8125, #8152: local protocol detection
rlocalProtocol=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,rnoContent=/^(?:GET|HEAD)$/,rprotocol=/^\/\//,rquery=/\?/,rscript=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,rts=/([?&])_=[^&]*/,rurl=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,
// Keep a copy of the old load method
_load=jQuery.fn.load,
/* Prefilters
	 * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
	 * 2) These are called:
	 *    - BEFORE asking for a transport
	 *    - AFTER param serialization (s.data is a string if s.processData is true)
	 * 3) key is the dataType
	 * 4) the catchall symbol "*" can be used
	 * 5) execution will start with transport dataType and THEN continue down to "*" if needed
	 */
prefilters={},
/* Transports bindings
	 * 1) key is the dataType
	 * 2) the catchall symbol "*" can be used
	 * 3) selection will start with transport dataType and THEN go to "*" if needed
	 */
transports={},
// Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
allTypes=["*/"]+["*"];
// #8138, IE may throw an exception when accessing
// a field from window.location if document.domain has been set
try{ajaxLocation=location.href}catch(e){
// Use the href attribute of an A element
// since IE will modify it given document.location
ajaxLocation=document.createElement("a");ajaxLocation.href="";ajaxLocation=ajaxLocation.href}
// Segment location into parts
ajaxLocParts=rurl.exec(ajaxLocation.toLowerCase())||[];
// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
function addToPrefiltersOrTransports(structure){
// dataTypeExpression is optional and defaults to "*"
return function(dataTypeExpression,func){if(typeof dataTypeExpression!=="string"){func=dataTypeExpression;dataTypeExpression="*"}var dataType,list,placeBefore,dataTypes=dataTypeExpression.toLowerCase().split(core_rspace),i=0,length=dataTypes.length;if(jQuery.isFunction(func)){
// For each dataType in the dataTypeExpression
for(;i<length;i++){dataType=dataTypes[i];
// We control if we're asked to add before
// any existing element
placeBefore=/^\+/.test(dataType);if(placeBefore){dataType=dataType.substr(1)||"*"}list=structure[dataType]=structure[dataType]||[];
// then we add to the structure accordingly
list[placeBefore?"unshift":"push"](func)}}}}
// Base inspection function for prefilters and transports
function inspectPrefiltersOrTransports(structure,options,originalOptions,jqXHR,dataType/* internal */,inspected/* internal */){dataType=dataType||options.dataTypes[0];inspected=inspected||{};inspected[dataType]=true;var selection,list=structure[dataType],i=0,length=list?list.length:0,executeOnly=structure===prefilters;for(;i<length&&(executeOnly||!selection);i++){selection=list[i](options,originalOptions,jqXHR);
// If we got redirected to another dataType
// we try there if executing only and not done already
if(typeof selection==="string"){if(!executeOnly||inspected[selection]){selection=undefined}else{options.dataTypes.unshift(selection);selection=inspectPrefiltersOrTransports(structure,options,originalOptions,jqXHR,selection,inspected)}}}
// If we're only executing or nothing was selected
// we try the catchall dataType if not done already
if((executeOnly||!selection)&&!inspected["*"]){selection=inspectPrefiltersOrTransports(structure,options,originalOptions,jqXHR,"*",inspected)}
// unnecessary when only executing (prefilters)
// but it'll be ignored by the caller in that case
return selection}
// A special extend for ajax options
// that takes "flat" options (not to be deep extended)
// Fixes #9887
function ajaxExtend(target,src){var key,deep,flatOptions=jQuery.ajaxSettings.flatOptions||{};for(key in src){if(src[key]!==undefined){(flatOptions[key]?target:deep||(deep={}))[key]=src[key]}}if(deep){jQuery.extend(true,target,deep)}}jQuery.fn.load=function(url,params,callback){if(typeof url!=="string"&&_load){return _load.apply(this,arguments)}
// Don't do a request if no elements are being requested
if(!this.length){return this}var selector,type,response,self=this,off=url.indexOf(" ");if(off>=0){selector=url.slice(off,url.length);url=url.slice(0,off)}
// If it's a function
if(jQuery.isFunction(params)){
// We assume that it's the callback
callback=params;params=undefined;
// Otherwise, build a param string
}else if(params&&typeof params==="object"){type="POST"}
// Request the remote document
jQuery.ajax({url:url,
// if "type" variable is undefined, then "GET" method will be used
type:type,dataType:"html",data:params,complete:function(jqXHR,status){if(callback){self.each(callback,response||[jqXHR.responseText,status,jqXHR])}}}).done(function(responseText){
// Save response for use in complete callback
response=arguments;
// See if a selector was specified
self.html(selector?
// Create a dummy div to hold the results
jQuery("<div>").append(responseText.replace(rscript,"")).find(selector):
// If not, just inject the full result
responseText)});return this};
// Attach a bunch of functions for handling common AJAX events
jQuery.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(i,o){jQuery.fn[o]=function(f){return this.on(o,f)}});jQuery.each(["get","post"],function(i,method){jQuery[method]=function(url,data,callback,type){
// shift arguments if data argument was omitted
if(jQuery.isFunction(data)){type=type||callback;callback=data;data=undefined}return jQuery.ajax({type:method,url:url,data:data,success:callback,dataType:type})}});jQuery.extend({getScript:function(url,callback){return jQuery.get(url,undefined,callback,"script")},getJSON:function(url,data,callback){return jQuery.get(url,data,callback,"json")},
// Creates a full fledged settings object into target
// with both ajaxSettings and settings fields.
// If target is omitted, writes into ajaxSettings.
ajaxSetup:function(target,settings){if(settings){
// Building a settings object
ajaxExtend(target,jQuery.ajaxSettings)}else{
// Extending ajaxSettings
settings=target;target=jQuery.ajaxSettings}ajaxExtend(target,settings);return target},ajaxSettings:{url:ajaxLocation,isLocal:rlocalProtocol.test(ajaxLocParts[1]),global:true,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:true,async:true,
/*
		timeout: 0,
		data: null,
		dataType: null,
		username: null,
		password: null,
		cache: null,
		throws: false,
		traditional: false,
		headers: {},
		*/
accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":allTypes},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},
// List of data converters
// 1) key format is "source_type destination_type" (a single space in-between)
// 2) the catchall symbol "*" can be used for source_type
converters:{
// Convert anything to text
"* text":window.String,
// Text to html (true = no transformation)
"text html":true,
// Evaluate text as a json expression
"text json":jQuery.parseJSON,
// Parse text as xml
"text xml":jQuery.parseXML},
// For options that shouldn't be deep extended:
// you can add your own custom options here if
// and when you create one that shouldn't be
// deep extended (see ajaxExtend)
flatOptions:{context:true,url:true}},ajaxPrefilter:addToPrefiltersOrTransports(prefilters),ajaxTransport:addToPrefiltersOrTransports(transports),
// Main method
ajax:function(url,options){
// If url is an object, simulate pre-1.5 signature
if(typeof url==="object"){options=url;url=undefined}
// Force options to be an object
options=options||{};var// ifModified key
ifModifiedKey,
// Response headers
responseHeadersString,responseHeaders,
// transport
transport,
// timeout handle
timeoutTimer,
// Cross-domain detection vars
parts,
// To know if global events are to be dispatched
fireGlobals,
// Loop variable
i,
// Create the final options object
s=jQuery.ajaxSetup({},options),
// Callbacks context
callbackContext=s.context||s,
// Context for global events
// It's the callbackContext if one was provided in the options
// and if it's a DOM node or a jQuery collection
globalEventContext=callbackContext!==s&&(callbackContext.nodeType||callbackContext instanceof jQuery)?jQuery(callbackContext):jQuery.event,
// Deferreds
deferred=jQuery.Deferred(),completeDeferred=jQuery.Callbacks("once memory"),
// Status-dependent callbacks
statusCode=s.statusCode||{},
// Headers (they are sent all at once)
requestHeaders={},requestHeadersNames={},
// The jqXHR state
state=0,
// Default abort message
strAbort="canceled",
// Fake xhr
jqXHR={readyState:0,
// Caches the header
setRequestHeader:function(name,value){if(!state){var lname=name.toLowerCase();name=requestHeadersNames[lname]=requestHeadersNames[lname]||name;requestHeaders[name]=value}return this},
// Raw string
getAllResponseHeaders:function(){return state===2?responseHeadersString:null},
// Builds headers hashtable if needed
getResponseHeader:function(key){var match;if(state===2){if(!responseHeaders){responseHeaders={};while(match=rheaders.exec(responseHeadersString)){responseHeaders[match[1].toLowerCase()]=match[2]}}match=responseHeaders[key.toLowerCase()]}return match===undefined?null:match},
// Overrides response content-type header
overrideMimeType:function(type){if(!state){s.mimeType=type}return this},
// Cancel the request
abort:function(statusText){statusText=statusText||strAbort;if(transport){transport.abort(statusText)}done(0,statusText);return this}};
// Callback for when everything is done
// It is defined here because jslint complains if it is declared
// at the end of the function (which would be more logical and readable)
function done(status,nativeStatusText,responses,headers){var isSuccess,success,error,response,modified,statusText=nativeStatusText;
// Called once
if(state===2){return}
// State is "done" now
state=2;
// Clear timeout if it exists
if(timeoutTimer){clearTimeout(timeoutTimer)}
// Dereference transport for early garbage collection
// (no matter how long the jqXHR object will be used)
transport=undefined;
// Cache response headers
responseHeadersString=headers||"";
// Set readyState
jqXHR.readyState=status>0?4:0;
// Get response data
if(responses){response=ajaxHandleResponses(s,jqXHR,responses)}
// If successful, handle type chaining
if(status>=200&&status<300||status===304){
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
if(s.ifModified){modified=jqXHR.getResponseHeader("Last-Modified");if(modified){jQuery.lastModified[ifModifiedKey]=modified}modified=jqXHR.getResponseHeader("Etag");if(modified){jQuery.etag[ifModifiedKey]=modified}}
// If not modified
if(status===304){statusText="notmodified";isSuccess=true;
// If we have data
}else{isSuccess=ajaxConvert(s,response);statusText=isSuccess.state;success=isSuccess.data;error=isSuccess.error;isSuccess=!error}}else{
// We extract error from statusText
// then normalize statusText and status for non-aborts
error=statusText;if(!statusText||status){statusText="error";if(status<0){status=0}}}
// Set data for the fake xhr object
jqXHR.status=status;jqXHR.statusText=""+(nativeStatusText||statusText);
// Success/Error
if(isSuccess){deferred.resolveWith(callbackContext,[success,statusText,jqXHR])}else{deferred.rejectWith(callbackContext,[jqXHR,statusText,error])}
// Status-dependent callbacks
jqXHR.statusCode(statusCode);statusCode=undefined;if(fireGlobals){globalEventContext.trigger("ajax"+(isSuccess?"Success":"Error"),[jqXHR,s,isSuccess?success:error])}
// Complete
completeDeferred.fireWith(callbackContext,[jqXHR,statusText]);if(fireGlobals){globalEventContext.trigger("ajaxComplete",[jqXHR,s]);
// Handle the global AJAX counter
if(!--jQuery.active){jQuery.event.trigger("ajaxStop")}}}
// Attach deferreds
deferred.promise(jqXHR);jqXHR.success=jqXHR.done;jqXHR.error=jqXHR.fail;jqXHR.complete=completeDeferred.add;
// Status-dependent callbacks
jqXHR.statusCode=function(map){if(map){var tmp;if(state<2){for(tmp in map){statusCode[tmp]=[statusCode[tmp],map[tmp]]}}else{tmp=map[jqXHR.status];jqXHR.always(tmp)}}return this};
// Remove hash character (#7531: and string promotion)
// Add protocol if not provided (#5866: IE7 issue with protocol-less urls)
// We also use the url parameter if available
s.url=((url||s.url)+"").replace(rhash,"").replace(rprotocol,ajaxLocParts[1]+"//");
// Extract dataTypes list
s.dataTypes=jQuery.trim(s.dataType||"*").toLowerCase().split(core_rspace);
// Determine if a cross-domain request is in order
if(s.crossDomain==null){parts=rurl.exec(s.url.toLowerCase());s.crossDomain=!!(parts&&(parts[1]!=ajaxLocParts[1]||parts[2]!=ajaxLocParts[2]||(parts[3]||(parts[1]==="http:"?80:443))!=(ajaxLocParts[3]||(ajaxLocParts[1]==="http:"?80:443))))}
// Convert data if not already a string
if(s.data&&s.processData&&typeof s.data!=="string"){s.data=jQuery.param(s.data,s.traditional)}
// Apply prefilters
inspectPrefiltersOrTransports(prefilters,s,options,jqXHR);
// If request was aborted inside a prefilter, stop there
if(state===2){return jqXHR}
// We can fire global events as of now if asked to
fireGlobals=s.global;
// Uppercase the type
s.type=s.type.toUpperCase();
// Determine if request has content
s.hasContent=!rnoContent.test(s.type);
// Watch for a new set of requests
if(fireGlobals&&jQuery.active++===0){jQuery.event.trigger("ajaxStart")}
// More options handling for requests with no content
if(!s.hasContent){
// If data is available, append data to url
if(s.data){s.url+=(rquery.test(s.url)?"&":"?")+s.data;
// #9682: remove data so that it's not used in an eventual retry
delete s.data}
// Get ifModifiedKey before adding the anti-cache parameter
ifModifiedKey=s.url;
// Add anti-cache in url if needed
if(s.cache===false){var ts=jQuery.now(),
// try replacing _= if it is there
ret=s.url.replace(rts,"$1_="+ts);
// if nothing was replaced, add timestamp to the end
s.url=ret+(ret===s.url?(rquery.test(s.url)?"&":"?")+"_="+ts:"")}}
// Set the correct header, if data is being sent
if(s.data&&s.hasContent&&s.contentType!==false||options.contentType){jqXHR.setRequestHeader("Content-Type",s.contentType)}
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
if(s.ifModified){ifModifiedKey=ifModifiedKey||s.url;if(jQuery.lastModified[ifModifiedKey]){jqXHR.setRequestHeader("If-Modified-Since",jQuery.lastModified[ifModifiedKey])}if(jQuery.etag[ifModifiedKey]){jqXHR.setRequestHeader("If-None-Match",jQuery.etag[ifModifiedKey])}}
// Set the Accepts header for the server, depending on the dataType
jqXHR.setRequestHeader("Accept",s.dataTypes[0]&&s.accepts[s.dataTypes[0]]?s.accepts[s.dataTypes[0]]+(s.dataTypes[0]!=="*"?", "+allTypes+"; q=0.01":""):s.accepts["*"]);
// Check for headers option
for(i in s.headers){jqXHR.setRequestHeader(i,s.headers[i])}
// Allow custom headers/mimetypes and early abort
if(s.beforeSend&&(s.beforeSend.call(callbackContext,jqXHR,s)===false||state===2)){
// Abort if not done already and return
return jqXHR.abort()}
// aborting is no longer a cancellation
strAbort="abort";
// Install callbacks on deferreds
for(i in{success:1,error:1,complete:1}){jqXHR[i](s[i])}
// Get transport
transport=inspectPrefiltersOrTransports(transports,s,options,jqXHR);
// If no transport, we auto-abort
if(!transport){done(-1,"No Transport")}else{jqXHR.readyState=1;
// Send global event
if(fireGlobals){globalEventContext.trigger("ajaxSend",[jqXHR,s])}
// Timeout
if(s.async&&s.timeout>0){timeoutTimer=setTimeout(function(){jqXHR.abort("timeout")},s.timeout)}try{state=1;transport.send(requestHeaders,done)}catch(e){
// Propagate exception as error if not done
if(state<2){done(-1,e);
// Simply rethrow otherwise
}else{throw e}}}return jqXHR},
// Counter for holding the number of active queries
active:0,
// Last-Modified header cache for next request
lastModified:{},etag:{}});
/* Handles responses to an ajax request:
 * - sets all responseXXX fields accordingly
 * - finds the right dataType (mediates between content-type and expected dataType)
 * - returns the corresponding response
 */function ajaxHandleResponses(s,jqXHR,responses){var ct,type,finalDataType,firstDataType,contents=s.contents,dataTypes=s.dataTypes,responseFields=s.responseFields;
// Fill responseXXX fields
for(type in responseFields){if(type in responses){jqXHR[responseFields[type]]=responses[type]}}
// Remove auto dataType and get content-type in the process
while(dataTypes[0]==="*"){dataTypes.shift();if(ct===undefined){ct=s.mimeType||jqXHR.getResponseHeader("content-type")}}
// Check if we're dealing with a known content-type
if(ct){for(type in contents){if(contents[type]&&contents[type].test(ct)){dataTypes.unshift(type);break}}}
// Check to see if we have a response for the expected dataType
if(dataTypes[0]in responses){finalDataType=dataTypes[0]}else{
// Try convertible dataTypes
for(type in responses){if(!dataTypes[0]||s.converters[type+" "+dataTypes[0]]){finalDataType=type;break}if(!firstDataType){firstDataType=type}}
// Or just use first one
finalDataType=finalDataType||firstDataType}
// If we found a dataType
// We add the dataType to the list if needed
// and return the corresponding response
if(finalDataType){if(finalDataType!==dataTypes[0]){dataTypes.unshift(finalDataType)}return responses[finalDataType]}}
// Chain conversions given the request and the original response
function ajaxConvert(s,response){var conv,conv2,current,tmp,
// Work with a copy of dataTypes in case we need to modify it for conversion
dataTypes=s.dataTypes.slice(),prev=dataTypes[0],converters={},i=0;
// Apply the dataFilter if provided
if(s.dataFilter){response=s.dataFilter(response,s.dataType)}
// Create converters map with lowercased keys
if(dataTypes[1]){for(conv in s.converters){converters[conv.toLowerCase()]=s.converters[conv]}}
// Convert to each sequential dataType, tolerating list modification
for(;current=dataTypes[++i];){
// There's only work to do if current dataType is non-auto
if(current!=="*"){
// Convert response if prev dataType is non-auto and differs from current
if(prev!=="*"&&prev!==current){
// Seek a direct converter
conv=converters[prev+" "+current]||converters["* "+current];
// If none found, seek a pair
if(!conv){for(conv2 in converters){
// If conv2 outputs current
tmp=conv2.split(" ");if(tmp[1]===current){
// If prev can be converted to accepted input
conv=converters[prev+" "+tmp[0]]||converters["* "+tmp[0]];if(conv){
// Condense equivalence converters
if(conv===true){conv=converters[conv2];
// Otherwise, insert the intermediate dataType
}else if(converters[conv2]!==true){current=tmp[0];dataTypes.splice(i--,0,current)}break}}}}
// Apply converter (if not an equivalence)
if(conv!==true){
// Unless errors are allowed to bubble, catch and return them
if(conv&&s["throws"]){response=conv(response)}else{try{response=conv(response)}catch(e){return{state:"parsererror",error:conv?e:"No conversion from "+prev+" to "+current}}}}}
// Update prev for next iteration
prev=current}}return{state:"success",data:response}}var oldCallbacks=[],rquestion=/\?/,rjsonp=/(=)\?(?=&|$)|\?\?/,nonce=jQuery.now();
// Default jsonp settings
jQuery.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var callback=oldCallbacks.pop()||jQuery.expando+"_"+nonce++;this[callback]=true;return callback}});
// Detect, normalize options and install callbacks for jsonp requests
jQuery.ajaxPrefilter("json jsonp",function(s,originalSettings,jqXHR){var callbackName,overwritten,responseContainer,data=s.data,url=s.url,hasCallback=s.jsonp!==false,replaceInUrl=hasCallback&&rjsonp.test(url),replaceInData=hasCallback&&!replaceInUrl&&typeof data==="string"&&!(s.contentType||"").indexOf("application/x-www-form-urlencoded")&&rjsonp.test(data);
// Handle iff the expected data type is "jsonp" or we have a parameter to set
if(s.dataTypes[0]==="jsonp"||replaceInUrl||replaceInData){
// Get callback name, remembering preexisting value associated with it
callbackName=s.jsonpCallback=jQuery.isFunction(s.jsonpCallback)?s.jsonpCallback():s.jsonpCallback;overwritten=window[callbackName];
// Insert callback into url or form data
if(replaceInUrl){s.url=url.replace(rjsonp,"$1"+callbackName)}else if(replaceInData){s.data=data.replace(rjsonp,"$1"+callbackName)}else if(hasCallback){s.url+=(rquestion.test(url)?"&":"?")+s.jsonp+"="+callbackName}
// Use data converter to retrieve json after script execution
s.converters["script json"]=function(){if(!responseContainer){jQuery.error(callbackName+" was not called")}return responseContainer[0]};
// force json dataType
s.dataTypes[0]="json";
// Install callback
window[callbackName]=function(){responseContainer=arguments};
// Clean-up function (fires after converters)
jqXHR.always(function(){
// Restore preexisting value
window[callbackName]=overwritten;
// Save back as free
if(s[callbackName]){
// make sure that re-using the options doesn't screw things around
s.jsonpCallback=originalSettings.jsonpCallback;
// save the callback name for future use
oldCallbacks.push(callbackName)}
// Call if it was a function and we have a response
if(responseContainer&&jQuery.isFunction(overwritten)){overwritten(responseContainer[0])}responseContainer=overwritten=undefined});
// Delegate to script
return"script"}});
// Install script dataType
jQuery.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(text){jQuery.globalEval(text);return text}}});
// Handle cache's special case and global
jQuery.ajaxPrefilter("script",function(s){if(s.cache===undefined){s.cache=false}if(s.crossDomain){s.type="GET";s.global=false}});
// Bind script tag hack transport
jQuery.ajaxTransport("script",function(s){
// This transport only deals with cross domain requests
if(s.crossDomain){var script,head=document.head||document.getElementsByTagName("head")[0]||document.documentElement;return{send:function(_,callback){script=document.createElement("script");script.async="async";if(s.scriptCharset){script.charset=s.scriptCharset}script.src=s.url;
// Attach handlers for all browsers
script.onload=script.onreadystatechange=function(_,isAbort){if(isAbort||!script.readyState||/loaded|complete/.test(script.readyState)){
// Handle memory leak in IE
script.onload=script.onreadystatechange=null;
// Remove the script
if(head&&script.parentNode){head.removeChild(script)}
// Dereference the script
script=undefined;
// Callback if not abort
if(!isAbort){callback(200,"success")}}};
// Use insertBefore instead of appendChild  to circumvent an IE6 bug.
// This arises when a base node is used (#2709 and #4378).
head.insertBefore(script,head.firstChild)},abort:function(){if(script){script.onload(0,1)}}}}});var xhrCallbacks,
// #5280: Internet Explorer will keep connections alive if we don't abort on unload
xhrOnUnloadAbort=window.ActiveXObject?function(){
// Abort all pending requests
for(var key in xhrCallbacks){xhrCallbacks[key](0,1)}}:false,xhrId=0;
// Functions to create xhrs
function createStandardXHR(){try{return new window.XMLHttpRequest}catch(e){}}function createActiveXHR(){try{return new window.ActiveXObject("Microsoft.XMLHTTP")}catch(e){}}
// Create the request object
// (This is still attached to ajaxSettings for backward compatibility)
jQuery.ajaxSettings.xhr=window.ActiveXObject?
/* Microsoft failed to properly
	 * implement the XMLHttpRequest in IE7 (can't request local files),
	 * so we use the ActiveXObject when it is available
	 * Additionally XMLHttpRequest can be disabled in IE7/IE8 so
	 * we need a fallback.
	 */
function(){return!this.isLocal&&createStandardXHR()||createActiveXHR()}:
// For all other browsers, use the standard XMLHttpRequest object
createStandardXHR;
// Determine support properties
(function(xhr){jQuery.extend(jQuery.support,{ajax:!!xhr,cors:!!xhr&&"withCredentials"in xhr})})(jQuery.ajaxSettings.xhr());
// Create transport if the browser can provide an xhr
if(jQuery.support.ajax){jQuery.ajaxTransport(function(s){
// Cross domain only allowed if supported through XMLHttpRequest
if(!s.crossDomain||jQuery.support.cors){var callback;return{send:function(headers,complete){
// Get a new xhr
var handle,i,xhr=s.xhr();
// Open the socket
// Passing null username, generates a login popup on Opera (#2865)
if(s.username){xhr.open(s.type,s.url,s.async,s.username,s.password)}else{xhr.open(s.type,s.url,s.async)}
// Apply custom fields if provided
if(s.xhrFields){for(i in s.xhrFields){xhr[i]=s.xhrFields[i]}}
// Override mime type if needed
if(s.mimeType&&xhr.overrideMimeType){xhr.overrideMimeType(s.mimeType)}
// X-Requested-With header
// For cross-domain requests, seeing as conditions for a preflight are
// akin to a jigsaw puzzle, we simply never set it to be sure.
// (it can always be set on a per-request basis or even using ajaxSetup)
// For same-domain requests, won't change header if already provided.
if(!s.crossDomain&&!headers["X-Requested-With"]){headers["X-Requested-With"]="XMLHttpRequest"}
// Need an extra try/catch for cross domain requests in Firefox 3
try{for(i in headers){xhr.setRequestHeader(i,headers[i])}}catch(_){}
// Do send the request
// This may raise an exception which is actually
// handled in jQuery.ajax (so no try/catch here)
xhr.send(s.hasContent&&s.data||null);
// Listener
callback=function(_,isAbort){var status,statusText,responseHeaders,responses,xml;
// Firefox throws exceptions when accessing properties
// of an xhr when a network error occurred
// http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE)
try{
// Was never called and is aborted or complete
if(callback&&(isAbort||xhr.readyState===4)){
// Only called once
callback=undefined;
// Do not keep as active anymore
if(handle){xhr.onreadystatechange=jQuery.noop;if(xhrOnUnloadAbort){delete xhrCallbacks[handle]}}
// If it's an abort
if(isAbort){
// Abort it manually if needed
if(xhr.readyState!==4){xhr.abort()}}else{status=xhr.status;responseHeaders=xhr.getAllResponseHeaders();responses={};xml=xhr.responseXML;
// Construct response list
if(xml&&xml.documentElement/* #4958 */){responses.xml=xml}
// When requesting binary data, IE6-9 will throw an exception
// on any attempt to access responseText (#11426)
try{responses.text=xhr.responseText}catch(_){}
// Firefox throws an exception when accessing
// statusText for faulty cross-domain requests
try{statusText=xhr.statusText}catch(e){
// We normalize with Webkit giving an empty statusText
statusText=""}
// Filter status for non standard behaviors
// If the request is local and we have data: assume a success
// (success with no data won't get notified, that's the best we
// can do given current implementations)
if(!status&&s.isLocal&&!s.crossDomain){status=responses.text?200:404;
// IE - #1450: sometimes returns 1223 when it should be 204
}else if(status===1223){status=204}}}}catch(firefoxAccessException){if(!isAbort){complete(-1,firefoxAccessException)}}
// Call complete if needed
if(responses){complete(status,statusText,responses,responseHeaders)}};if(!s.async){
// if we're in sync mode we fire the callback
callback()}else if(xhr.readyState===4){
// (IE6 & IE7) if it's in cache and has been
// retrieved directly we need to fire the callback
setTimeout(callback,0)}else{handle=++xhrId;if(xhrOnUnloadAbort){
// Create the active xhrs callbacks list if needed
// and attach the unload handler
if(!xhrCallbacks){xhrCallbacks={};jQuery(window).unload(xhrOnUnloadAbort)}
// Add to list of active xhrs callbacks
xhrCallbacks[handle]=callback}xhr.onreadystatechange=callback}},abort:function(){if(callback){callback(0,1)}}}}})}var fxNow,timerId,rfxtypes=/^(?:toggle|show|hide)$/,rfxnum=new RegExp("^(?:([-+])=|)("+core_pnum+")([a-z%]*)$","i"),rrun=/queueHooks$/,animationPrefilters=[defaultPrefilter],tweeners={"*":[function(prop,value){var end,unit,prevScale,tween=this.createTween(prop,value),parts=rfxnum.exec(value),target=tween.cur(),start=+target||0,scale=1;if(parts){end=+parts[2];unit=parts[3]||(jQuery.cssNumber[prop]?"":"px");
// We need to compute starting value
if(unit!=="px"&&start){
// Iteratively approximate from a nonzero starting point
// Prefer the current property, because this process will be trivial if it uses the same units
// Fallback to end or a simple constant
start=jQuery.css(tween.elem,prop,true)||end||1;do{
// If previous iteration zeroed out, double until we get *something*
// Use a string for doubling factor so we don't accidentally see scale as unchanged below
prevScale=scale=scale||".5";
// Adjust and apply
start=start/scale;jQuery.style(tween.elem,prop,start+unit);
// Update scale, tolerating zeroes from tween.cur()
scale=tween.cur()/target;
// Stop looping if we've hit the mark or scale is unchanged
}while(scale!==1&&scale!==prevScale)}tween.unit=unit;tween.start=start;
// If a +=/-= token was provided, we're doing a relative animation
tween.end=parts[1]?start+(parts[1]+1)*end:end}return tween}]};
// Animations created synchronously will run synchronously
function createFxNow(){setTimeout(function(){fxNow=undefined},0);return fxNow=jQuery.now()}function createTweens(animation,props){jQuery.each(props,function(prop,value){var collection=(tweeners[prop]||[]).concat(tweeners["*"]),index=0,length=collection.length;for(;index<length;index++){if(collection[index].call(animation,prop,value)){
// we're done with this property
return}}})}function Animation(elem,properties,options){var result,index=0,tweenerIndex=0,length=animationPrefilters.length,deferred=jQuery.Deferred().always(function(){
// don't match elem in the :animated selector
delete tick.elem}),tick=function(){var currentTime=fxNow||createFxNow(),remaining=Math.max(0,animation.startTime+animation.duration-currentTime),percent=1-(remaining/animation.duration||0),index=0,length=animation.tweens.length;for(;index<length;index++){animation.tweens[index].run(percent)}deferred.notifyWith(elem,[animation,percent,remaining]);if(percent<1&&length){return remaining}else{deferred.resolveWith(elem,[animation]);return false}},animation=deferred.promise({elem:elem,props:jQuery.extend({},properties),opts:jQuery.extend(true,{specialEasing:{}},options),originalProperties:properties,originalOptions:options,startTime:fxNow||createFxNow(),duration:options.duration,tweens:[],createTween:function(prop,end,easing){var tween=jQuery.Tween(elem,animation.opts,prop,end,animation.opts.specialEasing[prop]||animation.opts.easing);animation.tweens.push(tween);return tween},stop:function(gotoEnd){var index=0,
// if we are going to the end, we want to run all the tweens
// otherwise we skip this part
length=gotoEnd?animation.tweens.length:0;for(;index<length;index++){animation.tweens[index].run(1)}
// resolve when we played the last frame
// otherwise, reject
if(gotoEnd){deferred.resolveWith(elem,[animation,gotoEnd])}else{deferred.rejectWith(elem,[animation,gotoEnd])}return this}}),props=animation.props;propFilter(props,animation.opts.specialEasing);for(;index<length;index++){result=animationPrefilters[index].call(animation,elem,props,animation.opts);if(result){return result}}createTweens(animation,props);if(jQuery.isFunction(animation.opts.start)){animation.opts.start.call(elem,animation)}jQuery.fx.timer(jQuery.extend(tick,{anim:animation,queue:animation.opts.queue,elem:elem}));
// attach callbacks from options
return animation.progress(animation.opts.progress).done(animation.opts.done,animation.opts.complete).fail(animation.opts.fail).always(animation.opts.always)}function propFilter(props,specialEasing){var index,name,easing,value,hooks;
// camelCase, specialEasing and expand cssHook pass
for(index in props){name=jQuery.camelCase(index);easing=specialEasing[name];value=props[index];if(jQuery.isArray(value)){easing=value[1];value=props[index]=value[0]}if(index!==name){props[name]=value;delete props[index]}hooks=jQuery.cssHooks[name];if(hooks&&"expand"in hooks){value=hooks.expand(value);delete props[name];
// not quite $.extend, this wont overwrite keys already present.
// also - reusing 'index' from above because we have the correct "name"
for(index in value){if(!(index in props)){props[index]=value[index];specialEasing[index]=easing}}}else{specialEasing[name]=easing}}}jQuery.Animation=jQuery.extend(Animation,{tweener:function(props,callback){if(jQuery.isFunction(props)){callback=props;props=["*"]}else{props=props.split(" ")}var prop,index=0,length=props.length;for(;index<length;index++){prop=props[index];tweeners[prop]=tweeners[prop]||[];tweeners[prop].unshift(callback)}},prefilter:function(callback,prepend){if(prepend){animationPrefilters.unshift(callback)}else{animationPrefilters.push(callback)}}});function defaultPrefilter(elem,props,opts){var index,prop,value,length,dataShow,tween,hooks,oldfire,anim=this,style=elem.style,orig={},handled=[],hidden=elem.nodeType&&isHidden(elem);
// handle queue: false promises
if(!opts.queue){hooks=jQuery._queueHooks(elem,"fx");if(hooks.unqueued==null){hooks.unqueued=0;oldfire=hooks.empty.fire;hooks.empty.fire=function(){if(!hooks.unqueued){oldfire()}}}hooks.unqueued++;anim.always(function(){
// doing this makes sure that the complete handler will be called
// before this completes
anim.always(function(){hooks.unqueued--;if(!jQuery.queue(elem,"fx").length){hooks.empty.fire()}})})}
// height/width overflow pass
if(elem.nodeType===1&&("height"in props||"width"in props)){
// Make sure that nothing sneaks out
// Record all 3 overflow attributes because IE does not
// change the overflow attribute when overflowX and
// overflowY are set to the same value
opts.overflow=[style.overflow,style.overflowX,style.overflowY];
// Set display property to inline-block for height/width
// animations on inline elements that are having width/height animated
if(jQuery.css(elem,"display")==="inline"&&jQuery.css(elem,"float")==="none"){
// inline-level elements accept inline-block;
// block-level elements need to be inline with layout
if(!jQuery.support.inlineBlockNeedsLayout||css_defaultDisplay(elem.nodeName)==="inline"){style.display="inline-block"}else{style.zoom=1}}}if(opts.overflow){style.overflow="hidden";if(!jQuery.support.shrinkWrapBlocks){anim.done(function(){style.overflow=opts.overflow[0];style.overflowX=opts.overflow[1];style.overflowY=opts.overflow[2]})}}
// show/hide pass
for(index in props){value=props[index];if(rfxtypes.exec(value)){delete props[index];if(value===(hidden?"hide":"show")){continue}handled.push(index)}}length=handled.length;if(length){dataShow=jQuery._data(elem,"fxshow")||jQuery._data(elem,"fxshow",{});if(hidden){jQuery(elem).show()}else{anim.done(function(){jQuery(elem).hide()})}anim.done(function(){var prop;jQuery.removeData(elem,"fxshow",true);for(prop in orig){jQuery.style(elem,prop,orig[prop])}});for(index=0;index<length;index++){prop=handled[index];tween=anim.createTween(prop,hidden?dataShow[prop]:0);orig[prop]=dataShow[prop]||jQuery.style(elem,prop);if(!(prop in dataShow)){dataShow[prop]=tween.start;if(hidden){tween.end=tween.start;tween.start=prop==="width"||prop==="height"?1:0}}}}}function Tween(elem,options,prop,end,easing){return new Tween.prototype.init(elem,options,prop,end,easing)}jQuery.Tween=Tween;Tween.prototype={constructor:Tween,init:function(elem,options,prop,end,easing,unit){this.elem=elem;this.prop=prop;this.easing=easing||"swing";this.options=options;this.start=this.now=this.cur();this.end=end;this.unit=unit||(jQuery.cssNumber[prop]?"":"px")},cur:function(){var hooks=Tween.propHooks[this.prop];return hooks&&hooks.get?hooks.get(this):Tween.propHooks._default.get(this)},run:function(percent){var eased,hooks=Tween.propHooks[this.prop];if(this.options.duration){this.pos=eased=jQuery.easing[this.easing](percent,this.options.duration*percent,0,1,this.options.duration)}else{this.pos=eased=percent}this.now=(this.end-this.start)*eased+this.start;if(this.options.step){this.options.step.call(this.elem,this.now,this)}if(hooks&&hooks.set){hooks.set(this)}else{Tween.propHooks._default.set(this)}return this}};Tween.prototype.init.prototype=Tween.prototype;Tween.propHooks={_default:{get:function(tween){var result;if(tween.elem[tween.prop]!=null&&(!tween.elem.style||tween.elem.style[tween.prop]==null)){return tween.elem[tween.prop]}
// passing any value as a 4th parameter to .css will automatically
// attempt a parseFloat and fallback to a string if the parse fails
// so, simple values such as "10px" are parsed to Float.
// complex values such as "rotate(1rad)" are returned as is.
result=jQuery.css(tween.elem,tween.prop,false,"");
// Empty strings, null, undefined and "auto" are converted to 0.
return!result||result==="auto"?0:result},set:function(tween){
// use step hook for back compat - use cssHook if its there - use .style if its
// available and use plain properties where available
if(jQuery.fx.step[tween.prop]){jQuery.fx.step[tween.prop](tween)}else if(tween.elem.style&&(tween.elem.style[jQuery.cssProps[tween.prop]]!=null||jQuery.cssHooks[tween.prop])){jQuery.style(tween.elem,tween.prop,tween.now+tween.unit)}else{tween.elem[tween.prop]=tween.now}}}};
// Remove in 2.0 - this supports IE8's panic based approach
// to setting things on disconnected nodes
Tween.propHooks.scrollTop=Tween.propHooks.scrollLeft={set:function(tween){if(tween.elem.nodeType&&tween.elem.parentNode){tween.elem[tween.prop]=tween.now}}};jQuery.each(["toggle","show","hide"],function(i,name){var cssFn=jQuery.fn[name];jQuery.fn[name]=function(speed,easing,callback){return speed==null||typeof speed==="boolean"||
// special check for .toggle( handler, handler, ... )
!i&&jQuery.isFunction(speed)&&jQuery.isFunction(easing)?cssFn.apply(this,arguments):this.animate(genFx(name,true),speed,easing,callback)}});jQuery.fn.extend({fadeTo:function(speed,to,easing,callback){
// show any hidden elements after setting opacity to 0
return this.filter(isHidden).css("opacity",0).show().end().animate({opacity:to},speed,easing,callback)},animate:function(prop,speed,easing,callback){var empty=jQuery.isEmptyObject(prop),optall=jQuery.speed(speed,easing,callback),doAnimation=function(){
// Operate on a copy of prop so per-property easing won't be lost
var anim=Animation(this,jQuery.extend({},prop),optall);
// Empty animations resolve immediately
if(empty){anim.stop(true)}};return empty||optall.queue===false?this.each(doAnimation):this.queue(optall.queue,doAnimation)},stop:function(type,clearQueue,gotoEnd){var stopQueue=function(hooks){var stop=hooks.stop;delete hooks.stop;stop(gotoEnd)};if(typeof type!=="string"){gotoEnd=clearQueue;clearQueue=type;type=undefined}if(clearQueue&&type!==false){this.queue(type||"fx",[])}return this.each(function(){var dequeue=true,index=type!=null&&type+"queueHooks",timers=jQuery.timers,data=jQuery._data(this);if(index){if(data[index]&&data[index].stop){stopQueue(data[index])}}else{for(index in data){if(data[index]&&data[index].stop&&rrun.test(index)){stopQueue(data[index])}}}for(index=timers.length;index--;){if(timers[index].elem===this&&(type==null||timers[index].queue===type)){timers[index].anim.stop(gotoEnd);dequeue=false;timers.splice(index,1)}}
// start the next in the queue if the last step wasn't forced
// timers currently will call their complete callbacks, which will dequeue
// but only if they were gotoEnd
if(dequeue||!gotoEnd){jQuery.dequeue(this,type)}})}});
// Generate parameters to create a standard animation
function genFx(type,includeWidth){var which,attrs={height:type},i=0;
// if we include width, step value is 1 to do all cssExpand values,
// if we don't include width, step value is 2 to skip over Left and Right
includeWidth=includeWidth?1:0;for(;i<4;i+=2-includeWidth){which=cssExpand[i];attrs["margin"+which]=attrs["padding"+which]=type}if(includeWidth){attrs.opacity=attrs.width=type}return attrs}
// Generate shortcuts for custom animations
jQuery.each({slideDown:genFx("show"),slideUp:genFx("hide"),slideToggle:genFx("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(name,props){jQuery.fn[name]=function(speed,easing,callback){return this.animate(props,speed,easing,callback)}});jQuery.speed=function(speed,easing,fn){var opt=speed&&typeof speed==="object"?jQuery.extend({},speed):{complete:fn||!fn&&easing||jQuery.isFunction(speed)&&speed,duration:speed,easing:fn&&easing||easing&&!jQuery.isFunction(easing)&&easing};opt.duration=jQuery.fx.off?0:typeof opt.duration==="number"?opt.duration:opt.duration in jQuery.fx.speeds?jQuery.fx.speeds[opt.duration]:jQuery.fx.speeds._default;
// normalize opt.queue - true/undefined/null -> "fx"
if(opt.queue==null||opt.queue===true){opt.queue="fx"}
// Queueing
opt.old=opt.complete;opt.complete=function(){if(jQuery.isFunction(opt.old)){opt.old.call(this)}if(opt.queue){jQuery.dequeue(this,opt.queue)}};return opt};jQuery.easing={linear:function(p){return p},swing:function(p){return.5-Math.cos(p*Math.PI)/2}};jQuery.timers=[];jQuery.fx=Tween.prototype.init;jQuery.fx.tick=function(){var timer,timers=jQuery.timers,i=0;for(;i<timers.length;i++){timer=timers[i];
// Checks the timer has not already been removed
if(!timer()&&timers[i]===timer){timers.splice(i--,1)}}if(!timers.length){jQuery.fx.stop()}};jQuery.fx.timer=function(timer){if(timer()&&jQuery.timers.push(timer)&&!timerId){timerId=setInterval(jQuery.fx.tick,jQuery.fx.interval)}};jQuery.fx.interval=13;jQuery.fx.stop=function(){clearInterval(timerId);timerId=null};jQuery.fx.speeds={slow:600,fast:200,
// Default speed
_default:400};
// Back Compat <1.8 extension point
jQuery.fx.step={};if(jQuery.expr&&jQuery.expr.filters){jQuery.expr.filters.animated=function(elem){return jQuery.grep(jQuery.timers,function(fn){return elem===fn.elem}).length}}var rroot=/^(?:body|html)$/i;jQuery.fn.offset=function(options){if(arguments.length){return options===undefined?this:this.each(function(i){jQuery.offset.setOffset(this,options,i)})}var box,docElem,body,win,clientTop,clientLeft,scrollTop,scrollLeft,top,left,elem=this[0],doc=elem&&elem.ownerDocument;if(!doc){return}if((body=doc.body)===elem){return jQuery.offset.bodyOffset(elem)}docElem=doc.documentElement;
// Make sure we're not dealing with a disconnected DOM node
if(!jQuery.contains(docElem,elem)){return{top:0,left:0}}box=elem.getBoundingClientRect();win=getWindow(doc);clientTop=docElem.clientTop||body.clientTop||0;clientLeft=docElem.clientLeft||body.clientLeft||0;scrollTop=win.pageYOffset||docElem.scrollTop;scrollLeft=win.pageXOffset||docElem.scrollLeft;top=box.top+scrollTop-clientTop;left=box.left+scrollLeft-clientLeft;return{top:top,left:left}};jQuery.offset={bodyOffset:function(body){var top=body.offsetTop,left=body.offsetLeft;if(jQuery.support.doesNotIncludeMarginInBodyOffset){top+=parseFloat(jQuery.css(body,"marginTop"))||0;left+=parseFloat(jQuery.css(body,"marginLeft"))||0}return{top:top,left:left}},setOffset:function(elem,options,i){var position=jQuery.css(elem,"position");
// set position first, in-case top/left are set even on static elem
if(position==="static"){elem.style.position="relative"}var curElem=jQuery(elem),curOffset=curElem.offset(),curCSSTop=jQuery.css(elem,"top"),curCSSLeft=jQuery.css(elem,"left"),calculatePosition=(position==="absolute"||position==="fixed")&&jQuery.inArray("auto",[curCSSTop,curCSSLeft])>-1,props={},curPosition={},curTop,curLeft;
// need to be able to calculate position if either top or left is auto and position is either absolute or fixed
if(calculatePosition){curPosition=curElem.position();curTop=curPosition.top;curLeft=curPosition.left}else{curTop=parseFloat(curCSSTop)||0;curLeft=parseFloat(curCSSLeft)||0}if(jQuery.isFunction(options)){options=options.call(elem,i,curOffset)}if(options.top!=null){props.top=options.top-curOffset.top+curTop}if(options.left!=null){props.left=options.left-curOffset.left+curLeft}if("using"in options){options.using.call(elem,props)}else{curElem.css(props)}}};jQuery.fn.extend({position:function(){if(!this[0]){return}var elem=this[0],
// Get *real* offsetParent
offsetParent=this.offsetParent(),
// Get correct offsets
offset=this.offset(),parentOffset=rroot.test(offsetParent[0].nodeName)?{top:0,left:0}:offsetParent.offset();
// Subtract element margins
// note: when an element has margin: auto the offsetLeft and marginLeft
// are the same in Safari causing offset.left to incorrectly be 0
offset.top-=parseFloat(jQuery.css(elem,"marginTop"))||0;offset.left-=parseFloat(jQuery.css(elem,"marginLeft"))||0;
// Add offsetParent borders
parentOffset.top+=parseFloat(jQuery.css(offsetParent[0],"borderTopWidth"))||0;parentOffset.left+=parseFloat(jQuery.css(offsetParent[0],"borderLeftWidth"))||0;
// Subtract the two offsets
return{top:offset.top-parentOffset.top,left:offset.left-parentOffset.left}},offsetParent:function(){return this.map(function(){var offsetParent=this.offsetParent||document.body;while(offsetParent&&(!rroot.test(offsetParent.nodeName)&&jQuery.css(offsetParent,"position")==="static")){offsetParent=offsetParent.offsetParent}return offsetParent||document.body})}});
// Create scrollLeft and scrollTop methods
jQuery.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(method,prop){var top=/Y/.test(prop);jQuery.fn[method]=function(val){return jQuery.access(this,function(elem,method,val){var win=getWindow(elem);if(val===undefined){return win?prop in win?win[prop]:win.document.documentElement[method]:elem[method]}if(win){win.scrollTo(!top?val:jQuery(win).scrollLeft(),top?val:jQuery(win).scrollTop())}else{elem[method]=val}},method,val,arguments.length,null)}});function getWindow(elem){return jQuery.isWindow(elem)?elem:elem.nodeType===9?elem.defaultView||elem.parentWindow:false}
// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
jQuery.each({Height:"height",Width:"width"},function(name,type){jQuery.each({padding:"inner"+name,content:type,"":"outer"+name},function(defaultExtra,funcName){
// margin is only for outerHeight, outerWidth
jQuery.fn[funcName]=function(margin,value){var chainable=arguments.length&&(defaultExtra||typeof margin!=="boolean"),extra=defaultExtra||(margin===true||value===true?"margin":"border");return jQuery.access(this,function(elem,type,value){var doc;if(jQuery.isWindow(elem)){
// As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there
// isn't a whole lot we can do. See pull request at this URL for discussion:
// https://github.com/jquery/jquery/pull/764
return elem.document.documentElement["client"+name]}
// Get document width or height
if(elem.nodeType===9){doc=elem.documentElement;
// Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], whichever is greatest
// unfortunately, this causes bug #3838 in IE6/8 only, but there is currently no good, small way to fix it.
return Math.max(elem.body["scroll"+name],doc["scroll"+name],elem.body["offset"+name],doc["offset"+name],doc["client"+name])}return value===undefined?
// Get width or height on the element, requesting but not forcing parseFloat
jQuery.css(elem,type,value,extra):
// Set width or height on the element
jQuery.style(elem,type,value,extra)},type,chainable?margin:undefined,chainable,null)}})});
// Expose jQuery to the global object
window.jQuery=window.$=jQuery;
// Expose jQuery as an AMD module, but only for AMD loaders that
// understand the issues with loading multiple versions of jQuery
// in a page that all might call define(). The loader will indicate
// they have special allowances for multiple jQuery versions by
// specifying define.amd.jQuery = true. Register as a named module,
// since jQuery can be concatenated with other files that may use define,
// but not use a proper concatenation script that understands anonymous
// AMD modules. A named AMD is safest and most robust way to register.
// Lowercase jquery is used because AMD module names are derived from
// file names, and jQuery is normally delivered in a lowercase file name.
// Do this after creating the global so that if an AMD module wants to call
// noConflict to hide this version of jQuery, it will work.
if(typeof define==="function"&&define.amd&&define.amd.jQuery){define("jquery",[],function(){return jQuery})}})(window);
/*!
* jQuery Cookie Plugin v1.3
* https://github.com/carhartl/jquery-cookie
*
* Copyright 2011, Klaus Hartl
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://www.opensource.org/licenses/mit-license.php
* http://www.opensource.org/licenses/GPL-2.0
*/(function($,document,undefined){var pluses=/\+/g;function raw(s){return s}function decoded(s){return decodeURIComponent(s.replace(pluses," "))}var config=$.cookie=function(key,value,options){
// write
if(value!==undefined){options=$.extend({},config.defaults,options);if(value===null){options.expires=-1}if(typeof options.expires==="number"){var days=options.expires,t=options.expires=new Date;t.setDate(t.getDate()+days)}value=config.json?JSON.stringify(value):String(value);return document.cookie=[encodeURIComponent(key),"=",config.raw?value:encodeURIComponent(value),options.expires?"; expires="+options.expires.toUTCString():"",// use expires attribute, max-age is not supported by IE
options.path?"; path="+options.path:"",options.domain?"; domain="+options.domain:"",options.secure?"; secure":""].join("")}
// read
var decode=config.raw?raw:decoded;var cookies=document.cookie.split("; ");for(var i=0,l=cookies.length;i<l;i++){var parts=cookies[i].split("=");if(decode(parts.shift())===key){var cookie=decode(parts.join("="));return config.json?JSON.parse(cookie):cookie}}return null};config.defaults={};$.removeCookie=function(key,options){if($.cookie(key)!==null){$.cookie(key,null,options);return true}return false}})(jQuery,document);
/*
 * FancyBox - jQuery Plugin
 * Simple and fancy lightbox alternative
 *
 * Examples and documentation at: http://fancybox.net
 *
 * Copyright (c) 2008 - 2010 Janis Skarnelis
 * That said, it is hardly a one-person project. Many people have submitted bugs, code, and offered their advice freely. Their support is greatly appreciated.
 *
 * Version: 1.3.4 (11/11/2010)
 * Requires: jQuery v1.3+
 *
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 */(function(b){var m,t,u,f,D,j,E,n,z,A,q=0,e={},o=[],p=0,d={},l=[],G=null,v=new Image,J=/\.(jpg|gif|png|bmp|jpeg)(.*)?$/i,W=/[^\.]\.(swf)\s*$/i,K,L=1,y=0,s="",r,i,h=false,B=b.extend(b("<div/>")[0],{prop:0}),M=b.browser.msie&&b.browser.version<7&&!window.XMLHttpRequest,N=function(){t.hide();v.onerror=v.onload=null;G&&G.abort();m.empty()},O=function(){if(false===e.onError(o,q,e)){t.hide();h=false}else{e.titleShow=false;e.width="auto";e.height="auto";m.html('<p id="fancybox-error">The requested content cannot be loaded.<br />Please try again later.</p>');F()}},I=function(){var a=o[q],c,g,k,C,P,w;N();e=b.extend({},b.fn.fancybox.defaults,typeof b(a).data("fancybox")=="undefined"?e:b(a).data("fancybox"));w=e.onStart(o,q,e);if(w===false)h=false;else{if(typeof w=="object")e=b.extend(e,w);k=e.title||(a.nodeName?b(a).attr("title"):a.title)||"";if(a.nodeName&&!e.orig)e.orig=b(a).children("img:first").length?b(a).children("img:first"):b(a);if(k===""&&e.orig&&e.titleFromAlt)k=e.orig.attr("alt");c=e.href||(a.nodeName?b(a).attr("href"):a.href)||null;if(/^(?:javascript)/i.test(c)||c=="#")c=null;if(e.type){g=e.type;if(!c)c=e.content}else if(e.content)g="html";else if(c)g=c.match(J)?"image":c.match(W)?"swf":b(a).hasClass("iframe")?"iframe":c.indexOf("#")===0?"inline":"ajax";if(g){if(g=="inline"){a=c.substr(c.indexOf("#"));g=b(a).length>0?"inline":"ajax"}e.type=g;e.href=c;e.title=k;if(e.autoDimensions)if(e.type=="html"||e.type=="inline"||e.type=="ajax"){e.width="auto";e.height="auto"}else e.autoDimensions=false;if(e.modal){e.overlayShow=true;e.hideOnOverlayClick=false;e.hideOnContentClick=false;e.enableEscapeButton=false;e.showCloseButton=false}e.padding=parseInt(e.padding,10);e.margin=parseInt(e.margin,10);m.css("padding",e.padding+e.margin);b(".fancybox-inline-tmp").unbind("fancybox-cancel").bind("fancybox-change",function(){b(this).replaceWith(j.children())});switch(g){case"html":m.html(e.content);F();break;case"inline":if(b(a).parent().is("#fancybox-content")===true){h=false;break}b('<div class="fancybox-inline-tmp" />').hide().insertBefore(b(a)).bind("fancybox-cleanup",function(){b(this).replaceWith(j.children())}).bind("fancybox-cancel",function(){b(this).replaceWith(m.children())});b(a).appendTo(m);F();break;case"image":h=false;b.fancybox.showActivity();v=new Image;v.onerror=function(){O()};v.onload=function(){h=true;v.onerror=v.onload=null;e.width=v.width;e.height=v.height;b("<img />").attr({id:"fancybox-img",src:v.src,alt:e.title}).appendTo(m);Q()};v.src=c;break;case"swf":e.scrolling="no";C='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+e.width+'" height="'+e.height+'"><param name="movie" value="'+c+'"></param>';P="";b.each(e.swf,function(x,H){C+='<param name="'+x+'" value="'+H+'"></param>';P+=" "+x+'="'+H+'"'});C+='<embed src="'+c+'" type="application/x-shockwave-flash" width="'+e.width+'" height="'+e.height+'"'+P+"></embed></object>";m.html(C);F();break;case"ajax":h=false;b.fancybox.showActivity();e.ajax.win=e.ajax.success;G=b.ajax(b.extend({},e.ajax,{url:c,data:e.ajax.data||{},error:function(x){x.status>0&&O()},success:function(x,H,R){if((typeof R=="object"?R:G).status==200){if(typeof e.ajax.win=="function"){w=e.ajax.win(c,x,H,R);if(w===false){t.hide();return}else if(typeof w=="string"||typeof w=="object")x=w}m.html(x);F()}}}));break;case"iframe":Q()}}else O()}},F=function(){var a=e.width,c=e.height;a=a.toString().indexOf("%")>-1?parseInt((b(window).width()-e.margin*2)*parseFloat(a)/100,10)+"px":a=="auto"?"auto":a+"px";c=c.toString().indexOf("%")>-1?parseInt((b(window).height()-e.margin*2)*parseFloat(c)/100,10)+"px":c=="auto"?"auto":c+"px";m.wrapInner('<div style="width:'+a+";height:"+c+";overflow: "+(e.scrolling=="auto"?"auto":e.scrolling=="yes"?"scroll":"hidden")+';position:relative;"></div>');e.width=m.width();e.height=m.height();Q()},Q=function(){var a,c;t.hide();if(f.is(":visible")&&false===d.onCleanup(l,p,d)){b.event.trigger("fancybox-cancel");h=false}else{h=true;b(j.add(u)).unbind();b(window).unbind("resize.fb scroll.fb");b(document).unbind("keydown.fb");f.is(":visible")&&d.titlePosition!=="outside"&&f.css("height",f.height());l=o;p=q;d=e;if(d.overlayShow){u.css({"background-color":d.overlayColor,opacity:d.overlayOpacity,cursor:d.hideOnOverlayClick?"pointer":"auto",height:b(document).height()});if(!u.is(":visible")){M&&b("select:not(#fancybox-tmp select)").filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one("fancybox-cleanup",function(){this.style.visibility="inherit"});u.show()}}else u.hide();i=X();s=d.title||"";y=0;n.empty().removeAttr("style").removeClass();if(d.titleShow!==false){if(b.isFunction(d.titleFormat))a=d.titleFormat(s,l,p,d);else a=s&&s.length?d.titlePosition=="float"?'<table id="fancybox-title-float-wrap" cellpadding="0" cellspacing="0"><tr><td id="fancybox-title-float-left"></td><td id="fancybox-title-float-main">'+s+'</td><td id="fancybox-title-float-right"></td></tr></table>':'<div id="fancybox-title-'+d.titlePosition+'">'+s+"</div>":false;s=a;if(!(!s||s==="")){n.addClass("fancybox-title-"+d.titlePosition).html(s).appendTo("body").show();switch(d.titlePosition){case"inside":n.css({width:i.width-d.padding*2,marginLeft:d.padding,marginRight:d.padding});y=n.outerHeight(true);n.appendTo(D);i.height+=y;break;case"over":n.css({marginLeft:d.padding,width:i.width-d.padding*2,bottom:d.padding}).appendTo(D);break;case"float":n.css("left",parseInt((n.width()-i.width-40)/2,10)*-1).appendTo(f);break;default:n.css({width:i.width-d.padding*2,paddingLeft:d.padding,paddingRight:d.padding}).appendTo(f)}}}n.hide();if(f.is(":visible")){b(E.add(z).add(A)).hide();a=f.position();r={top:a.top,left:a.left,width:f.width(),height:f.height()};c=r.width==i.width&&r.height==i.height;j.fadeTo(d.changeFade,.3,function(){var g=function(){j.html(m.contents()).fadeTo(d.changeFade,1,S)};b.event.trigger("fancybox-change");j.empty().removeAttr("filter").css({"border-width":d.padding,width:i.width-d.padding*2,height:e.autoDimensions?"auto":i.height-y-d.padding*2});if(c)g();else{B.prop=0;b(B).animate({prop:1},{duration:d.changeSpeed,easing:d.easingChange,step:T,complete:g})}})}else{f.removeAttr("style");j.css("border-width",d.padding);if(d.transitionIn=="elastic"){r=V();j.html(m.contents());f.show();if(d.opacity)i.opacity=0;B.prop=0;b(B).animate({prop:1},{duration:d.speedIn,easing:d.easingIn,step:T,complete:S})}else{d.titlePosition=="inside"&&y>0&&n.show();j.css({width:i.width-d.padding*2,height:e.autoDimensions?"auto":i.height-y-d.padding*2}).html(m.contents());f.css(i).fadeIn(d.transitionIn=="none"?0:d.speedIn,S)}}}},Y=function(){if(d.enableEscapeButton||d.enableKeyboardNav)b(document).bind("keydown.fb",function(a){if(a.keyCode==27&&d.enableEscapeButton){a.preventDefault();b.fancybox.close()}else if((a.keyCode==37||a.keyCode==39)&&d.enableKeyboardNav&&a.target.tagName!=="INPUT"&&a.target.tagName!=="TEXTAREA"&&a.target.tagName!=="SELECT"){a.preventDefault();b.fancybox[a.keyCode==37?"prev":"next"]()}});if(d.showNavArrows){if(d.cyclic&&l.length>1||p!==0)z.show();if(d.cyclic&&l.length>1||p!=l.length-1)A.show()}else{z.hide();A.hide()}},S=function(){if(!b.support.opacity){j.get(0).style.removeAttribute("filter");f.get(0).style.removeAttribute("filter")}e.autoDimensions&&j.css("height","auto");f.css("height","auto");s&&s.length&&n.show();d.showCloseButton&&E.show();Y();d.hideOnContentClick&&j.bind("click",b.fancybox.close);d.hideOnOverlayClick&&u.bind("click",b.fancybox.close);b(window).bind("resize.fb",b.fancybox.resize);d.centerOnScroll&&b(window).bind("scroll.fb",b.fancybox.center);if(d.type=="iframe")b('<iframe id="fancybox-frame" name="fancybox-frame'+(new Date).getTime()+'" frameborder="0" hspace="0" '+(b.browser.msie?'allowtransparency="true""':"")+' scrolling="'+e.scrolling+'" src="'+d.href+'"></iframe>').appendTo(j);f.show();h=false;b.fancybox.center();d.onComplete(l,p,d);var a,c;if(l.length-1>p){a=l[p+1].href;if(typeof a!=="undefined"&&a.match(J)){c=new Image;c.src=a}}if(p>0){a=l[p-1].href;if(typeof a!=="undefined"&&a.match(J)){c=new Image;c.src=a}}},T=function(a){var c={width:parseInt(r.width+(i.width-r.width)*a,10),height:parseInt(r.height+(i.height-r.height)*a,10),top:parseInt(r.top+(i.top-r.top)*a,10),left:parseInt(r.left+(i.left-r.left)*a,10)};if(typeof i.opacity!=="undefined")c.opacity=a<.5?.5:a;f.css(c);j.css({width:c.width-d.padding*2,height:c.height-y*a-d.padding*2})},U=function(){return[b(window).width()-d.margin*2,b(window).height()-d.margin*2,b(document).scrollLeft()+d.margin,b(document).scrollTop()+d.margin]},X=function(){var a=U(),c={},g=d.autoScale,k=d.padding*2;c.width=d.width.toString().indexOf("%")>-1?parseInt(a[0]*parseFloat(d.width)/100,10):d.width+k;c.height=d.height.toString().indexOf("%")>-1?parseInt(a[1]*parseFloat(d.height)/100,10):d.height+k;if(g&&(c.width>a[0]||c.height>a[1]))if(e.type=="image"||e.type=="swf"){g=d.width/d.height;if(c.width>a[0]){c.width=a[0];c.height=parseInt((c.width-k)/g+k,10)}if(c.height>a[1]){c.height=a[1];c.width=parseInt((c.height-k)*g+k,10)}}else{c.width=Math.min(c.width,a[0]);c.height=Math.min(c.height,a[1])}c.top=parseInt(Math.max(a[3]-20,a[3]+(a[1]-c.height-40)*.5),10);c.left=parseInt(Math.max(a[2]-20,a[2]+(a[0]-c.width-40)*.5),10);return c},V=function(){var a=e.orig?b(e.orig):false,c={};if(a&&a.length){c=a.offset();c.top+=parseInt(a.css("paddingTop"),10)||0;c.left+=parseInt(a.css("paddingLeft"),10)||0;c.top+=parseInt(a.css("border-top-width"),10)||0;c.left+=parseInt(a.css("border-left-width"),10)||0;c.width=a.width();c.height=a.height();c={width:c.width+d.padding*2,height:c.height+d.padding*2,top:c.top-d.padding-20,left:c.left-d.padding-20}}else{a=U();c={width:d.padding*2,height:d.padding*2,top:parseInt(a[3]+a[1]*.5,10),left:parseInt(a[2]+a[0]*.5,10)}}return c},Z=function(){if(t.is(":visible")){b("div",t).css("top",L*-40+"px");L=(L+1)%12}else clearInterval(K)};b.fn.fancybox=function(a){if(!b(this).length)return this;b(this).data("fancybox",b.extend({},a,b.metadata?b(this).metadata():{})).unbind("click.fb").bind("click.fb",function(c){c.preventDefault();if(!h){h=true;b(this).blur();o=[];q=0;c=b(this).attr("rel")||"";if(!c||c==""||c==="nofollow")o.push(this);else{o=b("a[rel="+c+"], area[rel="+c+"]");q=o.index(this)}I()}});return this};b.fancybox=function(a,c){var g;if(!h){h=true;g=typeof c!=="undefined"?c:{};o=[];q=parseInt(g.index,10)||0;if(b.isArray(a)){for(var k=0,C=a.length;k<C;k++)if(typeof a[k]=="object")b(a[k]).data("fancybox",b.extend({},g,a[k]));else a[k]=b({}).data("fancybox",b.extend({content:a[k]},g));o=jQuery.merge(o,a)}else{if(typeof a=="object")b(a).data("fancybox",b.extend({},g,a));else a=b({}).data("fancybox",b.extend({content:a},g));o.push(a)}if(q>o.length||q<0)q=0;I()}};b.fancybox.showActivity=function(){clearInterval(K);t.show();K=setInterval(Z,66)};b.fancybox.hideActivity=function(){t.hide()};b.fancybox.next=function(){return b.fancybox.pos(p+1)};b.fancybox.prev=function(){return b.fancybox.pos(p-1)};b.fancybox.pos=function(a){if(!h){a=parseInt(a);o=l;if(a>-1&&a<l.length){q=a;I()}else if(d.cyclic&&l.length>1){q=a>=l.length?0:l.length-1;I()}}};b.fancybox.cancel=function(){if(!h){h=true;b.event.trigger("fancybox-cancel");N();e.onCancel(o,q,e);h=false}};b.fancybox.close=function(){function a(){u.fadeOut("fast");n.empty().hide();f.hide();b.event.trigger("fancybox-cleanup");j.empty();d.onClosed(l,p,d);l=e=[];p=q=0;d=e={};h=false}if(!(h||f.is(":hidden"))){h=true;if(d&&false===d.onCleanup(l,p,d))h=false;else{N();b(E.add(z).add(A)).hide();b(j.add(u)).unbind();b(window).unbind("resize.fb scroll.fb");b(document).unbind("keydown.fb");j.find("iframe").attr("src",M&&/^https/i.test(window.location.href||"")?"javascript:void(false)":"about:blank");d.titlePosition!=="inside"&&n.empty();f.stop();if(d.transitionOut=="elastic"){r=V();var c=f.position();i={top:c.top,left:c.left,width:f.width(),height:f.height()};if(d.opacity)i.opacity=1;n.empty().hide();B.prop=1;b(B).animate({prop:0},{duration:d.speedOut,easing:d.easingOut,step:T,complete:a})}else f.fadeOut(d.transitionOut=="none"?0:d.speedOut,a)}}};b.fancybox.resize=function(){u.is(":visible")&&u.css("height",b(document).height());b.fancybox.center(true)};b.fancybox.center=function(a){var c,g;if(!h){g=a===true?1:0;c=U();!g&&(f.width()>c[0]||f.height()>c[1])||f.stop().animate({top:parseInt(Math.max(c[3]-20,c[3]+(c[1]-j.height()-40)*.5-d.padding)),left:parseInt(Math.max(c[2]-20,c[2]+(c[0]-j.width()-40)*.5-d.padding))},typeof a=="number"?a:200)}};b.fancybox.init=function(){if(!b("#fancybox-wrap").length){b("body").append(m=b('<div id="fancybox-tmp"></div>'),t=b('<div id="fancybox-loading"><div></div></div>'),u=b('<div id="fancybox-overlay"></div>'),f=b('<div id="fancybox-wrap"></div>'));D=b('<div id="fancybox-outer"></div>').append('<div class="fancybox-bg" id="fancybox-bg-n"></div><div class="fancybox-bg" id="fancybox-bg-ne"></div><div class="fancybox-bg" id="fancybox-bg-e"></div><div class="fancybox-bg" id="fancybox-bg-se"></div><div class="fancybox-bg" id="fancybox-bg-s"></div><div class="fancybox-bg" id="fancybox-bg-sw"></div><div class="fancybox-bg" id="fancybox-bg-w"></div><div class="fancybox-bg" id="fancybox-bg-nw"></div>').appendTo(f);D.append(j=b('<div id="fancybox-content"></div>'),E=b('<a id="fancybox-close"></a>'),n=b('<div id="fancybox-title"></div>'),z=b('<a href="javascript:;" id="fancybox-left"><span class="fancy-ico" id="fancybox-left-ico"></span></a>'),A=b('<a href="javascript:;" id="fancybox-right"><span class="fancy-ico" id="fancybox-right-ico"></span></a>'));E.click(b.fancybox.close);t.click(b.fancybox.cancel);z.click(function(a){a.preventDefault();b.fancybox.prev()});A.click(function(a){a.preventDefault();b.fancybox.next()});b.fn.mousewheel&&f.bind("mousewheel.fb",function(a,c){if(h)a.preventDefault();else if(b(a.target).get(0).clientHeight==0||b(a.target).get(0).scrollHeight===b(a.target).get(0).clientHeight){a.preventDefault();b.fancybox[c>0?"prev":"next"]()}});b.support.opacity||f.addClass("fancybox-ie");if(M){t.addClass("fancybox-ie6");f.addClass("fancybox-ie6");b('<iframe id="fancybox-hide-sel-frame" src="'+(/^https/i.test(window.location.href||"")?"javascript:void(false)":"about:blank")+'" scrolling="no" border="0" frameborder="0" tabindex="-1"></iframe>').prependTo(D)}}};b.fn.fancybox.defaults={padding:10,margin:40,opacity:false,modal:false,cyclic:false,scrolling:"auto",width:560,height:340,autoScale:true,autoDimensions:true,centerOnScroll:false,ajax:{},swf:{wmode:"transparent"},hideOnOverlayClick:true,hideOnContentClick:false,overlayShow:true,overlayOpacity:.7,overlayColor:"#777",titleShow:true,titlePosition:"float",titleFormat:null,titleFromAlt:false,transitionIn:"fade",transitionOut:"fade",speedIn:300,speedOut:300,changeSpeed:300,changeFade:"fast",easingIn:"swing",easingOut:"swing",showCloseButton:true,showNavArrows:true,enableEscapeButton:true,enableKeyboardNav:true,onStart:function(){},onCancel:function(){},onComplete:function(){},onCleanup:function(){},onClosed:function(){},onError:function(){}};b(document).ready(function(){b.fancybox.init()})})(jQuery);var frontend=frontend||{};frontend.events=frontend.events||{};frontend.events.HEADER_LOADED="frontend_header_loaded";frontend.events.CONTENT_LOADED="frontend_content_loaded";frontend.events.FOOTER_LOADED="frontend_footer_loaded";frontend.events.ADS_LOADED="frontend_ads_loaded";frontend.events.ADS_BLOCKED="frontend_ads_blocked";frontend.events.SESSION_LOADED="frontend_session_loaded";frontend.events.SESSION_ABANDONED="frontend_session_abandoned";adBlock_active=false;lazyLoadInstance=false;$(document).on(frontend.events.HEADER_LOADED,function(){
// Open user-login in a fancybox-lightbox
$(".user-login-link").fancybox({onClosed:function(){var currentUrl=$(location).attr("pathname");if(currentUrl.indexOf("/abo-epaper/epaper/")!==-1){var currentUrlElements=currentUrl.split("/");if(currentUrlElements[3].indexOf(".")!==-1){var ePaperId=currentUrlElements[3].replace(".","");if(!isNaN(ePaperId)){window.location.reload()}}}}});
// Close 'Dein Tipp an uns"-box by click on button "Abbrechen" (class='cancel')
$(".user-tip .cancel").on("click",function(){$(".user-tip").toggleClass("hide");$(".user-tip-link").toggleClass("selected");
// $('.user-tip input[type="submit"]').addClass('privacy-not-confirmed').prop('disabled', true);
// $('.user-tip .privacy-for-form--active').removeClass('privacy-for-form--active');
});$(".searchfield .searchstart").on("click",function(){$(".searchfield .searchbutton").click()});if(typeof frontend.HeaderNavigation!=="undefined"){frontend.HeaderNavigation.setLastElement();frontend.HeaderNavigation.setupDropdownBehaviour();frontend.HeaderNavigation.setupIssuedropdown()}
// Hide service boxes on click outside the box
$(document).on("click",function(e){
// 'User-Control' box
if($(e.target).is(".user-control-link")||$(e.target.parentNode).hasClass("user-control-link")){
// Open/Close user-control-box, if .user-control-link was clicked
$(".user-control").toggleClass("hide");$(e.target).toggleClass("selected")}else{if(!$(e.target).parents(".user-control").length){
// Close user-control-box, if other elements of the document was clicked
if($(".user-control-link").hasClass("selected")){$(".user-control").toggleClass("hide");$(".user-control-link").removeClass("selected")}}}
// 'Dein Tipp an uns' box
if($(e.target).is(".user-tip-link")){
// Open/Close user-tip-box, if .user-control-link was clicked
$(".header-top .user-tip #cms_frontend_tipp_tipp_section option:eq(1)").prop("selected",true);$(".user-tip").toggleClass("hide");
// $('.user-tip input[type="submit"]').addClass('privacy-not-confirmed').prop('disabled', true);
$(".user-tip .privacy-for-form--active").removeClass("privacy-for-form--active");$(".header-top .user-tip #cms_frontend_tipp_tipp_subject").focus();$(e.target).toggleClass("selected").parent().toggleClass("open");reloadOewa(OEWA)}else{if(!$(e.target).parents(".user-tip").length){
// Close user-tip-box, if other elements of the document was clicked
if($(".user-tip-link").hasClass("selected")){if(e.isDefaultPrevented())return;$(".user-tip").toggleClass("hide");
// $('.user-tip input[type="submit"]').addClass('privacy-not-confirmed').prop('disabled', true);
$(".user-tip .privacy-for-form--active").removeClass("privacy-for-form--active");$(".user-tip-link").removeClass("selected").parent().removeClass("open")}}}
// 'Such' box
if($(e.target).is(".searchfield-link")){
// Open/Close search-box, if .user-control-link was clicked
$(".searchfield").toggleClass("hide");$(e.target).toggleClass("selected").parent().toggleClass("open");if($(e.target).hasClass("selected")){$("#searchTerm").focus()}reloadOewa(OEWA)}else{if(!$(e.target).parents(".searchfield").length){
// Close search-box, if other elements of the document was clicked
if($(".searchfield-link").hasClass("selected")){$(".searchfield").toggleClass("hide");$(".searchfield-link").removeClass("selected").parent().removeClass("open")}}}});$(window).on("scroll",function(e){$header=$(".header-page");$maincontainer=$(".maincontainer");$epaper=$header.find(".header-main__epaper-teaser");$adlogo1=$("#bigsizebanner-helper");$related=$("section.related-article-for-top");$navArticleNextPrev_Top=$("section.article-next-prev-container--article-top");$navArticleNextPrev_End=$("section.article-next-prev-container--article-end");if($navArticleNextPrev_Top.length>0){
// Sticky - Follows Article (between article content)
if(!$navArticleNextPrev_Top.hasClass("article-next-prev-container--fixed")&&$navArticleNextPrev_Top[0].getBoundingClientRect().top<=$(window).height()/2-75){$navArticleNextPrev_Top.data("scroll-top-limit",$(window).scrollTop());$navArticleNextPrev_Top.addClass("article-next-prev-container--fixed")}
// Non Sticky - Above article body
else if($navArticleNextPrev_Top.hasClass("article-next-prev-container--fixed")&&$(window).scrollTop()<$navArticleNextPrev_Top.data("scroll-top-limit")){$navArticleNextPrev_Top.removeAttr("scroll-top-limit");$navArticleNextPrev_Top.removeClass("article-next-prev-container--fixed")}else if(!$navArticleNextPrev_Top.hasClass("hidden")&&$navArticleNextPrev_Top.hasClass("article-next-prev-container--fixed")&&$navArticleNextPrev_Top[0].getBoundingClientRect().top>=$navArticleNextPrev_End[0].getBoundingClientRect().top){$navArticleNextPrev_End.data("top",$navArticleNextPrev_Top[0].getBoundingClientRect().top);$navArticleNextPrev_Top.addClass("hidden");$navArticleNextPrev_End.css("opacity",1)}else if($navArticleNextPrev_Top.hasClass("hidden")&&$navArticleNextPrev_Top.hasClass("article-next-prev-container--fixed")&&$navArticleNextPrev_End.data("top")<$navArticleNextPrev_End[0].getBoundingClientRect().top){$navArticleNextPrev_End.data("top",$navArticleNextPrev_Top[0].getBoundingClientRect().top);$navArticleNextPrev_Top.removeClass("hidden");$navArticleNextPrev_End.css("opacity",0)}}if($header.length>0&&$header.find(".header-main--app").length==0&&$header.find(".header-main--newsletter").length==0){if(!$header.hasClass("header-page--fixed-nav")&&$header[0].getBoundingClientRect().top<=-68){$header.addClass("header-page--fixed-nav");animateStickyNavItems(true);if($adlogo1.height()>0){$adlogo1.addClass("adposition-logo1--fixed-nav");$maincontainer.removeClass("maincontainer--fixed-nav")}else{$adlogo1.removeClass("adposition-logo1--fixed-nav");$maincontainer.addClass("maincontainer--fixed-nav")}$epaper.hide()}else if($header.hasClass("header-page--fixed-nav")&&typeof $adlogo1[0]!=="undefined"&&$adlogo1[0].getBoundingClientRect().top>68){$header.removeClass("header-page--fixed-nav");animateStickyNavItems(false);$adlogo1.removeClass("adposition-logo1--fixed-nav");$maincontainer.removeClass("maincontainer--fixed-nav");$epaper.show()}}
/*
         * management of related article box, on scroll up
         */if($related.length>0&&!$related.hasClass("related-article-for-top--visible")){if($(".article-body-text").length>0){if($(window).scrollTop()>$(".article-body-text")[0].getBoundingClientRect().top){$related.addClass("move-in")}if($("ul.breadcrumbs")[0].getBoundingClientRect().top>40&&$related.hasClass("move-in")){$related.addClass("related-article-for-top--visible");$related.css("height",$(".article-related-content .teasers--related").height()+"px")}
/*
                if ($maincontainer[0].getBoundingClientRect().top > (68 + $adlogo1.outerHeight()) && $related.hasClass('move-in')) {
                    $related.addClass('related-article-for-top--visible');
                }
                */}}})});$(document).on(frontend.events.ADS_BLOCKED,function(){adBlock_active=true;var currentDomain=window.location.hostname;var currentDomainReadable=currentDomain.indexOf("noen")!==-1?"NÖN.at":"BVZ.at";var adBlockInfo=""+'<div class="box blocker-hint"><div class="blocker-hint__inner">'+"<h3>Wir bitten darum, den AdBlocker für "+currentDomainReadable+" auszuschalten</h3>"+"<p>Werbung auf diesen Seiten wird überwiegend pro Einblendung bezahlt und diese Einnahmen ermöglichen es, die Inhalte und Services von "+currentDomainReadable+" anzubieten.</p>"+"<h4>Wir hoffen auf euer Verständnis!<br/>Das "+currentDomainReadable+" Team</h4>"+'<a href="/abo-epaper/faq/anleitung-adblocker-deaktivieren/12.004.947">So wird der AdBlocker auf '+currentDomainReadable+" ausgeschaltet</a>"+"</div></div>";
// if marketing cookies are not accepted, effect is the same as ads being blocked
// so we check this and display the hint only if the ads are not blocked by cookie bot
if($("#ad-aBdetect").attr("data-cookieconsent")!="marketing"){$(".box.content-ad .additionAd").html(adBlockInfo);$(".box.content-ad").addClass("adblocked")}
// loads fallback urls blocked elements, that have this attribute and provide a fallback
$(".adblocked").each(function(i){$blocked=$(this);$blocked.removeClass("content-ad content-ad__pos1 content-ad__pos2");if($blocked.find("[data-fallback-url]").length>0&&$blocked.find("[data-fallback-url]").data("fallback-url")){$.ajax({type:"GET",url:$blocked.find("[data-fallback-url]").data("fallback-url"),success:function(data){$blocked.before(data);$blocked.remove()}})}});
// finds teaser-as-cad images (blocked due format) and replaces them with adblocker hint
$('.teaser-as-square img[src*="300x250"]').each(function(i){if($(this).is(":hidden")){$(this).closest(".teaser-as-square").html(adBlockInfo)}})});$(document).ready(function(){
// $related = $('section.related-article-for-top');
$("textarea.growable").on("scroll",function(){var regEx=/\d+/;var textAreaFontSize=parseInt($(this).css("font-size").match(regEx));var unit=$(this).css("font-size").replace(regEx,"");var textAreaLineHeight;if(isNaN($(this).css("line-height"))){textAreaLineHeight=textAreaFontSize*1.5}else{textAreaLineHeight=$(this).css("line-height")}var textAreaHeight=parseInt($(this).height())+parseInt($(this).css("padding-top"))+textAreaLineHeight;var windowScrollHeight=parseInt($(window).scrollTop())+textAreaLineHeight*.7;if($(this).scrollTop()>0){$(this).css("height",textAreaHeight.toString()+unit);$(window).scrollTop(windowScrollHeight.toString())}});
/*
    if ($related.length > 0) {
        $related.detach().insertAfter('.col-12.header-sub.box');
    }
    */$(".browserNodes .close").on("click",function(){$(this).parent().hide()});$('a[target^="popup"]').each(function(i){
// clone element to get string represantation via innerHTML to extract strings via regex
var clone=$(this)[0].cloneNode(true);var tmp=document.createElement("div");tmp.appendChild(clone);var rx_width=/width\":(.*?),/;var rx_height=/height\":(.*?),/;var rx_scroll=/scrollbars\":(.*?)=/;var width=rx_width.exec(tmp.innerHTML);var height=rx_height.exec(tmp.innerHTML);var scrollbars=rx_scroll.exec(tmp.innerHTML);width=width===null?"0":width[1];height=height===null?"0":height[1];scrollbars=scrollbars===null?"false":scrollbars[1];$(this).attr("onclick",'window.open("'+$(this).attr("href")+'", "_blank", "width='+width+", height="+height+", scrollbars="+scrollbars+'")')});$('a[target^="popup"]').on("click",function(e){e.preventDefault()});if($(".facebook-box").length>0&&typeof Cookiebot!=="undefined"&&typeof Cookiebot.consent!=="undefined"&&typeof Cookiebot.consent.marketing!=="undefined"&&Cookiebot.consent.marketing===true){$facebookBox=$(".facebook-box").detach();if($(".article-body-text .facebook-box--placeholder").length>0){$(".article-body-text .facebook-box--placeholder").replaceWith($facebookBox);$facebookBox.addClass("facebook-box--visible")}else if($(".article-body-text p").length>1){$facebookBox.insertAfter(".article-body-text p:nth-of-type(2)");$facebookBox.addClass("facebook-box--visible")}else{$facebookBox.insertAfter(".article-body-text p:first-of-type");$facebookBox.addClass("facebook-box--visible")}}
// BEGIN: scroll to top button #topButton
if($("#topButton").length){scrollToTopButton()}
// END: scroll to top button #topButton
if(typeof LazyLoad!=="undefined"){lazyLoadInstance=new LazyLoad({elements_selector:".lazyload",callback_loaded:function(el){$(el).parent(".teaser__image.gradient").addClass("gradient--visible");$(el).addClass("lazyload--image-loaded")}})}
// remove all links and teasers to /abo due to apple in app payment restrictions
if(isAppleGlossyShellApp()){var $items=$('a[href*="/abo"]');$items.each(function($i){var $teaser=$(this).closest(".teaser");if($teaser.length>0){$teaser.remove()}var $actionBlock=$(this).closest(".abo-portal-action-block");if($actionBlock.length>0){$actionBlock.remove()}var $navItem=$(this).closest(".nav-item");if($navItem.length>0){$navItem.remove()}var $gridBlock=$(this).closest(".grid-block");if($gridBlock.length>0){$gridBlock.remove()}var $li=$(this).closest("li");if($li.length>0){$li.remove()}})}});$(window).load(function(){checkCookieEnabled()});function removeOverlay($object){$object.removeClass("issue-loading")}function animateStickyNavItems(showHomeLink){$itemStart=$header.find(".header-main__nav-main .nav-item--start");$itemLast=$header.find(".header-main__nav-main .nav-item:last-of-type a");if(showHomeLink){$itemStart.show();$itemStart.stop(true,true);$itemStart.css("opacity","0");$itemStart.css("marginLeft","-"+$itemStart.outerWidth()+"px");
// $itemLast.animate({width: '-=' + $itemStart.outerWidth()}, 400, function() {});
$itemStart.animate({marginLeft:"+="+$itemStart.outerWidth()},500,function(){$itemStart.animate({opacity:"1"},500,function(){})})}else{$itemStart.stop(true,true);$itemStart.animate({opacity:"0"},500,function(){
// $itemLast.animate({width: '+=' + $itemStart.outerWidth()}, 400, function() {});
$itemStart.animate({marginLeft:"-="+$itemStart.outerWidth()},500,function(){$itemStart.hide()})})}}function scrollToTopButton(){let $topButton=$("#topButton");let scrollInAt=1500;let visibleClientHeight=document.documentElement.clientHeight;let ua=window.navigator.userAgent;let iPadOS=navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1;let iOS=!!ua.match(/iPad/i)||!!ua.match(/iPhone/i)||iPadOS;let webkit=!!ua.match(/WebKit/i);let iOSSafari=iOS&&webkit&&!ua.match(/CriOS/i);let portraitMode=false;
// check if user agent is ios
if(iOSSafari){if(window.innerHeight>window.innerWidth){visibleClientHeight=window.innerHeight+40;//portrait mode
portraitMode=true}else{visibleClientHeight=window.innerHeight+30;// landscape mode
}}if(iOSSafari){$topButton.css("bottom","0")}else{$topButton.css("bottom","-25px")}$(window).scroll(function(){if(iOSSafari){if($(this).scrollTop()>=scrollInAt){// time to scroll in
$topButton.css("visibility","visible");$topButton.fadeIn()}else{// keep button out of viewport
$topButton.fadeOut()}}else{if($(this).scrollTop()>=scrollInAt){// time to scroll in
if($topButton.offset().top-$topButton.height()<=$(this).scrollTop()+visibleClientHeight){// time to fix button inner viewport?
$topButton.css("visibility","visible");$topButton.offset({top:visibleClientHeight+$(this).scrollTop()-$topButton.height()*scrollInPerc($(this).scrollTop(),scrollInAt,5)})}}else{// keep button out of viewport
$topButton.css("visibility","hidden")}}});$topButton.click(function(){$("html, body").animate({scrollTop:0},800);return false})}function scrollInPerc(scrollTop,scrollInAt,softFact){
// returns a percentage for scrolling in an element on an specific scroll level
// the higher the softFact, the lower the heightening rate
// returns 0 if scroll level is not reached yet
if((scrollTop/scrollInAt-1)*(100/softFact)<0){return 0}if((scrollTop/scrollInAt-1)*(100/softFact)>1){return 1}return((scrollTop/scrollInAt-1)*(100/softFact)).toFixed(2)}
//Adjust IFrame Height
function formIframeHeight(frameWindow,height){$("iframe.formbuilder").each(function(){if(this.contentWindow===frameWindow)this.height=height})}window.addEventListener("message",function(e){try{let obj=JSON.parse(e.data);if(obj.formbuilder){formIframeHeight(e.source,obj.formbuilder)}}catch(er){}});
// Autocomplete for Streetnames in Forms
function autocompleteStreet(street,zipCode,city,country,googleMapsApiKey){if(!(street&&zipCode&&city&&country&&googleMapsApiKey)){return false}if(typeof google==="undefined"){$.getScript("https://maps.googleapis.com/maps/api/js?key="+googleMapsApiKey+"&libraries=places&callback=initMap").done(function(script,textStatus){autocompleteStreet(street,zipCode,city,country,googleMapsApiKey)}).fail(function(){return false});return false}if(street instanceof jQuery){// pulling DOM out of jQuery
street=street[0]}if(zipCode instanceof jQuery){zipCode=zipCode[0]}if(city instanceof jQuery){city=city[0]}if(country instanceof jQuery){country=country[0]}initMap(street,zipCode,city,country)}function initMap(street,zipCode,city,country){if(!(street&&zipCode&&city&&country)){return false}var options={types:["address"],componentRestrictions:{country:"at"}};options.componentRestrictions.country=country.value;try{var autocomp_street=new google.maps.places.Autocomplete(street,options)}catch(e){if(typeof google==="undefined"){console.log("google is undefined");return false}}autocomp_street.addListener("place_changed",function(){var place=autocomp_street.getPlace();fillIn(place)});function fillIn(place){var componentForm={route:["long_name","street"],locality:["short_name","city"],postal_code:["short_name","zipCode"]};for(var i=0;i<place.address_components.length;i++){var addressType=place.address_components[i].types[0];if(componentForm[addressType]){var val=place.address_components[i][componentForm[addressType][0]];eval(componentForm[addressType][1]).value=val}}}}(function(){if(isAppleGlossyShellApp()){
// is iOS mobile App
// redirect to startpage if somehow landing on a abo offer page due to apple in app payment restrictions
if(window.location.href.match(/.*\/abo$/i)!==null||window.location.href.match(/.*\/abo\//i)!==null||window.location.href.match(/.*\/aboclub$/i)!==null||window.location.href.match(/.*\/aboclub\//i)!==null){if(window.location.href.match(/http?s\:\/\/app\./i)!==null){// is app
window.location.replace("https://app.noen.at")}else if(window.location.href.match(/http?s\:\/\/tab\./i)!==null){// is tab
window.location.replace("https://tab.noen.at")}else{window.location.replace("https://noen.at")}}}})();function isAppleGlossyShellApp(){return navigator.userAgent.match(/applewebkit/i)!==null&&navigator.userAgent.match(/GlossyShell/i)!==null}var cms=cms||{};cms.Comments=function(options){
/**
     * just for documentation of the used options.
     */
var defaultOptions={commentsNode:null,formNodes:null,commentReloadUrl:null,loadCommentsCallback:function($nodes){
// nodes holds the nodes inserted
}}
/**
     * The options we use for this javascript.
     */;this.options=jQuery.extend(true,{},defaultOptions,options);this.$commentsNode=this.options.commentsNode;this.commentReloadUrl=this.options.commentReloadUrl;this.loadCommentsCallback=this.options.loadCommentsCallback;this.loadComments();self.isLoggedIn=function(){if(typeof User==="undefined"){return false}return User.loggedIn};self.redirectToLogin=function(){$(".user-login-link").trigger("click")}};cms.Comments.prototype.storeComment=function($form,lastComment){var data=$form.serialize();var self=this;$.ajax(this.commentReloadUrl,{data:data,
// method is only available in jquery 1.9.0+
method:"POST",
// therefore type is still used here as a fallback (since at this time we are using 1.8.1)
type:"POST",success:function(response){var $nodes=$(response);self.$commentsNode.html($nodes);self.loadCommentsCallback($nodes);reloadOewa(OEWA)}})};cms.Comments.prototype.loadComments=function(){var data={};var self=this;$.ajax(this.commentReloadUrl,{data:data,method:"GET",success:function(response){var $nodes=$(response);self.$commentsNode.html($nodes);self.loadCommentsCallback($nodes)}})};cms.Comments.doUpVote=function(comment,success,error){if(typeof comment==="undefined"){return false}if(self.isLoggedIn()===false){$("#comment-upvotes-"+comment).data("upvote-after-login",1);$("#comment-upvotes-"+comment).data("comment-id",comment);self.redirectToLogin();return false}$.ajax("/content/vote",{type:"POST",data:{objectId:comment,vote:1},success:function(data,textStatus,jqXHR){if(data){$("#comment-upvotes-"+comment).text(data.upvotes);$("#comment-downvotes-"+comment).text(data.downvotes);reloadOewa(OEWA)}}})};cms.Comments.doDownVote=function(comment,success,error){if(typeof comment==="undefined"){return false}if(self.isLoggedIn()===false){$("#comment-downvotes-"+comment).data("downvote-after-login",1);$("#comment-downvotes-"+comment).data("comment-id",comment);self.redirectToLogin();return false}$.ajax("/content/vote",{type:"POST",data:{objectId:comment,vote:-1},success:function(data,textStatus,jqXHR){if(data){$("#comment-upvotes-"+comment).text(data.upvotes);$("#comment-downvotes-"+comment).text(data.downvotes);reloadOewa(OEWA)}}})};cms.Comments.doReport=function(success,error){var comment=$("#comments-reportbox").data("comment");if(typeof comment==="undefined"){return false}var email="";if($("#comments-reportbox .comments-reportbox__email input#usermail").val()!==""){email="/"+encodeURIComponent($("#comments-reportbox .comments-reportbox__email input#usermail").val())}$("#comments-reportbox").removeClass("hide");$.ajax("/comment/report/"+comment+email,{method:"POST",success:function(data,textStatus,jqXHR){reloadOewa(OEWA)}})};endlessScrolling=function($element,maxLoads,loadUrl,archiveButton){let loadInProgress=false;let loads=0;let dataLoad=false;//data loaded by ajax request
let showMoreButton=$element.find("#more--button").length;let uniqueId=$element.attr("id").substring(8);
// archiveButton = archiveButton || false;
if(loads===0){// initial load by click on button
loadNewContent();//charge dataLoad
$element.find("#more--button").on("click",function(){if(!loadInProgress){$element.find(".show__more").css("display","none");$("#opac--helper-"+uniqueId).css("display","none");if(dataLoad){$element.find(".load").before(dataLoad);//ouput dataLoad
// $element.find('.teaser').not('.teaser--endless-loaded').addClass('teaser--endless-loaded');
$element.find(".teaser").not(".teaser--endless-loaded").fadeTo(1,1e3);loads++;loadNewContent();// precharge dataLoad for next scroll event
}}})}$(window).on("scroll",function(){if(loads>0||!showMoreButton){if(!loadInProgress){let offsetDiv=$element.offset().top+$element.height();let windowHeight=$(window).innerHeight();let scrollTop=$(window).scrollTop();if(windowHeight+scrollTop+25>offsetDiv){if(dataLoad){$element.find(".load").before(dataLoad);
// $element.find('.teaser').not('.teaser--endless-loaded').addClass('teaser--endless-loaded');
$element.find(".teaser").not(".teaser--endless-loaded").fadeTo(1,1e3);loads++;loadNewContent();// precharge dataLoad for next scroll event
}}}}});function loadNewContent(){if(loadInProgress){return false}setLoadStatus(true);if(loads===maxLoads){setLoadStatus(false);dataLoad=false;return false}
// get exclude ids here
let excludeIds=[];$("[data-content]").each(function(i,el){let $content=$(el);excludeIds.push($content.data("content"))});let url=loadUrl+"?exclude="+encodeURIComponent(excludeIds.join(","));$.ajax(url,{success:function(data,textStatus,jqXHR){setLoadStatus(false);if(!data){// loadUrl returns NULL if no further content is found
loads=maxLoads;dataLoad=false;return false}dataLoad=data}})}
/* // Old stuff
     let loadNewContent = function () {
        if (loadInProgress) {
            return false;
        }
        setLoadStatus(true);
        if (loads === maxLoads) {
            $('.endless .load').fadeOut('fast');
            setLoadStatus(false);
            return false;
        }
        if ($element.find('.endless--nomore').length == 0) {
                $element.find('.load').fadeIn('slow');
        }
        else {
            $('.endless .load').fadeOut('fast');
            setLoadStatus(false);
            return false;
        }
        // get exclude ids here
        let excludeIds = [];
        $('[data-content]').each(function (i, el) {
            let $content = $(el);
            excludeIds.push($content.data('content'));
        });
        let url = loadUrl + '?exclude=' + encodeURIComponent(excludeIds.join(','));
        $.ajax(url, {
            success: function (data, textStatus, jqXHR) {
                setLoadStatus(false);
                loads++;
                if (!data) {
                    loads = maxLoads + 1;
                    $('.endless .load').fadeOut('fast');
                    return false;
                }
                dataLoad = data;
                //$element.find('.load').fadeOut('fast');

                if (archiveButton) {
                    let dateJs = new Date($element.find('article:last-of-type').data('publishdate') * 1000);
                    let dateYear = dateJs.getFullYear();
                    let dateMonth = dateJs.getMonth() + 1;
                    let dateDay = dateJs.getDate();
                    // let dateStringArchive = '/' + dateJs.getFullYear() + '/' + (dateJs.getMonth() + 1) + '/' + dateJs.getDate();
                    // let dateStringHuman = dateJs.getDate() + '.' + (dateJs.getMonth() + 1) + '.' + dateJs.getFullYear();
                    let channel = (typeof archiveButton.data('endless-channel') != 'undefined') ? archiveButton.data('endless-channel') + '/' : '';
                    let type = (typeof archiveButton.data('type') != 'undefined') ? '/inhalt/' + archiveButton.data('type') : '';
                    // archiveButton.find('.date').html(dateStringHuman);
                    let dateString = '';
                    if (Number.isInteger(dateYear)) {
                        dateString += '/' + dateYear;
                        if (Number.isInteger(dateMonth)) {
                            dateString += '/' + dateMonth;
                            if (Number.isInteger(dateDay)) {
                                dateString += '/' + dateDay;
                            }
                        }
                    }
                    let baseUrl = 'https://www.noen.at/portalarchiv';
                    let paramString = channel + 'portalarchiv' + type + dateString;
                    let archiveUrl = baseUrl.replace('portalarchiv', paramString);
                    archiveButton.attr('href', archiveUrl);
                    reloadOewa(OEWA);
                }
            }
        });
    }; */function setLoadStatus(status){status=status===undefined?true:status;loadInProgress=status}};var frontend=frontend||{};frontend.Geocoding=function(config){if(typeof config==="undefined"){config={}}var self=this;var position=false;var postalcode=false;var defaultIssue=location.href.indexOf("bvz")>-1?"eis":"stp";
/**
     * The default config.
     */self.defaults={defaultIssue:defaultIssue,mapzen_url:"https://search.mapzen.com/v1/reverse",mapzen_key:"",mapzen_size:"20",mapzen_layers:"venue",mapbox_url:"https://api.mapbox.com/geocoding/v5/mapbox.places/",mapbox_key:"pk.eyJ1Ijoid2luY2giLCJhIjoiY2pjenl6c2o3MmFwcDJ3cGc2OXFuaDR4cCJ9.MbYfj7cRXh5L8-LLBVfBIA",gn_url:"http://api.geonames.org/findNearbyPostalCodesJSON",gn_user:"",regionalise:true,issue:false,issueCommitedCookie:"issueCommited",container:".issue-autoreg-hint",ajaxUrl:"https://www.noen.at/",timeout:5e3};self.options={};$.extend(self.options,self.defaults,config);
/**
     * Constructor;
     */
(function(){
// we could do stuff here
})();self.regionaliseByUserPosition=function(regionalise,issue,newUrl){self.regionalise=regionalise;self.issue=issue;if(newUrl){self.ajaxUrl=newUrl}if(navigator.geolocation){navigator.geolocation.getCurrentPosition(self.geoSuccess,self.geoError,{timeout:self.timeout})}else{self.geocodingFailed("Geolocation not supported")}};self.geocodingFailed=function(errorThrown){var errorUrl=self.ajaxUrl.replace("issue-from-zip","geocoding-error");if(!self.postalcode){$.cookie(User.options.issueCookieName,self.options.defaultIssue,{expires:365,domain:User.options.issueCookieDomain,path:"/"});$.cookie(self.options.issueCommitedCookie,"0",{expires:365,domain:User.options.issueCookieDomain,path:"/"});if(self.regionalise){Regionalise.loadContent()}else if(self.issue){if(typeof frontend.HeaderRegionalisation!=="undefined"){frontend.HeaderRegionalisation.setupLocalIssue(self.issue,self.options.defaultIssue)}self.displayAutoRegHint()}if(typeof frontend.HeaderRegionalisation!=="undefined"){frontend.HeaderRegionalisation.updateSelected(self.options.defaultIssue)}}};self.geoSuccess=function(position){self.position=position;self.reverseGeocodeMapbox()};self.geoError=function(error){if(error.code==error.TIMEOUT){self.timeout=15e3;self.regionaliseByUserPosition(self.regionalise,self.issue,self.newUrl)}else if(!self.postalcode){self.geocodingFailed("Positionsbestimmung nicht gelungen ("+error.message+")")}else{self.geocodingFailed("Positionsbestimmung nicht gelungen, aber PLZ vorhanden ("+error.message+")")}};self.setIssueViaPostalcode=function(){if(self.postalcode){$.ajax({type:"GET",url:self.ajaxUrl+self.postalcode,dataType:"json",success:function(data,textStatus,jqXHR){$.cookie(User.options.issueCookieName,data.issue,{expires:365,domain:User.options.issueCookieDomain,path:"/"});$.cookie(self.options.issueCommitedCookie,"0",{expires:365,domain:User.options.issueCookieDomain,path:"/"});if(self.regionalise){Regionalise.loadContent()}else if(self.issue){if(typeof frontend.HeaderRegionalisation!=="undefined"){frontend.HeaderRegionalisation.setupLocalIssue(self.issue,data.issue)}self.displayAutoRegHint()}if(typeof frontend.HeaderRegionalisation!=="undefined"){frontend.HeaderRegionalisation.updateSelected(data.issue)}},error:function(jqXHR,textStatus,errorThrown){self.geocodingFailed("Fehler mit AJAX-Request (PLZ zu Ausgabe): "+errorThrown);self.displayAutoRegHint()},complete:function(jqXHR,textStatus){
// $(self.options.container).removeClass('issue-autoreg-hint--hidden');
}})}else{self.geocodingFailed("Keine Postleitzahl vorhanden")}};self.reverseGeocodeGeonames=function(){
// self.position.coords.longitude = 48.5575;
//self.position.coords.latitude = 16.55178;
if(self.position){$.ajax({type:"GET",url:self.options.gn_url,dataType:"json",data:{lat:self.position.coords.latitude,lng:self.position.coords.longitude,username:self.options.gn_user},success:function(data,textStatus,jqXHR){if(typeof data.postalCodes!=="undefined"){for(var j=0;j<data.postalCodes.length;j++){if(typeof data.postalCodes[j].postalCode!="undefined"){self.postalcode=data.postalCodes[j].postalCode;self.setIssueViaPostalcode();break}}}else{self.geocodingFailed("Keine Treffer für PLZ beim Reverse Geocoding")}},error:function(jqXHR,textStatus,errorThrown){self.geocodingFailed("Fehler mit AJAX-Request (Geonames): "+errorThrown)}})}else{self.geocodingFailed("keine Koordinaten vorhanden")}};self.reverseGeocodeMapbox=function(){if(self.position){$.ajax({type:"GET",url:self.options.mapbox_url+self.position.coords.longitude+"%2C"+self.position.coords.latitude+".json",dataType:"json",data:{access_token:self.options.mapbox_key},success:function(data,textStatus,jqXHR){for(var i=0;i<data.features.length;i++){if(typeof data.features[i].place_type[0]!="undefined"&&data.features[i].place_type[0]=="postcode"){self.postalcode=data.features[i].text;self.setIssueViaPostalcode();break}}if(!self.postalcode){self.reverseGeocodeGeonames()}},error:function(jqXHR,textStatus,errorThrown){self.geocodingFailed("Fehler mit AJAX-Request (Mapzen): "+errorThrown)}})}else{self.geocodingFailed("keine Koordinaten vorhanden")}};self.userSubmitSelection=function(){$.cookie(self.options.issueCommitedCookie,"1",{expires:365,domain:User.options.issueCookieDomain,path:"/"});location.href=location.href;$(self.options.container).hide(500).delay(500).addClass("issue-autoreg-hint--hidden")};self.userChangeSelection=function(){
// console.log('change');
};self.displayAutoRegHint=function(){var submitted=$.cookie(self.options.issueCommitedCookie);
// cookie exists and has an value of '0' -> location was set
// automatically and not commited by the user
if(submitted==="0"&&$(self.options.container).hasClass("issue-autoreg-hint--show")){$commit=$(self.options.container+" .issue-autoreg-hint__commit");$issuelink=$('#issuebox a[data-issue="'+$.cookie(User.options.issueCookieName)+'"]');if($issuelink.length==0){$issuelink=$('#editionpicker a[data-issue="'+$.cookie(User.options.issueCookieName)+'"]')}$commit.html($issuelink.html()).attr("href",$issuelink.attr("href"));$(self.options.container).removeClass("issue-autoreg-hint--hidden").show(500,function(){$(this).trigger("AutoRegHintDisplayed")})}}};var Geocoding;(function(){Geocoding=new frontend.Geocoding;$(document).ready(function(e){$(Geocoding.options.container).hide();$(Geocoding.options.container+" .issue-autoreg-hint__commit").on("click",function(e){e.preventDefault();Geocoding.userSubmitSelection()});$(Geocoding.options.container+" .issue-autoreg-hint__change").on("click",function(e){e.preventDefault();Geocoding.userChangeSelection()})});$(window).load(function(e){Geocoding.displayAutoRegHint()})})();var frontend=frontend||{};frontend.HeaderNavigation=function(){};frontend.HeaderNavigation.setLastElement=function(){
/*
    $main = $('header .header-main__nav-main');
    // $social = $('header .header-main__nav-socialmedia');
    $last = $main.find('.nav-item:last-of-type a');
    if ($main.length > 0) {
        $last.css('width', (960 - $main.outerWidth() + $last.width() + 3) + 'px');
    }
    */};frontend.HeaderNavigation.setupDropdownBehaviour=function(){$(".header-main__nav-main .nav-item").on("mouseenter",function(event){$current=$(".header-main__nav-main .header-main__nav-sub.hover");$this=$(this).find(".header-main__nav-sub");$parent=$(this);$parent.addClass("mouse-over");if($current.length>0){if($current[0]===$this[0]){$this.removeClass("mouse-leaving")}else{$current.removeClass("hover");$this.addClass("hover")}}else{setTimeout(function(){if($parent.hasClass("mouse-over")){$this.addClass("hover")}},250);
// $this.addClass('hover');
}});$(".header-main__nav-main .nav-item").on("mouseleave",function(event){$parent=$(this);$current=$(".header-main__nav-main .header-main__nav-sub.hover");$parent.removeClass("mouse-over");$current.addClass("mouse-leaving");if($current.length>0){setTimeout(function(){if($current.hasClass("mouse-leaving")){$current.removeClass("hover")}},250)}});$(".header-main__nav-sub .nav-sub-item").on("mouseenter",function(event){$activeThirdLevel=$(".header-main__nav-sub .nav-sub-item--childActive");if($(this)!=$activeThirdLevel){$activeThirdLevel.addClass("nav-sub-item--childActive-hide")}});$(".header-main__nav-sub .nav-sub-item").on("mouseleave",function(event){$activeThirdLevel=$(".header-main__nav-sub .nav-sub-item--childActive");$activeThirdLevel.removeClass("nav-sub-item--childActive-hide")})};frontend.HeaderNavigation.setupIssuedropdown=function(){$("#main-nav-regions").live("click",function(e){e.preventDefault();
// if the issue is not commited (1st visit on the site), open the
// selection of the home issue instead
if($.cookie("issueCommited")!=="1"){$("#issuebox").addClass("open");return}if(!$(this).hasClass("open")){$(this).addClass("open");$("#issuedropdown").removeClass("issuedropdown--hidden");$(document).on("mouseup",function(e){$mega=$("#issuedropdown");if($(this).is(e.target)||!$mega.is(e.target)&&$mega.has(e.target).length===0){$mega.addClass("issuedropdown--hidden");$(this).removeClass("open");$(document).unbind("mouseup")}});reloadOewa(OEWA)}else{$(this).removeClass("open");$("#issuedropdown").addClass("issuedropdown--hidden");$(document).unbind("mouseup")}})};var frontend=frontend||{};frontend.HeaderRegionalisation=function(){};frontend.FooterRegionalisation=function(){};frontend.HeaderRegionalisation.setupLocalIssue=function(local,issue){if(typeof Regionalise!=="undefined"){var $issuelink=$('#issuebox a[data-issue="'+issue+'"]');var $backlink=$(".issue-control__link--back");var $savelink=$(".issue-control__link--save");var $changelink=$(".issue-control__link--change");var isTicketShop=location.href.indexOf("/ticketshop")!==-1?true:false;$backlink.html($issuelink.html()).attr("href",$issuelink.attr("href")).attr("data-issue",issue).attr("data-regionalise-link-issue",issue);$savelink.attr("data-issue",local)}};frontend.HeaderRegionalisation.setup=function(uniqueId,auslandUrl){var savedIssue=$.cookie(User.options.issueCookieName);var $savedPath=$("#issue-map-"+uniqueId+" path."+savedIssue);$savedPath.attr("class",$savedPath.attr("class")+" selected");$("#issue-links-"+uniqueId+' a[data-issue="'+savedIssue+'"]').addClass("selected");
// click on path of the map
$("#issue-map-"+uniqueId+" path").on("click",function(event){event.preventDefault();var $path=$(this);var newIssue=$path.data("issue");var redirectUrl=$('#issuebox a[data-issue="'+newIssue+'"]').attr("href");var issueCommited=$.cookie(Geocoding.options.issueCommitedCookie);$.cookie(User.options.issueCookieName,newIssue,{expires:365,domain:User.options.issueCookieDomain,path:"/"});$.cookie(Geocoding.options.issueCommitedCookie,"1",{expires:365,domain:User.options.issueCookieDomain,path:"/"});if(typeof redirectUrl!=="undefined"){location.href=redirectUrl}else if(newIssue==="vienna"){location.href=auslandUrl}});$("#issue-links-"+uniqueId+" a[data-issue]").on("click",function(event){event.preventDefault();var newIssue=$(this).data("issue");$.cookie(User.options.issueCookieName,newIssue,{expires:365,domain:User.options.issueCookieDomain,path:"/"});$.cookie(Geocoding.options.issueCommitedCookie,"1",{expires:365,domain:User.options.issueCookieDomain,path:"/"});location.href=$(this).attr("href")});$("#issue-map-"+uniqueId+" path").on("mouseenter",function(event){var issue=$(this).data("issue");$('#issuebox a[data-issue="'+issue+'"]').addClass("hover")});$("#issue-map-"+uniqueId+" path").on("mouseleave",function(event){var issue=$(this).data("issue");$('#issuebox a[data-issue="'+issue+'"]').removeClass("hover")});$("#issuebox a[data-issue]").on("mouseenter",function(event){var issue=$(this).data("issue");var $path=$("#issue-map-"+uniqueId+" path."+issue);$path.attr("class",$path.attr("class")+" hover")});$("#issuebox a[data-issue]").on("mouseleave",function(event){var issue=$(this).data("issue");var $path=$("#issue-map-"+uniqueId+" path."+issue);$path.attr("class",$path.attr("class").replace("hover",""))});$("#issuebox a.close").on("click",function(event){event.preventDefault();$("#issuebox").removeClass("open")});$(".issue-control__map, .issue-control__link--change, #main-nav-regionalisation, a.issue-control-generic").on("click",function(event){event.preventDefault();$("#issuebox").addClass("open");reloadOewa(OEWA)})};frontend.FooterRegionalisation.setup=function(uniqueId,auslandUrl){var savedIssue=$.cookie(User.options.issueCookieName);var $savedPath=$("#issue-map-"+uniqueId+" path."+savedIssue);$savedPath.attr("class",$savedPath.attr("class")+" selected");$("#issue-links-"+uniqueId+' a[data-issue="'+savedIssue+'"]').addClass("selected");$("#issue-map-"+uniqueId+" path").on("click",function(event){event.preventDefault();var $path=$(this);var newIssue=$path.data("issue");var redirectUrl=$('#footer-issuebox a[data-issue="'+newIssue+'"]').attr("href");if(typeof redirectUrl!=="undefined"){location.href=redirectUrl}else if(newIssue==="vienna"){location.href=auslandUrl}});$("#issue-map-"+uniqueId+" path").on("mouseenter",function(event){var issue=$(this).data("issue");$('#footer-issuebox a[data-issue="'+issue+'"]').addClass("hover")});$("#issue-map-"+uniqueId+" path").on("mouseleave",function(event){var issue=$(this).data("issue");$('#footer-issuebox a[data-issue="'+issue+'"]').removeClass("hover")});$("#footer-issuebox a[data-issue]").on("mouseenter",function(event){var issue=$(this).data("issue");var $path=$("#issue-map-"+uniqueId+" path."+issue);$path.attr("class",$path.attr("class")+" hover")});$("#footer-issuebox a[data-issue]").on("mouseleave",function(event){var issue=$(this).data("issue");var $path=$("#issue-map-"+uniqueId+" path."+issue);$path.attr("class",$path.attr("class").replace("hover",""))})};frontend.HeaderRegionalisation.updateSelected=function(issue){$("#issuebox [data-issue].selected, #footer-issuebox [data-issue].selected").removeClass("selected");$('#issuebox [data-issue="'+issue+'"], #footer-issuebox [data-issue="'+issue+'"]').addClass("selected");$path_issuebox=$("#issuebox path.selected, #footer-issuebox path.selected");if($path_issuebox.length){$path_issuebox.attr("class",$path_issuebox.attr("class").replace("selected",""))}$path_issuebox=$("#issuebox path."+issue+", #footer-issuebox path."+issue);$path_issuebox.attr("class",$path_issuebox.attr("class")+" selected")};frontend.HeaderRegionalisation.updateIssueWithoutReload=function(issue){$.cookie(User.options.issueCookieName,issue,{expires:365,domain:User.options.issueCookieDomain,path:"/"});$.cookie(Geocoding.options.issueCommitedCookie,"1",{expires:365,domain:User.options.issueCookieDomain,path:"/"});frontend.HeaderRegionalisation.updateSelected(issue);if($(".issue-control .issue-control__link--save[data-issue]").length>0){currentIssue=$(".issue-control .issue-control__link--save[data-issue]").data("issue");frontend.HeaderRegionalisation.setupLocalIssue(currentIssue,$.cookie(User.options.issueCookieName))}$(Geocoding.options.container).addClass("issue-autoreg-hint--hidden");$("#issuebox").removeClass("open");Regionalise.loadContent()};
/*
 json2.js
 2012-10-08

 Public Domain.

 NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.

 See http://www.JSON.org/js.html


 This code should be minified before deployment.
 See http://javascript.crockford.com/jsmin.html

 USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO
 NOT CONTROL.


 This file creates a global JSON object containing two methods: stringify
 and parse.

 JSON.stringify(value, replacer, space)
 value       any JavaScript value, usually an object or array.

 replacer    an optional parameter that determines how object
 values are stringified for objects. It can be a
 function or an array of strings.

 space       an optional parameter that specifies the indentation
 of nested structures. If it is omitted, the text will
 be packed without extra whitespace. If it is a number,
 it will specify the number of spaces to indent at each
 level. If it is a string (such as '\t' or '&nbsp;'),
 it contains the characters used to indent at each level.

 This method produces a JSON text from a JavaScript value.

 When an object value is found, if the object contains a toJSON
 method, its toJSON method will be called and the result will be
 stringified. A toJSON method does not serialize: it returns the
 value represented by the name/value pair that should be serialized,
 or undefined if nothing should be serialized. The toJSON method
 will be passed the key associated with the value, and this will be
 bound to the value

 For example, this would serialize Dates as ISO strings.

 Date.prototype.toJSON = function (key) {
 function f(n) {
 // Format integers to have at least two digits.
 return n < 10 ? '0' + n : n;
 }

 return this.getUTCFullYear()   + '-' +
 f(this.getUTCMonth() + 1) + '-' +
 f(this.getUTCDate())      + 'T' +
 f(this.getUTCHours())     + ':' +
 f(this.getUTCMinutes())   + ':' +
 f(this.getUTCSeconds())   + 'Z';
 };

 You can provide an optional replacer method. It will be passed the
 key and value of each member, with this bound to the containing
 object. The value that is returned from your method will be
 serialized. If your method returns undefined, then the member will
 be excluded from the serialization.

 If the replacer parameter is an array of strings, then it will be
 used to select the members to be serialized. It filters the results
 such that only members with keys listed in the replacer array are
 stringified.

 Values that do not have JSON representations, such as undefined or
 functions, will not be serialized. Such values in objects will be
 dropped; in arrays they will be replaced with null. You can use
 a replacer function to replace those with JSON values.
 JSON.stringify(undefined) returns undefined.

 The optional space parameter produces a stringification of the
 value that is filled with line breaks and indentation to make it
 easier to read.

 If the space parameter is a non-empty string, then that string will
 be used for indentation. If the space parameter is a number, then
 the indentation will be that many spaces.

 Example:

 text = JSON.stringify(['e', {pluribus: 'unum'}]);
 // text is '["e",{"pluribus":"unum"}]'


 text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t');
 // text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]'

 text = JSON.stringify([new Date()], function (key, value) {
 return this[key] instanceof Date ?
 'Date(' + this[key] + ')' : value;
 });
 // text is '["Date(---current time---)"]'


 JSON.parse(text, reviver)
 This method parses a JSON text to produce an object or array.
 It can throw a SyntaxError exception.

 The optional reviver parameter is a function that can filter and
 transform the results. It receives each of the keys and values,
 and its return value is used instead of the original value.
 If it returns what it received, then the structure is not modified.
 If it returns undefined then the member is deleted.

 Example:

 // Parse the text. Values that look like ISO date strings will
 // be converted to Date objects.

 myData = JSON.parse(text, function (key, value) {
 var a;
 if (typeof value === 'string') {
 a =
 /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value);
 if (a) {
 return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4],
 +a[5], +a[6]));
 }
 }
 return value;
 });

 myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) {
 var d;
 if (typeof value === 'string' &&
 value.slice(0, 5) === 'Date(' &&
 value.slice(-1) === ')') {
 d = new Date(value.slice(5, -1));
 if (d) {
 return d;
 }
 }
 return value;
 });


 This is a reference implementation. You are free to copy, modify, or
 redistribute.
 */
/*jslint evil: true, regexp: true */
/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply,
 call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours,
 getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join,
 lastIndex, length, parse, prototype, push, replace, slice, stringify,
 test, toJSON, toString, valueOf
 */
// Create a JSON object only if one does not already exist. We create the
// methods in a closure to avoid creating global variables.
// console.log("in history");
if(typeof JSON!=="object"){JSON={}}(function(){"use strict";function f(n){
// Format integers to have at least two digits.
return n<10?"0"+n:n}if(typeof Date.prototype.toJSON!=="function"){Date.prototype.toJSON=function(key){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf()}}var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={// table of character substitutions
"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;function quote(string){
// If the string contains no control characters, no quote characters, and no
// backslash characters, then we can safely slap some quotes around it.
// Otherwise we must also replace the offending characters with safe escape
// sequences.
escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==="string"?c:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+string+'"'}function str(key,holder){
// Produce a string from holder[key].
var i,// The loop counter.
k,// The member key.
v,// The member value.
length,mind=gap,partial,value=holder[key];
// If the value has a toJSON method, call it to obtain a replacement value.
if(value&&typeof value==="object"&&typeof value.toJSON==="function"){value=value.toJSON(key)}
// If we were called with a replacer function, then call the replacer to
// obtain a replacement value.
if(typeof rep==="function"){value=rep.call(holder,key,value)}
// What happens next depends on the value's type.
switch(typeof value){case"string":return quote(value);case"number":
// JSON numbers must be finite. Encode non-finite numbers as null.
return isFinite(value)?String(value):"null";case"boolean":case"null":
// If the value is a boolean or null, convert it to a string. Note:
// typeof null does not produce 'null'. The case is included here in
// the remote chance that this gets fixed someday.
return String(value);
// If the type is 'object', we might be dealing with an object or an array or
// null.
case"object":
// Due to a specification blunder in ECMAScript, typeof null is 'object',
// so watch out for that case.
if(!value){return"null"}
// Make an array to hold the partial results of stringifying this object value.
gap+=indent;partial=[];
// Is the value an array?
if(Object.prototype.toString.apply(value)==="[object Array]"){
// The value is an array. Stringify every element. Use null as a placeholder
// for non-JSON values.
length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||"null"}
// Join all of the elements together, separated with commas, and wrap them in
// brackets.
v=partial.length===0?"[]":gap?"[\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"]":"["+partial.join(",")+"]";gap=mind;return v}
// If the replacer is an array, use it to select the members to be stringified.
if(rep&&typeof rep==="object"){length=rep.length;for(i=0;i<length;i+=1){if(typeof rep[i]==="string"){k=rep[i];v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}else{
// Otherwise, iterate through all of the keys in the object.
for(k in value){if(Object.prototype.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}
// Join all of the member texts together, separated with commas,
// and wrap them in braces.
v=partial.length===0?"{}":gap?"{\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"}":"{"+partial.join(",")+"}";gap=mind;return v}}
// If the JSON object does not yet have a stringify method, give it one.
if(typeof JSON.stringify!=="function"){JSON.stringify=function(value,replacer,space){
// The stringify method takes a value and an optional replacer, and an optional
// space parameter, and returns a JSON text. The replacer can be a function
// that can replace values, or an array of strings that will select the keys.
// A default replacer method can be provided. Use of the space parameter can
// produce text that is more easily readable.
var i;gap="";indent="";
// If the space parameter is a number, make an indent string containing that
// many spaces.
if(typeof space==="number"){for(i=0;i<space;i+=1){indent+=" "}
// If the space parameter is a string, it will be used as the indent string.
}else if(typeof space==="string"){indent=space}
// If there is a replacer, it must be a function or an array.
// Otherwise, throw an error.
rep=replacer;if(replacer&&typeof replacer!=="function"&&(typeof replacer!=="object"||typeof replacer.length!=="number")){throw new Error("JSON.stringify")}
// Make a fake root object containing our value under the key of ''.
// Return the result of stringifying the value.
return str("",{"":value})}}
// If the JSON object does not yet have a parse method, give it one.
if(typeof JSON.parse!=="function"){JSON.parse=function(text,reviver){
// The parse method takes a text and an optional reviver function, and returns
// a JavaScript value if the text is a valid JSON text.
var j;function walk(holder,key){
// The walk method is used to recursively walk the resulting structure so
// that modifications can be made.
var k,v,value=holder[key];if(value&&typeof value==="object"){for(k in value){if(Object.prototype.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v}else{delete value[k]}}}}return reviver.call(holder,key,value)}
// Parsing happens in four stages. In the first stage, we replace certain
// Unicode characters with escape sequences. JavaScript handles many characters
// incorrectly, either silently deleting them, or treating them as line endings.
text=String(text);cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})}
// In the second stage, we run the text against regular expressions that look
// for non-JSON patterns. We are especially concerned with '()' and 'new'
// because they can cause invocation, and '=' because it can cause mutation.
// But just to be safe, we want to reject all unexpected forms.
// We split the second stage into 4 regexp operations in order to work around
// crippling inefficiencies in IE's and Safari's regexp engines. First we
// replace the JSON backslash pairs with '@' (a non-JSON character). Second, we
// replace all simple value tokens with ']' characters. Third, we delete all
// open brackets that follow a colon or comma or that begin the text. Finally,
// we look to see that the remaining characters are only whitespace or ']' or
// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.
if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){
// In the third stage we use the eval function to compile the text into a
// JavaScript structure. The '{' operator is subject to a syntactic ambiguity
// in JavaScript: it can begin a block or an object literal. We wrap the text
// in parens to eliminate the ambiguity.
j=eval("("+text+")");
// In the optional fourth stage, we recursively walk the new structure, passing
// each name/value pair to a reviver function for possible transformation.
return typeof reviver==="function"?walk({"":j},""):j}
// If the text is not JSON parseable, then a SyntaxError is thrown.
throw new SyntaxError("JSON.parse")}}})();
/**
 * History.js jQuery Adapter
 * @author Benjamin Arthur Lupton <contact@balupton.com>
 * @copyright 2010-2011 Benjamin Arthur Lupton <contact@balupton.com>
 * @license New BSD License <http://creativecommons.org/licenses/BSD/>
 */
// Closure
(function(window,undefined){"use strict";
// Localise Globals
var History=window.History=window.History||{},jQuery=window.jQuery;
// Check Existence
if(typeof History.Adapter!=="undefined"){throw new Error("History.js Adapter has already been loaded...")}
// Add the Adapter
History.Adapter={
/**
         * History.Adapter.bind(el,event,callback)
         * @param {Element|string} el
         * @param {string} event - custom and standard events
         * @param {function} callback
         * @return {void}
         */
bind:function(el,event,callback){jQuery(el).bind(event,callback)},
/**
         * History.Adapter.trigger(el,event)
         * @param {Element|string} el
         * @param {string} event - custom and standard events
         * @param {Object=} extra - a object of extra event data (optional)
         * @return {void}
         */
trigger:function(el,event,extra){jQuery(el).trigger(event,extra)},
/**
         * History.Adapter.extractEventData(key,event,extra)
         * @param {string} key - key for the event data to extract
         * @param {string} event - custom and standard events
         * @param {Object=} extra - a object of extra event data (optional)
         * @return {mixed}
         */
extractEventData:function(key,event,extra){
// jQuery Native then jQuery Custom
var result=event&&event.originalEvent&&event.originalEvent[key]||extra&&extra[key]||undefined;
// Return
return result},
/**
         * History.Adapter.onDomLoad(callback)
         * @param {function} callback
         * @return {void}
         */
onDomLoad:function(callback){jQuery(callback)}};
// Try and Initialise History
if(typeof History.init!=="undefined"){History.init()}})(window);
/**
 * History.js HTML4 Support
 * Depends on the HTML5 Support
 * @author Benjamin Arthur Lupton <contact@balupton.com>
 * @copyright 2010-2011 Benjamin Arthur Lupton <contact@balupton.com>
 * @license New BSD License <http://creativecommons.org/licenses/BSD/>
 */
(function(window,undefined){"use strict";
// ========================================================================
// Initialise
// Localise Globals
var document=window.document,// Make sure we are using the correct document
setTimeout=window.setTimeout||setTimeout,clearTimeout=window.clearTimeout||clearTimeout,setInterval=window.setInterval||setInterval,History=window.History=window.History||{};// Public History Object
// Check Existence
if(typeof History.initHtml4!=="undefined"){throw new Error("History.js HTML4 Support has already been loaded...")}
// ========================================================================
// Initialise HTML4 Support
// Initialise HTML4 Support
History.initHtml4=function(){
// Initialise
if(typeof History.initHtml4.initialized!=="undefined"){
// Already Loaded
return false}else{History.initHtml4.initialized=true}
// ====================================================================
// Properties
/**
         * History.enabled
         * Is History enabled?
         */History.enabled=true;
// ====================================================================
// Hash Storage
/**
         * History.savedHashes
         * Store the hashes in an array
         */History.savedHashes=[];
/**
         * History.isLastHash(newHash)
         * Checks if the hash is the last hash
         * @param {string} newHash
         * @return {boolean} true
         */History.isLastHash=function(newHash){
// Prepare
var oldHash=History.getHashByIndex(),isLast;
// Check
isLast=newHash===oldHash;
// Return isLast
return isLast};
/**
         * History.isHashEqual(newHash, oldHash)
         * Checks to see if two hashes are functionally equal
         * @param {string} newHash
         * @param {string} oldHash
         * @return {boolean} true
         */History.isHashEqual=function(newHash,oldHash){newHash=encodeURIComponent(newHash).replace(/%25/g,"%");oldHash=encodeURIComponent(oldHash).replace(/%25/g,"%");return newHash===oldHash};
/**
         * History.saveHash(newHash)
         * Push a Hash
         * @param {string} newHash
         * @return {boolean} true
         */History.saveHash=function(newHash){
// Check Hash
if(History.isLastHash(newHash)){return false}
// Push the Hash
History.savedHashes.push(newHash);
// Return true
return true};
/**
         * History.getHashByIndex()
         * Gets a hash by the index
         * @param {integer} index
         * @return {string}
         */History.getHashByIndex=function(index){
// Prepare
var hash=null;
// Handle
if(typeof index==="undefined"){
// Get the last inserted
hash=History.savedHashes[History.savedHashes.length-1]}else if(index<0){
// Get from the end
hash=History.savedHashes[History.savedHashes.length+index]}else{
// Get from the beginning
hash=History.savedHashes[index]}
// Return hash
return hash};
// ====================================================================
// Discarded States
/**
         * History.discardedHashes
         * A hashed array of discarded hashes
         */History.discardedHashes={};
/**
         * History.discardedStates
         * A hashed array of discarded states
         */History.discardedStates={};
/**
         * History.discardState(State)
         * Discards the state by ignoring it through History
         * @param {object} State
         * @return {true}
         */History.discardState=function(discardedState,forwardState,backState){
//History.debug('History.discardState', arguments);
// Prepare
var discardedStateHash=History.getHashByState(discardedState),discardObject;
// Create Discard Object
discardObject={discardedState:discardedState,backState:backState,forwardState:forwardState};
// Add to DiscardedStates
History.discardedStates[discardedStateHash]=discardObject;
// Return true
return true};
/**
         * History.discardHash(hash)
         * Discards the hash by ignoring it through History
         * @param {string} hash
         * @return {true}
         */History.discardHash=function(discardedHash,forwardState,backState){
//History.debug('History.discardState', arguments);
// Create Discard Object
var discardObject={discardedHash:discardedHash,backState:backState,forwardState:forwardState};
// Add to discardedHash
History.discardedHashes[discardedHash]=discardObject;
// Return true
return true};
/**
         * History.discardedState(State)
         * Checks to see if the state is discarded
         * @param {object} State
         * @return {bool}
         */History.discardedState=function(State){
// Prepare
var StateHash=History.getHashByState(State),discarded;
// Check
discarded=History.discardedStates[StateHash]||false;
// Return true
return discarded};
/**
         * History.discardedHash(hash)
         * Checks to see if the state is discarded
         * @param {string} State
         * @return {bool}
         */History.discardedHash=function(hash){
// Check
var discarded=History.discardedHashes[hash]||false;
// Return true
return discarded};
/**
         * History.recycleState(State)
         * Allows a discarded state to be used again
         * @param {object} data
         * @param {string} title
         * @param {string} url
         * @return {true}
         */History.recycleState=function(State){
//History.debug('History.recycleState', arguments);
// Prepare
var StateHash=History.getHashByState(State);
// Remove from DiscardedStates
if(History.discardedState(State)){delete History.discardedStates[StateHash]}
// Return true
return true};
// ====================================================================
// HTML4 HashChange Support
if(History.emulated.hashChange){
/*
             * We must emulate the HTML4 HashChange Support by manually checking for hash changes
             */
/**
             * History.hashChangeInit()
             * Init the HashChange Emulation
             */
History.hashChangeInit=function(){
// Define our Checker Function
History.checkerFunction=null;
// Define some variables that will help in our checker function
var lastDocumentHash="",iframeId,iframe,lastIframeHash,checkerRunning,startedWithHash=Boolean(History.getHash());
// Handle depending on the browser
if(History.isInternetExplorer()){
// IE6 and IE7
// We need to use an iframe to emulate the back and forward buttons
// Create iFrame
iframeId="historyjs-iframe";iframe=document.createElement("iframe");
// Adjust iFarme
// IE 6 requires iframe to have a src on HTTPS pages, otherwise it will throw a
// "This page contains both secure and nonsecure items" warning.
iframe.setAttribute("id",iframeId);iframe.setAttribute("src","#");iframe.style.display="none";
// Append iFrame
document.body.appendChild(iframe);
// Create initial history entry
iframe.contentWindow.document.open();iframe.contentWindow.document.close();
// Define some variables that will help in our checker function
lastIframeHash="";checkerRunning=false;
// Define the checker function
History.checkerFunction=function(){
// Check Running
if(checkerRunning){return false}
// Update Running
checkerRunning=true;
// Fetch
var documentHash=History.getHash(),iframeHash=History.getHash(iframe.contentWindow.document);
// The Document Hash has changed (application caused)
if(documentHash!==lastDocumentHash){
// Equalise
lastDocumentHash=documentHash;
// Create a history entry in the iframe
if(iframeHash!==documentHash){
//History.debug('hashchange.checker: iframe hash change', 'documentHash (new):', documentHash, 'iframeHash (old):', iframeHash);
// Equalise
lastIframeHash=iframeHash=documentHash;
// Create History Entry
iframe.contentWindow.document.open();iframe.contentWindow.document.close();
// Update the iframe's hash
iframe.contentWindow.document.location.hash=History.escapeHash(documentHash)}
// Trigger Hashchange Event
History.Adapter.trigger(window,"hashchange")}
// The iFrame Hash has changed (back button caused)
else if(iframeHash!==lastIframeHash){
//History.debug('hashchange.checker: iframe hash out of sync', 'iframeHash (new):', iframeHash, 'documentHash (old):', documentHash);
// Equalise
lastIframeHash=iframeHash;
// If there is no iframe hash that means we're at the original
// iframe state.
// And if there was a hash on the original request, the original
// iframe state was replaced instantly, so skip this state and take
// the user back to where they came from.
if(startedWithHash&&iframeHash===""){History.back()}else{
// Update the Hash
History.setHash(iframeHash,false)}}
// Reset Running
checkerRunning=false;
// Return true
return true}}else{
// We are not IE
// Firefox 1 or 2, Opera
// Define the checker function
History.checkerFunction=function(){
// Prepare
var documentHash=History.getHash()||"";
// The Document Hash has changed (application caused)
if(documentHash!==lastDocumentHash){
// Equalise
lastDocumentHash=documentHash;
// Trigger Hashchange Event
History.Adapter.trigger(window,"hashchange")}
// Return true
return true}}
// Apply the checker function
History.intervalList.push(setInterval(History.checkerFunction,History.options.hashChangeInterval));
// Done
return true};// History.hashChangeInit
// Bind hashChangeInit
History.Adapter.onDomLoad(History.hashChangeInit)}// History.emulated.hashChange
// ====================================================================
// HTML5 State Support
// Non-Native pushState Implementation
if(History.emulated.pushState){
/*
             * We must emulate the HTML5 State Management by using HTML4 HashChange
             */
/**
             * History.onHashChange(event)
             * Trigger HTML5's window.onpopstate via HTML4 HashChange Support
             */
History.onHashChange=function(event){
//History.debug('History.onHashChange', arguments);
// Prepare
var currentUrl=event&&event.newURL||History.getLocationHref(),currentHash=History.getHashByUrl(currentUrl),currentState=null,currentStateHash=null,currentStateHashExits=null,discardObject;
// Check if we are the same state
if(History.isLastHash(currentHash)){
// There has been no change (just the page's hash has finally propagated)
//History.debug('History.onHashChange: no change');
History.busy(false);return false}
// Reset the double check
History.doubleCheckComplete();
// Store our location for use in detecting back/forward direction
History.saveHash(currentHash);
// Expand Hash
if(currentHash&&History.isTraditionalAnchor(currentHash)){
//History.debug('History.onHashChange: traditional anchor', currentHash);
// Traditional Anchor Hash
History.Adapter.trigger(window,"anchorchange");History.busy(false);return false}
// Create State
currentState=History.extractState(History.getFullUrl(currentHash||History.getLocationHref()),true);
// Check if we are the same state
if(History.isLastSavedState(currentState)){
//History.debug('History.onHashChange: no change');
// There has been no change (just the page's hash has finally propagated)
History.busy(false);return false}
// Create the state Hash
currentStateHash=History.getHashByState(currentState);
// Check if we are DiscardedState
discardObject=History.discardedState(currentState);if(discardObject){
// Ignore this state as it has been discarded and go back to the state before it
if(History.getHashByIndex(-2)===History.getHashByState(discardObject.forwardState)){
// We are going backwards
//History.debug('History.onHashChange: go backwards');
History.back(false)}else{
// We are going forwards
//History.debug('History.onHashChange: go forwards');
History.forward(false)}return false}
// Push the new HTML5 State
//History.debug('History.onHashChange: success hashchange');
History.pushState(currentState.data,currentState.title,encodeURI(currentState.url),false);
// End onHashChange closure
return true};History.Adapter.bind(window,"hashchange",History.onHashChange);
/**
             * History.pushState(data,title,url)
             * Add a new State to the history object, become it, and trigger onpopstate
             * We have to trigger for HTML4 compatibility
             * @param {object} data
             * @param {string} title
             * @param {string} url
             * @return {true}
             */History.pushState=function(data,title,url,queue){
//History.debug('History.pushState: called', arguments);
// We assume that the URL passed in is URI-encoded, but this makes
// sure that it's fully URI encoded; any '%'s that are encoded are
// converted back into '%'s
url=encodeURI(url).replace(/%25/g,"%");
// Check the State
if(History.getHashByUrl(url)){throw new Error("History.js does not support states with fragment-identifiers (hashes/anchors).")}
// Handle Queueing
if(queue!==false&&History.busy()){
// Wait + Push to Queue
//History.debug('History.pushState: we must wait', arguments);
History.pushQueue({scope:History,callback:History.pushState,args:arguments,queue:queue});return false}
// Make Busy
History.busy(true);
// Fetch the State Object
var newState=History.createStateObject(data,title,url),newStateHash=History.getHashByState(newState),oldState=History.getState(false),oldStateHash=History.getHashByState(oldState),html4Hash=History.getHash(),wasExpected=History.expectedStateId==newState.id;
// Store the newState
History.storeState(newState);History.expectedStateId=newState.id;
// Recycle the State
History.recycleState(newState);
// Force update of the title
History.setTitle(newState);
// Check if we are the same State
if(newStateHash===oldStateHash){
//History.debug('History.pushState: no change', newStateHash);
History.busy(false);return false}
// Update HTML5 State
History.saveState(newState);
// Fire HTML5 Event
if(!wasExpected)History.Adapter.trigger(window,"statechange");
// Update HTML4 Hash
if(!History.isHashEqual(newStateHash,html4Hash)&&!History.isHashEqual(newStateHash,History.getShortUrl(History.getLocationHref()))){History.setHash(newStateHash,false)}History.busy(false);
// End pushState closure
return true};
/**
             * History.replaceState(data,title,url)
             * Replace the State and trigger onpopstate
             * We have to trigger for HTML4 compatibility
             * @param {object} data
             * @param {string} title
             * @param {string} url
             * @return {true}
             */History.replaceState=function(data,title,url,queue){
//History.debug('History.replaceState: called', arguments);
// We assume that the URL passed in is URI-encoded, but this makes
// sure that it's fully URI encoded; any '%'s that are encoded are
// converted back into '%'s
url=encodeURI(url).replace(/%25/g,"%");
// Check the State
if(History.getHashByUrl(url)){throw new Error("History.js does not support states with fragment-identifiers (hashes/anchors).")}
// Handle Queueing
if(queue!==false&&History.busy()){
// Wait + Push to Queue
//History.debug('History.replaceState: we must wait', arguments);
History.pushQueue({scope:History,callback:History.replaceState,args:arguments,queue:queue});return false}
// Make Busy
History.busy(true);
// Fetch the State Objects
var newState=History.createStateObject(data,title,url),newStateHash=History.getHashByState(newState),oldState=History.getState(false),oldStateHash=History.getHashByState(oldState),previousState=History.getStateByIndex(-2);
// Discard Old State
History.discardState(oldState,newState,previousState);
// If the url hasn't changed, just store and save the state
// and fire a statechange event to be consistent with the
// html 5 api
if(newStateHash===oldStateHash){
// Store the newState
History.storeState(newState);History.expectedStateId=newState.id;
// Recycle the State
History.recycleState(newState);
// Force update of the title
History.setTitle(newState);
// Update HTML5 State
History.saveState(newState);
// Fire HTML5 Event
//History.debug('History.pushState: trigger popstate');
History.Adapter.trigger(window,"statechange");History.busy(false)}else{
// Alias to PushState
History.pushState(newState.data,newState.title,newState.url,false)}
// End replaceState closure
return true}}// History.emulated.pushState
// ====================================================================
// Initialise
// Non-Native pushState Implementation
if(History.emulated.pushState){
/**
             * Ensure initial state is handled correctly
             */
if(History.getHash()&&!History.emulated.hashChange){History.Adapter.onDomLoad(function(){History.Adapter.trigger(window,"hashchange")})}}// History.emulated.pushState
};// History.initHtml4
// Try to Initialise History
if(typeof History.init!=="undefined"){History.init()}})(window);
/**
 * History.js Core
 * @author Benjamin Arthur Lupton <contact@balupton.com>
 * @copyright 2010-2011 Benjamin Arthur Lupton <contact@balupton.com>
 * @license New BSD License <http://creativecommons.org/licenses/BSD/>
 */
(function(window,undefined){"use strict";
// ========================================================================
// Initialise
// Localise Globals
var console=window.console||undefined,// Prevent a JSLint complain
document=window.document,// Make sure we are using the correct document
navigator=window.navigator,// Make sure we are using the correct navigator
sessionStorage=window.sessionStorage||false,// sessionStorage
setTimeout=window.setTimeout,clearTimeout=window.clearTimeout,setInterval=window.setInterval,clearInterval=window.clearInterval,JSON=window.JSON,alert=window.alert,History=window.History=window.History||{},// Public History Object
history=window.history;// Old History Object
try{sessionStorage.setItem("TEST","1");sessionStorage.removeItem("TEST")}catch(e){sessionStorage=false}
// MooTools Compatibility
JSON.stringify=JSON.stringify||JSON.encode;JSON.parse=JSON.parse||JSON.decode;
// Check Existence
if(typeof History.init!=="undefined"){throw new Error("History.js Core has already been loaded...")}
// Initialise History
History.init=function(options){
// Check Load Status of Adapter
if(typeof History.Adapter==="undefined"){return false}
// Check Load Status of Core
if(typeof History.initCore!=="undefined"){History.initCore()}
// Check Load Status of HTML4 Support
if(typeof History.initHtml4!=="undefined"){History.initHtml4()}
// Return true
return true};
// ========================================================================
// Initialise Core
// Initialise Core
History.initCore=function(options){
// Initialise
if(typeof History.initCore.initialized!=="undefined"){
// Already Loaded
return false}else{History.initCore.initialized=true}
// ====================================================================
// Options
/**
         * History.options
         * Configurable options
         */History.options=History.options||{};
/**
         * History.options.hashChangeInterval
         * How long should the interval be before hashchange checks
         */History.options.hashChangeInterval=History.options.hashChangeInterval||100;
/**
         * History.options.safariPollInterval
         * How long should the interval be before safari poll checks
         */History.options.safariPollInterval=History.options.safariPollInterval||500;
/**
         * History.options.doubleCheckInterval
         * How long should the interval be before we perform a double check
         */History.options.doubleCheckInterval=History.options.doubleCheckInterval||500;
/**
         * History.options.disableSuid
         * Force History not to append suid
         */History.options.disableSuid=History.options.disableSuid||false;
/**
         * History.options.storeInterval
         * How long should we wait between store calls
         */History.options.storeInterval=History.options.storeInterval||1e3;
/**
         * History.options.busyDelay
         * How long should we wait between busy events
         */History.options.busyDelay=History.options.busyDelay||250;
/**
         * History.options.debug
         * If true will enable debug messages to be logged
         */History.options.debug=History.options.debug||false;
/**
         * History.options.initialTitle
         * What is the title of the initial state
         */History.options.initialTitle=History.options.initialTitle||document.title;
/**
         * History.options.html4Mode
         * If true, will force HTMl4 mode (hashtags)
         */History.options.html4Mode=History.options.html4Mode||false;
/**
         * History.options.delayInit
         * Want to override default options and call init manually.
         */History.options.delayInit=History.options.delayInit||false;
// ====================================================================
// Interval record
/**
         * History.intervalList
         * List of intervals set, to be cleared when document is unloaded.
         */History.intervalList=[];
/**
         * History.clearAllIntervals
         * Clears all setInterval instances.
         */History.clearAllIntervals=function(){var i,il=History.intervalList;if(typeof il!=="undefined"&&il!==null){for(i=0;i<il.length;i++){clearInterval(il[i])}History.intervalList=null}};
// ====================================================================
// Debug
/**
         * History.debug(message,...)
         * Logs the passed arguments if debug enabled
         */History.debug=function(){if(History.options.debug||false){History.log.apply(History,arguments)}};
/**
         * History.log(message,...)
         * Logs the passed arguments
         */History.log=function(){
// Prepare
var consoleExists=!(typeof console==="undefined"||typeof console.log==="undefined"||typeof console.log.apply==="undefined"),textarea=document.getElementById("log"),message,i,n,args,arg;
// Write to Console
if(consoleExists){args=Array.prototype.slice.call(arguments);message=args.shift();if(typeof console.debug!=="undefined"){console.debug.apply(console,[message,args])}else{console.log.apply(console,[message,args])}}else{message="\n"+arguments[0]+"\n"}
// Write to log
for(i=1,n=arguments.length;i<n;++i){arg=arguments[i];if(typeof arg==="object"&&typeof JSON!=="undefined"){try{arg=JSON.stringify(arg)}catch(Exception){
// Recursive Object
}}message+="\n"+arg+"\n"}
// Textarea
if(textarea){textarea.value+=message+"\n-----\n";textarea.scrollTop=textarea.scrollHeight-textarea.clientHeight}
// No Textarea, No Console
else if(!consoleExists){alert(message)}
// Return true
return true};
// ====================================================================
// Emulated Status
/**
         * History.getInternetExplorerMajorVersion()
         * Get's the major version of Internet Explorer
         * @return {integer}
         * @license Public Domain
         * @author Benjamin Arthur Lupton <contact@balupton.com>
         * @author James Padolsey <https://gist.github.com/527683>
         */History.getInternetExplorerMajorVersion=function(){var result=History.getInternetExplorerMajorVersion.cached=typeof History.getInternetExplorerMajorVersion.cached!=="undefined"?History.getInternetExplorerMajorVersion.cached:function(){var v=3,div=document.createElement("div"),all=div.getElementsByTagName("i");while((div.innerHTML="\x3c!--[if gt IE "+ ++v+"]><i></i><![endif]--\x3e")&&all[0]){}return v>4?v:false}();return result};
/**
         * History.isInternetExplorer()
         * Are we using Internet Explorer?
         * @return {boolean}
         * @license Public Domain
         * @author Benjamin Arthur Lupton <contact@balupton.com>
         */History.isInternetExplorer=function(){var result=History.isInternetExplorer.cached=typeof History.isInternetExplorer.cached!=="undefined"?History.isInternetExplorer.cached:Boolean(History.getInternetExplorerMajorVersion());return result};
/**
         * History.emulated
         * Which features require emulating?
         */if(History.options.html4Mode){History.emulated={pushState:true,hashChange:true}}else{History.emulated={pushState:!Boolean(window.history&&window.history.pushState&&window.history.replaceState&&!(/ Mobile\/([1-7][a-z]|(8([abcde]|f(1[0-8]))))/i.test(navigator.userAgent)/* disable for versions of iOS before version 4.3 (8F190) */||/AppleWebKit\/5([0-2]|3[0-2])/i.test(navigator.userAgent)/* disable for the mercury iOS browser, or at least older versions of the webkit engine */)),hashChange:Boolean(!("onhashchange"in window||"onhashchange"in document)||History.isInternetExplorer()&&History.getInternetExplorerMajorVersion()<8)}}
/**
         * History.enabled
         * Is History enabled?
         */History.enabled=!History.emulated.pushState;
/**
         * History.bugs
         * Which bugs are present
         */History.bugs={
/**
             * Safari 5 and Safari iOS 4 fail to return to the correct state once a hash is replaced by a `replaceState` call
             * https://bugs.webkit.org/show_bug.cgi?id=56249
             */
setHash:Boolean(!History.emulated.pushState&&navigator.vendor==="Apple Computer, Inc."&&/AppleWebKit\/5([0-2]|3[0-3])/.test(navigator.userAgent)),
/**
             * Safari 5 and Safari iOS 4 sometimes fail to apply the state change under busy conditions
             * https://bugs.webkit.org/show_bug.cgi?id=42940
             */
safariPoll:Boolean(!History.emulated.pushState&&navigator.vendor==="Apple Computer, Inc."&&/AppleWebKit\/5([0-2]|3[0-3])/.test(navigator.userAgent)),
/**
             * MSIE 6 and 7 sometimes do not apply a hash even it was told to (requiring a second call to the apply function)
             */
ieDoubleCheck:Boolean(History.isInternetExplorer()&&History.getInternetExplorerMajorVersion()<8),
/**
             * MSIE 6 requires the entire hash to be encoded for the hashes to trigger the onHashChange event
             */
hashEscape:Boolean(History.isInternetExplorer()&&History.getInternetExplorerMajorVersion()<7)};
/**
         * History.isEmptyObject(obj)
         * Checks to see if the Object is Empty
         * @param {Object} obj
         * @return {boolean}
         */History.isEmptyObject=function(obj){for(var name in obj){if(obj.hasOwnProperty(name)){return false}}return true};
/**
         * History.cloneObject(obj)
         * Clones a object and eliminate all references to the original contexts
         * @param {Object} obj
         * @return {Object}
         */History.cloneObject=function(obj){var hash,newObj;if(obj){hash=JSON.stringify(obj);newObj=JSON.parse(hash)}else{newObj={}}return newObj};
// ====================================================================
// URL Helpers
/**
         * History.getRootUrl()
         * Turns "http://mysite.com/dir/page.html?asd" into "http://mysite.com"
         * @return {String} rootUrl
         */History.getRootUrl=function(){
// Create
var rootUrl=document.location.protocol+"//"+(document.location.hostname||document.location.host);if(document.location.port||false){rootUrl+=":"+document.location.port}rootUrl+="/";
// Return
return rootUrl};
/**
         * History.getBaseHref()
         * Fetches the `href` attribute of the `<base href="...">` element if it exists
         * @return {String} baseHref
         */History.getBaseHref=function(){
// Create
var baseElements=document.getElementsByTagName("base"),baseElement=null,baseHref="";
// Test for Base Element
if(baseElements.length===1){
// Prepare for Base Element
baseElement=baseElements[0];baseHref=baseElement.href.replace(/[^\/]+$/,"")}
// Adjust trailing slash
baseHref=baseHref.replace(/\/+$/,"");if(baseHref)baseHref+="/";
// Return
return baseHref};
/**
         * History.getBaseUrl()
         * Fetches the baseHref or basePageUrl or rootUrl (whichever one exists first)
         * @return {String} baseUrl
         */History.getBaseUrl=function(){
// Create
var baseUrl=History.getBaseHref()||History.getBasePageUrl()||History.getRootUrl();
// Return
return baseUrl};
/**
         * History.getPageUrl()
         * Fetches the URL of the current page
         * @return {String} pageUrl
         */History.getPageUrl=function(){
// Fetch
var State=History.getState(false,false),stateUrl=(State||{}).url||History.getLocationHref(),pageUrl;
// Create
pageUrl=stateUrl.replace(/\/+$/,"").replace(/[^\/]+$/,function(part,index,string){return/\./.test(part)?part:part+"/"});
// Return
return pageUrl};
/**
         * History.getBasePageUrl()
         * Fetches the Url of the directory of the current page
         * @return {String} basePageUrl
         */History.getBasePageUrl=function(){
// Create
var basePageUrl=History.getLocationHref().replace(/[#\?].*/,"").replace(/[^\/]+$/,function(part,index,string){return/[^\/]$/.test(part)?"":part}).replace(/\/+$/,"")+"/";
// Return
return basePageUrl};
/**
         * History.getFullUrl(url)
         * Ensures that we have an absolute URL and not a relative URL
         * @param {string} url
         * @param {Boolean} allowBaseHref
         * @return {string} fullUrl
         */History.getFullUrl=function(url,allowBaseHref){
// Prepare
var fullUrl=url,firstChar=url.substring(0,1);allowBaseHref=typeof allowBaseHref==="undefined"?true:allowBaseHref;
// Check
if(/[a-z]+\:\/\//.test(url)){
// Full URL
}else if(firstChar==="/"){
// Root URL
fullUrl=History.getRootUrl()+url.replace(/^\/+/,"")}else if(firstChar==="#"){
// Anchor URL
fullUrl=History.getPageUrl().replace(/#.*/,"")+url}else if(firstChar==="?"){
// Query URL
fullUrl=History.getPageUrl().replace(/[\?#].*/,"")+url}else{
// Relative URL
if(allowBaseHref){fullUrl=History.getBaseUrl()+url.replace(/^(\.\/)+/,"")}else{fullUrl=History.getBasePageUrl()+url.replace(/^(\.\/)+/,"")}
// We have an if condition above as we do not want hashes
// which are relative to the baseHref in our URLs
// as if the baseHref changes, then all our bookmarks
// would now point to different locations
// whereas the basePageUrl will always stay the same
}
// Return
return fullUrl.replace(/\#$/,"")};
/**
         * History.getShortUrl(url)
         * Ensures that we have a relative URL and not a absolute URL
         * @param {string} url
         * @return {string} url
         */History.getShortUrl=function(url){
// Prepare
var shortUrl=url,baseUrl=History.getBaseUrl(),rootUrl=History.getRootUrl();
// Trim baseUrl
if(History.emulated.pushState){
// We are in a if statement as when pushState is not emulated
// The actual url these short urls are relative to can change
// So within the same session, we the url may end up somewhere different
shortUrl=shortUrl.replace(baseUrl,"")}
// Trim rootUrl
shortUrl=shortUrl.replace(rootUrl,"/");
// Ensure we can still detect it as a state
if(History.isTraditionalAnchor(shortUrl)){shortUrl="./"+shortUrl}
// Clean It
shortUrl=shortUrl.replace(/^(\.\/)+/g,"./").replace(/\#$/,"");
// Return
return shortUrl};
/**
         * History.getLocationHref(document)
         * Returns a normalized version of document.location.href
         * accounting for browser inconsistencies, etc.
         *
         * This URL will be URI-encoded and will include the hash
         *
         * @param {object} document
         * @return {string} url
         */History.getLocationHref=function(doc){doc=doc||document;
// most of the time, this will be true
if(doc.URL===doc.location.href)return doc.location.href;
// some versions of webkit URI-decode document.location.href
// but they leave document.URL in an encoded state
if(doc.location.href===decodeURIComponent(doc.URL))return doc.URL;
// FF 3.6 only updates document.URL when a page is reloaded
// document.location.href is updated correctly
if(doc.location.hash&&decodeURIComponent(doc.location.href.replace(/^[^#]+/,""))===doc.location.hash)return doc.location.href;if(doc.URL.indexOf("#")==-1&&doc.location.href.indexOf("#")!=-1)return doc.location.href;return doc.URL||doc.location.href};
// ====================================================================
// State Storage
/**
         * History.store
         * The store for all session specific data
         */History.store={};
/**
         * History.idToState
         * 1-1: State ID to State Object
         */History.idToState=History.idToState||{};
/**
         * History.stateToId
         * 1-1: State String to State ID
         */History.stateToId=History.stateToId||{};
/**
         * History.urlToId
         * 1-1: State URL to State ID
         */History.urlToId=History.urlToId||{};
/**
         * History.storedStates
         * Store the states in an array
         */History.storedStates=History.storedStates||[];
/**
         * History.savedStates
         * Saved the states in an array
         */History.savedStates=History.savedStates||[];
/**
         * History.noramlizeStore()
         * Noramlize the store by adding necessary values
         */History.normalizeStore=function(){History.store.idToState=History.store.idToState||{};History.store.urlToId=History.store.urlToId||{};History.store.stateToId=History.store.stateToId||{}};
/**
         * History.getState()
         * Get an object containing the data, title and url of the current state
         * @param {Boolean} friendly
         * @param {Boolean} create
         * @return {Object} State
         */History.getState=function(friendly,create){
// Prepare
if(typeof friendly==="undefined"){friendly=true}if(typeof create==="undefined"){create=true}
// Fetch
var State=History.getLastSavedState();
// Create
if(!State&&create){State=History.createStateObject()}
// Adjust
if(friendly){State=History.cloneObject(State);State.url=State.cleanUrl||State.url}
// Return
return State};
/**
         * History.getIdByState(State)
         * Gets a ID for a State
         * @param {State} newState
         * @return {String} id
         */History.getIdByState=function(newState){
// Fetch ID
var id=History.extractId(newState.url),str;if(!id){
// Find ID via State String
str=History.getStateString(newState);if(typeof History.stateToId[str]!=="undefined"){id=History.stateToId[str]}else if(typeof History.store.stateToId[str]!=="undefined"){id=History.store.stateToId[str]}else{
// Generate a new ID
while(true){id=(new Date).getTime()+String(Math.random()).replace(/\D/g,"");if(typeof History.idToState[id]==="undefined"&&typeof History.store.idToState[id]==="undefined"){break}}
// Apply the new State to the ID
History.stateToId[str]=id;History.idToState[id]=newState}}
// Return ID
return id};
/**
         * History.normalizeState(State)
         * Expands a State Object
         * @param {object} State
         * @return {object}
         */History.normalizeState=function(oldState){
// Variables
var newState,dataNotEmpty;
// Prepare
if(!oldState||typeof oldState!=="object"){oldState={}}
// Check
if(typeof oldState.normalized!=="undefined"){return oldState}
// Adjust
if(!oldState.data||typeof oldState.data!=="object"){oldState.data={}}
// ----------------------------------------------------------------
// Create
newState={};newState.normalized=true;newState.title=oldState.title||"";newState.url=History.getFullUrl(oldState.url?oldState.url:History.getLocationHref());newState.hash=History.getShortUrl(newState.url);newState.data=History.cloneObject(oldState.data);
// Fetch ID
newState.id=History.getIdByState(newState);
// ----------------------------------------------------------------
// Clean the URL
newState.cleanUrl=newState.url.replace(/\??\&_suid.*/,"");newState.url=newState.cleanUrl;
// Check to see if we have more than just a url
dataNotEmpty=!History.isEmptyObject(newState.data);
// Apply
if((newState.title||dataNotEmpty)&&History.options.disableSuid!==true){
// Add ID to Hash
newState.hash=History.getShortUrl(newState.url).replace(/\??\&_suid.*/,"");if(!/\?/.test(newState.hash)){newState.hash+="?"}newState.hash+="&_suid="+newState.id}
// Create the Hashed URL
newState.hashedUrl=History.getFullUrl(newState.hash);
// ----------------------------------------------------------------
// Update the URL if we have a duplicate
if((History.emulated.pushState||History.bugs.safariPoll)&&History.hasUrlDuplicate(newState)){newState.url=newState.hashedUrl}
// ----------------------------------------------------------------
// Return
return newState};
/**
         * History.createStateObject(data,title,url)
         * Creates a object based on the data, title and url state params
         * @param {object} data
         * @param {string} title
         * @param {string} url
         * @return {object}
         */History.createStateObject=function(data,title,url){
// Hashify
var State={data:data,title:title,url:url};
// Expand the State
State=History.normalizeState(State);
// Return object
return State};
/**
         * History.getStateById(id)
         * Get a state by it's UID
         * @param {String} id
         */History.getStateById=function(id){
// Prepare
id=String(id);
// Retrieve
var State=History.idToState[id]||History.store.idToState[id]||undefined;
// Return State
return State};
/**
         * Get a State's String
         * @param {State} passedState
         */History.getStateString=function(passedState){
// Prepare
var State,cleanedState,str;
// Fetch
State=History.normalizeState(passedState);
// Clean
cleanedState={data:State.data,title:passedState.title,url:passedState.url};
// Fetch
str=JSON.stringify(cleanedState);
// Return
return str};
/**
         * Get a State's ID
         * @param {State} passedState
         * @return {String} id
         */History.getStateId=function(passedState){
// Prepare
var State,id;
// Fetch
State=History.normalizeState(passedState);
// Fetch
id=State.id;
// Return
return id};
/**
         * History.getHashByState(State)
         * Creates a Hash for the State Object
         * @param {State} passedState
         * @return {String} hash
         */History.getHashByState=function(passedState){
// Prepare
var State,hash;
// Fetch
State=History.normalizeState(passedState);
// Hash
hash=State.hash;
// Return
return hash};
/**
         * History.extractId(url_or_hash)
         * Get a State ID by it's URL or Hash
         * @param {string} url_or_hash
         * @return {string} id
         */History.extractId=function(url_or_hash){
// Prepare
var id,parts,url,tmp;
// Extract
// If the URL has a #, use the id from before the #
if(url_or_hash.indexOf("#")!=-1){tmp=url_or_hash.split("#")[0]}else{tmp=url_or_hash}parts=/(.*)\&_suid=([0-9]+)$/.exec(tmp);url=parts?parts[1]||url_or_hash:url_or_hash;id=parts?String(parts[2]||""):"";
// Return
return id||false};
/**
         * History.isTraditionalAnchor
         * Checks to see if the url is a traditional anchor or not
         * @param {String} url_or_hash
         * @return {Boolean}
         */History.isTraditionalAnchor=function(url_or_hash){
// Check
var isTraditional=!/[\/\?\.]/.test(url_or_hash);
// Return
return isTraditional};
/**
         * History.extractState
         * Get a State by it's URL or Hash
         * @param {String} url_or_hash
         * @return {State|null}
         */History.extractState=function(url_or_hash,create){
// Prepare
var State=null,id,url;create=create||false;
// Fetch SUID
id=History.extractId(url_or_hash);if(id){State=History.getStateById(id)}
// Fetch SUID returned no State
if(!State){
// Fetch URL
url=History.getFullUrl(url_or_hash);
// Check URL
id=History.getIdByUrl(url)||false;if(id){State=History.getStateById(id)}
// Create State
if(!State&&create&&!History.isTraditionalAnchor(url_or_hash)){State=History.createStateObject(null,null,url)}}
// Return
return State};
/**
         * History.getIdByUrl()
         * Get a State ID by a State URL
         */History.getIdByUrl=function(url){
// Fetch
var id=History.urlToId[url]||History.store.urlToId[url]||undefined;
// Return
return id};
/**
         * History.getLastSavedState()
         * Get an object containing the data, title and url of the current state
         * @return {Object} State
         */History.getLastSavedState=function(){return History.savedStates[History.savedStates.length-1]||undefined};
/**
         * History.getLastStoredState()
         * Get an object containing the data, title and url of the current state
         * @return {Object} State
         */History.getLastStoredState=function(){return History.storedStates[History.storedStates.length-1]||undefined};
/**
         * History.hasUrlDuplicate
         * Checks if a Url will have a url conflict
         * @param {Object} newState
         * @return {Boolean} hasDuplicate
         */History.hasUrlDuplicate=function(newState){
// Prepare
var hasDuplicate=false,oldState;
// Fetch
oldState=History.extractState(newState.url);
// Check
hasDuplicate=oldState&&oldState.id!==newState.id;
// Return
return hasDuplicate};
/**
         * History.storeState
         * Store a State
         * @param {Object} newState
         * @return {Object} newState
         */History.storeState=function(newState){
// Store the State
History.urlToId[newState.url]=newState.id;
// Push the State
History.storedStates.push(History.cloneObject(newState));
// Return newState
return newState};
/**
         * History.isLastSavedState(newState)
         * Tests to see if the state is the last state
         * @param {Object} newState
         * @return {boolean} isLast
         */History.isLastSavedState=function(newState){
// Prepare
var isLast=false,newId,oldState,oldId;
// Check
if(History.savedStates.length){newId=newState.id;oldState=History.getLastSavedState();oldId=oldState.id;
// Check
isLast=newId===oldId}
// Return
return isLast};
/**
         * History.saveState
         * Push a State
         * @param {Object} newState
         * @return {boolean} changed
         */History.saveState=function(newState){
// Check Hash
if(History.isLastSavedState(newState)){return false}
// Push the State
History.savedStates.push(History.cloneObject(newState));
// Return true
return true};
/**
         * History.getStateByIndex()
         * Gets a state by the index
         * @param {integer} index
         * @return {Object}
         */History.getStateByIndex=function(index){
// Prepare
var State=null;
// Handle
if(typeof index==="undefined"){
// Get the last inserted
State=History.savedStates[History.savedStates.length-1]}else if(index<0){
// Get from the end
State=History.savedStates[History.savedStates.length+index]}else{
// Get from the beginning
State=History.savedStates[index]}
// Return State
return State};
/**
         * History.getCurrentIndex()
         * Gets the current index
         * @return (integer)
         */History.getCurrentIndex=function(){
// Prepare
var index=null;
// No states saved
if(History.savedStates.length<1){index=0}else{index=History.savedStates.length-1}return index};
// ====================================================================
// Hash Helpers
/**
         * History.getHash()
         * @param {Location=} location
         * Gets the current document hash
         * Note: unlike location.hash, this is guaranteed to return the escaped hash in all browsers
         * @return {string}
         */History.getHash=function(doc){var url=History.getLocationHref(doc),hash;hash=History.getHashByUrl(url);return hash};
/**
         * History.unescapeHash()
         * normalize and Unescape a Hash
         * @param {String} hash
         * @return {string}
         */History.unescapeHash=function(hash){
// Prepare
var result=History.normalizeHash(hash);
// Unescape hash
result=decodeURIComponent(result);
// Return result
return result};
/**
         * History.normalizeHash()
         * normalize a hash across browsers
         * @return {string}
         */History.normalizeHash=function(hash){
// Prepare
var result=hash.replace(/[^#]*#/,"").replace(/#.*/,"");
// Return result
return result};
/**
         * History.setHash(hash)
         * Sets the document hash
         * @param {string} hash
         * @return {History}
         */History.setHash=function(hash,queue){
// Prepare
var State,pageUrl;
// Handle Queueing
if(queue!==false&&History.busy()){
// Wait + Push to Queue
//History.debug('History.setHash: we must wait', arguments);
History.pushQueue({scope:History,callback:History.setHash,args:arguments,queue:queue});return false}
// Log
//History.debug('History.setHash: called',hash);
// Make Busy + Continue
History.busy(true);
// Check if hash is a state
State=History.extractState(hash,true);if(State&&!History.emulated.pushState){
// Hash is a state so skip the setHash
//History.debug('History.setHash: Hash is a state so skipping the hash set with a direct pushState call',arguments);
// PushState
History.pushState(State.data,State.title,State.url,false)}else if(History.getHash()!==hash){
// Hash is a proper hash, so apply it
// Handle browser bugs
if(History.bugs.setHash){
// Fix Safari Bug https://bugs.webkit.org/show_bug.cgi?id=56249
// Fetch the base page
pageUrl=History.getPageUrl();
// Safari hash apply
History.pushState(null,null,pageUrl+"#"+hash,false)}else{
// Normal hash apply
document.location.hash=hash}}
// Chain
return History};
/**
         * History.escape()
         * normalize and Escape a Hash
         * @return {string}
         */History.escapeHash=function(hash){
// Prepare
var result=History.normalizeHash(hash);
// Escape hash
result=window.encodeURIComponent(result);
// IE6 Escape Bug
if(!History.bugs.hashEscape){
// Restore common parts
result=result.replace(/\%21/g,"!").replace(/\%26/g,"&").replace(/\%3D/g,"=").replace(/\%3F/g,"?")}
// Return result
return result};
/**
         * History.getHashByUrl(url)
         * Extracts the Hash from a URL
         * @param {string} url
         * @return {string} url
         */History.getHashByUrl=function(url){
// Extract the hash
var hash=String(url).replace(/([^#]*)#?([^#]*)#?(.*)/,"$2");
// Unescape hash
hash=History.unescapeHash(hash);
// Return hash
return hash};
/**
         * History.setTitle(title)
         * Applies the title to the document
         * @param {State} newState
         * @return {Boolean}
         */History.setTitle=function(newState){
// Prepare
var title=newState.title,firstState;
// Initial
if(!title){firstState=History.getStateByIndex(0);if(firstState&&firstState.url===newState.url){title=firstState.title||History.options.initialTitle}}
// Apply
try{document.getElementsByTagName("title")[0].innerHTML=title.replace("<","&lt;").replace(">","&gt;").replace(" & "," &amp; ")}catch(Exception){}document.title=title;
// Chain
return History};
// ====================================================================
// Queueing
/**
         * History.queues
         * The list of queues to use
         * First In, First Out
         */History.queues=[];
/**
         * History.busy(value)
         * @param {boolean} value [optional]
         * @return {boolean} busy
         */History.busy=function(value){
// Apply
if(typeof value!=="undefined"){
//History.debug('History.busy: changing ['+(History.busy.flag||false)+'] to ['+(value||false)+']', History.queues.length);
History.busy.flag=value}
// Default
else if(typeof History.busy.flag==="undefined"){History.busy.flag=false}
// Queue
if(!History.busy.flag){
// Execute the next item in the queue
clearTimeout(History.busy.timeout);var fireNext=function(){var i,queue,item;if(History.busy.flag)return;for(i=History.queues.length-1;i>=0;--i){queue=History.queues[i];if(queue.length===0)continue;item=queue.shift();History.fireQueueItem(item);History.busy.timeout=setTimeout(fireNext,History.options.busyDelay)}};History.busy.timeout=setTimeout(fireNext,History.options.busyDelay)}
// Return
return History.busy.flag};
/**
         * History.busy.flag
         */History.busy.flag=false;
/**
         * History.fireQueueItem(item)
         * Fire a Queue Item
         * @param {Object} item
         * @return {Mixed} result
         */History.fireQueueItem=function(item){return item.callback.apply(item.scope||History,item.args||[])};
/**
         * History.pushQueue(callback,args)
         * Add an item to the queue
         * @param {Object} item [scope,callback,args,queue]
         */History.pushQueue=function(item){
// Prepare the queue
History.queues[item.queue||0]=History.queues[item.queue||0]||[];
// Add to the queue
History.queues[item.queue||0].push(item);
// Chain
return History};
/**
         * History.queue (item,queue), (func,queue), (func), (item)
         * Either firs the item now if not busy, or adds it to the queue
         */History.queue=function(item,queue){
// Prepare
if(typeof item==="function"){item={callback:item}}if(typeof queue!=="undefined"){item.queue=queue}
// Handle
if(History.busy()){History.pushQueue(item)}else{History.fireQueueItem(item)}
// Chain
return History};
/**
         * History.clearQueue()
         * Clears the Queue
         */History.clearQueue=function(){History.busy.flag=false;History.queues=[];return History};
// ====================================================================
// IE Bug Fix
/**
         * History.stateChanged
         * States whether or not the state has changed since the last double check was initialised
         */History.stateChanged=false;
/**
         * History.doubleChecker
         * Contains the timeout used for the double checks
         */History.doubleChecker=false;
/**
         * History.doubleCheckComplete()
         * Complete a double check
         * @return {History}
         */History.doubleCheckComplete=function(){
// Update
History.stateChanged=true;
// Clear
History.doubleCheckClear();
// Chain
return History};
/**
         * History.doubleCheckClear()
         * Clear a double check
         * @return {History}
         */History.doubleCheckClear=function(){
// Clear
if(History.doubleChecker){clearTimeout(History.doubleChecker);History.doubleChecker=false}
// Chain
return History};
/**
         * History.doubleCheck()
         * Create a double check
         * @return {History}
         */History.doubleCheck=function(tryAgain){
// Reset
History.stateChanged=false;History.doubleCheckClear();
// Fix IE6,IE7 bug where calling history.back or history.forward does not actually change the hash (whereas doing it manually does)
// Fix Safari 5 bug where sometimes the state does not change: https://bugs.webkit.org/show_bug.cgi?id=42940
if(History.bugs.ieDoubleCheck){
// Apply Check
History.doubleChecker=setTimeout(function(){History.doubleCheckClear();if(!History.stateChanged){
//History.debug('History.doubleCheck: State has not yet changed, trying again', arguments);
// Re-Attempt
tryAgain()}return true},History.options.doubleCheckInterval)}
// Chain
return History};
// ====================================================================
// Safari Bug Fix
/**
         * History.safariStatePoll()
         * Poll the current state
         * @return {History}
         */History.safariStatePoll=function(){
// Poll the URL
// Get the Last State which has the new URL
var urlState=History.extractState(History.getLocationHref()),newState;
// Check for a difference
if(!History.isLastSavedState(urlState)){newState=urlState}else{return}
// Check if we have a state with that url
// If not create it
if(!newState){
//History.debug('History.safariStatePoll: new');
newState=History.createStateObject()}
// Apply the New State
//History.debug('History.safariStatePoll: trigger');
History.Adapter.trigger(window,"popstate");
// Chain
return History};
// ====================================================================
// State Aliases
/**
         * History.back(queue)
         * Send the browser history back one item
         * @param {Integer} queue [optional]
         */History.back=function(queue){
//History.debug('History.back: called', arguments);
// Handle Queueing
if(queue!==false&&History.busy()){
// Wait + Push to Queue
//History.debug('History.back: we must wait', arguments);
History.pushQueue({scope:History,callback:History.back,args:arguments,queue:queue});return false}
// Make Busy + Continue
History.busy(true);
// Fix certain browser bugs that prevent the state from changing
History.doubleCheck(function(){History.back(false)});
// Go back
history.go(-1);
// End back closure
return true};
/**
         * History.forward(queue)
         * Send the browser history forward one item
         * @param {Integer} queue [optional]
         */History.forward=function(queue){
//History.debug('History.forward: called', arguments);
// Handle Queueing
if(queue!==false&&History.busy()){
// Wait + Push to Queue
//History.debug('History.forward: we must wait', arguments);
History.pushQueue({scope:History,callback:History.forward,args:arguments,queue:queue});return false}
// Make Busy + Continue
History.busy(true);
// Fix certain browser bugs that prevent the state from changing
History.doubleCheck(function(){History.forward(false)});
// Go forward
history.go(1);
// End forward closure
return true};
/**
         * History.go(index,queue)
         * Send the browser history back or forward index times
         * @param {Integer} queue [optional]
         */History.go=function(index,queue){
//History.debug('History.go: called', arguments);
// Prepare
var i;
// Handle
if(index>0){
// Forward
for(i=1;i<=index;++i){History.forward(queue)}}else if(index<0){
// Backward
for(i=-1;i>=index;--i){History.back(queue)}}else{throw new Error("History.go: History.go requires a positive or negative integer passed.")}
// Chain
return History};
// ====================================================================
// HTML5 State Support
// Non-Native pushState Implementation
if(History.emulated.pushState){
/*
             * Provide Skeleton for HTML4 Browsers
             */
// Prepare
var emptyFunction=function(){};History.pushState=History.pushState||emptyFunction;History.replaceState=History.replaceState||emptyFunction}// History.emulated.pushState
// Native pushState Implementation
else{
/*
             * Use native HTML5 History API Implementation
             */
/**
             * History.onPopState(event,extra)
             * Refresh the Current State
             */
History.onPopState=function(event,extra){
// Prepare
var stateId=false,newState=false,currentHash,currentState;
// Reset the double check
History.doubleCheckComplete();
// Check for a Hash, and handle apporiatly
currentHash=History.getHash();if(currentHash){
// Expand Hash
currentState=History.extractState(currentHash||History.getLocationHref(),true);if(currentState){
// We were able to parse it, it must be a State!
// Let's forward to replaceState
//History.debug('History.onPopState: state anchor', currentHash, currentState);
History.replaceState(currentState.data,currentState.title,currentState.url,false)}else{
// Traditional Anchor
//History.debug('History.onPopState: traditional anchor', currentHash);
History.Adapter.trigger(window,"anchorchange");History.busy(false)}
// We don't care for hashes
History.expectedStateId=false;return false}
// Ensure
stateId=History.Adapter.extractEventData("state",event,extra)||false;
// Fetch State
if(stateId){
// Vanilla: Back/forward button was used
newState=History.getStateById(stateId)}else if(History.expectedStateId){
// Vanilla: A new state was pushed, and popstate was called manually
newState=History.getStateById(History.expectedStateId)}else{
// Initial State
newState=History.extractState(History.getLocationHref())}
// The State did not exist in our store
if(!newState){
// Regenerate the State
newState=History.createStateObject(null,null,History.getLocationHref())}
// Clean
History.expectedStateId=false;
// Check if we are the same state
if(History.isLastSavedState(newState)){
// There has been no change (just the page's hash has finally propagated)
//History.debug('History.onPopState: no change', newState, History.savedStates);
History.busy(false);return false}
// Store the State
History.storeState(newState);History.saveState(newState);
// Force update of the title
History.setTitle(newState);
// Fire Our Event
History.Adapter.trigger(window,"statechange");History.busy(false);
// Return true
return true};History.Adapter.bind(window,"popstate",History.onPopState);
/**
             * History.pushState(data,title,url)
             * Add a new State to the history object, become it, and trigger onpopstate
             * We have to trigger for HTML4 compatibility
             * @param {object} data
             * @param {string} title
             * @param {string} url
             * @return {true}
             */History.pushState=function(data,title,url,queue){
//History.debug('History.pushState: called', arguments);
// Check the State
if(History.getHashByUrl(url)&&History.emulated.pushState){throw new Error("History.js does not support states with fragement-identifiers (hashes/anchors).")}
// Handle Queueing
if(queue!==false&&History.busy()){
// Wait + Push to Queue
//History.debug('History.pushState: we must wait', arguments);
History.pushQueue({scope:History,callback:History.pushState,args:arguments,queue:queue});return false}
// Make Busy + Continue
History.busy(true);
// Create the newState
var newState=History.createStateObject(data,title,url);
// Check it
if(History.isLastSavedState(newState)){
// Won't be a change
History.busy(false)}else{
// Store the newState
History.storeState(newState);History.expectedStateId=newState.id;
// Push the newState
history.pushState(newState.id,newState.title,newState.url);
// Fire HTML5 Event
History.Adapter.trigger(window,"popstate")}
// End pushState closure
return true};
/**
             * History.replaceState(data,title,url)
             * Replace the State and trigger onpopstate
             * We have to trigger for HTML4 compatibility
             * @param {object} data
             * @param {string} title
             * @param {string} url
             * @return {true}
             */History.replaceState=function(data,title,url,queue){
//History.debug('History.replaceState: called', arguments);
// Check the State
if(History.getHashByUrl(url)&&History.emulated.pushState){throw new Error("History.js does not support states with fragement-identifiers (hashes/anchors).")}
// Handle Queueing
if(queue!==false&&History.busy()){
// Wait + Push to Queue
//History.debug('History.replaceState: we must wait', arguments);
History.pushQueue({scope:History,callback:History.replaceState,args:arguments,queue:queue});return false}
// Make Busy + Continue
History.busy(true);
// Create the newState
var newState=History.createStateObject(data,title,url);
// Check it
if(History.isLastSavedState(newState)){
// Won't be a change
History.busy(false)}else{
// Store the newState
History.storeState(newState);History.expectedStateId=newState.id;
// Push the newState
history.replaceState(newState.id,newState.title,newState.url);
// Fire HTML5 Event
History.Adapter.trigger(window,"popstate")}
// End replaceState closure
return true}}// !History.emulated.pushState
// ====================================================================
// Initialise
/**
         * Load the Store
         */if(sessionStorage){
// Fetch
try{History.store=JSON.parse(sessionStorage.getItem("History.store"))||{}}catch(err){History.store={}}
// Normalize
History.normalizeStore()}else{
// Default Load
History.store={};History.normalizeStore()}
/**
         * Clear Intervals on exit to prevent memory leaks
         */History.Adapter.bind(window,"unload",History.clearAllIntervals);
/**
         * Create the initial State
         */History.saveState(History.storeState(History.extractState(History.getLocationHref(),true)));
/**
         * Bind for Saving Store
         */if(sessionStorage){
// When the page is closed
History.onUnload=function(){
// Prepare
var currentStore,item,currentStoreString;
// Fetch
try{currentStore=JSON.parse(sessionStorage.getItem("History.store"))||{}}catch(err){currentStore={}}
// Ensure
currentStore.idToState=currentStore.idToState||{};currentStore.urlToId=currentStore.urlToId||{};currentStore.stateToId=currentStore.stateToId||{};
// Sync
for(item in History.idToState){if(!History.idToState.hasOwnProperty(item)){continue}currentStore.idToState[item]=History.idToState[item]}for(item in History.urlToId){if(!History.urlToId.hasOwnProperty(item)){continue}currentStore.urlToId[item]=History.urlToId[item]}for(item in History.stateToId){if(!History.stateToId.hasOwnProperty(item)){continue}currentStore.stateToId[item]=History.stateToId[item]}
// Update
History.store=currentStore;History.normalizeStore();
// In Safari, going into Private Browsing mode causes the
// Session Storage object to still exist but if you try and use
// or set any property/function of it it throws the exception
// "QUOTA_EXCEEDED_ERR: DOM Exception 22: An attempt was made to
// add something to storage that exceeded the quota." infinitely
// every second.
currentStoreString=JSON.stringify(currentStore);try{
// Store
sessionStorage.setItem("History.store",currentStoreString)}catch(e){if(e.code===DOMException.QUOTA_EXCEEDED_ERR){if(sessionStorage.length){
// Workaround for a bug seen on iPads. Sometimes the quota exceeded error comes up and simply
// removing/resetting the storage can work.
sessionStorage.removeItem("History.store");sessionStorage.setItem("History.store",currentStoreString)}else{
// Otherwise, we're probably private browsing in Safari, so we'll ignore the exception.
}}else{throw e}}};
// For Internet Explorer
History.intervalList.push(setInterval(History.onUnload,History.options.storeInterval));
// For Other Browsers
History.Adapter.bind(window,"beforeunload",History.onUnload);History.Adapter.bind(window,"unload",History.onUnload);
// Both are enabled for consistency
}
// Non-Native pushState Implementation
if(!History.emulated.pushState){
// Be aware, the following is only for native pushState implementations
// If you are wanting to include something for all browsers
// Then include it above this if block
/**
             * Setup Safari Fix
             */
if(History.bugs.safariPoll){History.intervalList.push(setInterval(History.safariStatePoll,History.options.safariPollInterval))}
/**
             * Ensure Cross Browser Compatibility
             */if(navigator.vendor==="Apple Computer, Inc."||(navigator.appCodeName||"")==="Mozilla"){
/**
                 * Fix Safari HashChange Issue
                 */
// Setup Alias
History.Adapter.bind(window,"hashchange",function(){History.Adapter.trigger(window,"popstate")});
// Initialise Alias
if(History.getHash()){History.Adapter.onDomLoad(function(){History.Adapter.trigger(window,"hashchange")})}}}// !History.emulated.pushState
};// History.initCore
// Try to Initialise History
if(!History.options||!History.options.delayInit){History.init()}})(window);
/**
 * Created by hhofstaetter on 23.07.15.
 */frontend=frontend||{};frontend.InlineImage={scrollTop:null,toggleImageFullScreen:function($wrapper){var self=this;if(self.scrollTop===null){self.scrollTop=$(window).scrollTop()}var $image=$wrapper.find(".wrap img");var $button=$wrapper.find(".article-image__zoom");var originalUrl=$image.attr("src");$image.attr("src",$image.data("fullscreen-src"));$image.data("fullscreen-src",originalUrl);$("body").toggleClass("image-in-fullscreen");if($("body").hasClass("image-in-fullscreen")){reloadOewa(OEWA)}$wrapper.toggleClass("article-image--is-fullscreen");$button.toggleClass("icon-resize-full-alt").toggleClass("icon-close");if(!$("body").hasClass("image-in-fullscreen")){window.scrollTo(1,self.scrollTop);self.scrollTop=null}}};var trackKeydown=function(event){if(event.keyCode==27&&$(".article-image--is-fullscreen").length>0){frontend.InlineImage.toggleImageFullScreen($(".article-image--is-fullscreen"));event.preventDefault();return false}};if(typeof document.addEventListener!=="undefined"){document.addEventListener("keydown",trackKeydown)}else if(typeof document.attachEvent!=="undefined"){document.attachEvent("onkeydown",trackKeydown)}var frontend=frontend||{};frontend.Regionalise=function(config){if(typeof config==="undefined"){config={}}var self=this;
/**
     * The default config.
     */self.defaults={cookieName:"localIssue",regionaliseUpdateUrl:"https://www.noen.at/regionaliseupdate"};self.options={};$.extend(self.options,self.defaults,config);
/**
     * Constructor;
     */
(function(){
// we could do stuff here
})();self.loadContentXhr=null;self.loadContent=function(temporaryIssue){if(self.hasIssueCookie()||typeof temporaryIssue!=="undefined"){
// get exclude ids here
var excludeIds=[];$("[data-content]").each(function(i,el){$element=$(el);if($element.closest("[data-regionalise-template]").length===0){excludeIds.push($(el).data("content"))}});var templates=[];$("[data-regionalise-template]").each(function(i,el){templates.push($(el).data("regionalise-template"))});var physicians=[];$("[data-regionalise-physicians]").each(function(i,el){physicians.push({tpl:$(el).data("regionalise-physicians"),entry:$(el).data("regionalise-physicians-entry"),output:""})});var keys=[];$("[data-regionalise-data]").each(function(i,el){keys.push($(el).data("regionalise-data"))});var issueLinks=[];$("[data-regionalise-link-issue]").each(function(i,el){issueLinks.push($(el).data("regionalise-link-issue"))});var epapers=[];$("[data-regionalise-epaper]").each(function(i,el){if($(el).data("regionalise-epaper")!="epaper-box"){epapers.push($(el).data("regionalise-epaper"))}});var epaperBoxes=[];$('[data-regionalise-epaper="epaper-box"]').each(function(i,el){epaperBoxes.push({id:$(el).attr("id"),size:$(el).data("epaper-size"),limit:$(el).data("epaper-limit"),type:$(el).data("epaper-type"),editionId:$(el).data("epaper-editionid"),showMore:$(el).data("epaper-showmore"),entry:$(el).data("epaper-entry"),linkto:$(el).data("epaper-linkto")})});var onduty=[];$("[data-regionalise-onduty]").each(function(i,el){onduty.push($(el).data("regionalise-onduty"))});var weather=[];$("[data-regionalise-weather]").each(function(i,el){weather.push($(el).data("regionalise-weather"))});var channel=$("body").data("channel");
// get sections to update here
var data={excludeIds:excludeIds,templates:templates,keys:keys,issueLinks:issueLinks,epapers:epapers,onduty:onduty,weather:weather,epaperBoxes:epaperBoxes,physicians:physicians};if(typeof temporaryIssue!=="undefined"){data.temporaryIssue=temporaryIssue}if(typeof channel!=="undefined"){data.channel=channel}if(self.loadContentXhr!==null){
// do nothing if request is active
return}if(keys.length===0&&templates.length===0&&issueLinks.length===0&&epapers.length===0&&epaperBoxes.length===0&&physicians.length===0&&onduty.length===0&&weather.length===0){return}self.loadContentXhr=$.ajax({type:"GET",url:self.options.regionaliseUpdateUrl,dataType:"json",data:data,xhrFields:{withCredentials:true},success:function(data,textStatus,jqXHR){if(typeof data["templates"]!=="undefined"){for(var i in data["templates"]){var row=data["templates"][i];var $object=$('[data-regionalise-template="'+i+'"]');$object.replaceWith($(row));$object=$('[data-regionalise-template="'+i+'"]');
// if box has an overlay showing loading information, remove this overlay once the data is loaded
if($object.hasClass("issue-loading--inprogress")){$object.removeClass("issue-loading--inprogress").addClass("issue-loading--finished").delay(1e3).queue(function(){$(this).removeClass("issue-loading").dequeue()})}}}if(typeof data["data"]!=="undefined"){for(var i in data["data"]){var row=data["data"][i];var $object=$('[data-regionalise-data="'+i+'"]');var $span=$("<span></span>");
// we have to check if we have text and href, if yes we need to change a link
if(typeof row==="object"){if($(location).attr("href")===row["href"]&&$object.closest("li").hasClass("nav-item")){if(typeof row["text"]!=="undefined"){$span.text(row["text"])}$span.attr("data-regionalise-data",i);$object.replaceWith($span)}else{if(typeof row["href"]!=="undefined"){$object.attr("href",row["href"])}if(typeof row["text"]!=="undefined"){$object.text(row["text"])}if(typeof row["class"]!=="undefined"){$object.attr("class",row["class"])}}
// checks if the local issue in the main nav has to be highlightes
if($object.closest("li").hasClass("nav-item")&&$object.closest("li").data("current-issue-abbreviation")){if($object.closest("li").data("current-issue-abbreviation")==row["userIssue"]){$object.closest("li").addClass("nav-item--active")}else{$object.closest("li").removeClass("nav-item--active")}}$regions=$object.closest(".header-main__nav-main").find(".main-nav-regions").parent();if($regions.length>0&&$object.parent().hasClass("nav-item-channel--local-issue")||$regions.length>0&&$object.parent().hasClass("nav-item-channel--local-issue-bvz")){if($regions.data("other-issue-abbreviation")&&$regions.data("other-issue-abbreviation")!=row["userIssue"]){$regions.addClass("nav-item--active")}else{$regions.removeClass("nav-item--active")}}if($object.hasClass("issue-loading-inline--inprogress")){$object.removeClass("issue-loading-inline--inprogress").addClass("issue-loading-inline--finished").delay(1e3).queue(function(){$(this).removeClass("issue-loading-inline ").dequeue()});
// $object.removeClass('issue-loading-inline--inprogress').addClass('issue-loading-inline--finished');
// if $object is localIssue-link in header, remove class "issue-loading-inline--inprogress"
// from issueSave-link
if($object.hasClass("issue-control__issue")){$(".header-main .issue-control .issue-control__links .issue-control__link--save").removeClass("issue-loading-inline--inprogress").addClass("issue-loading-inline--finished")}}$object.fadeTo("fast",1);if(typeof frontend.HeaderNavigation!=="undefined"){frontend.HeaderNavigation.setLastElement()}continue}}}if(typeof data["issue"]!=="undefined"){for(var i in data["issue"]){var row=data["issue"][i];var $object=$('[data-regionalise-link-issue="'+i+'"]');if(typeof row==="object"){if(typeof row["href"]!=="undefined"){$object.attr("href",row["href"])}if(typeof row["text"]!=="undefined"){$object.text(row["text"])}if(typeof row["issue"]!=="undefined"){$object.attr("data-issue",row["issue"])}if($object.hasClass("issue-loading-inline--inprogress")){$object.removeClass("issue-loading-inline--inprogress").addClass("issue-loading-inline--finished")}continue}}}if(typeof data["weather"]!=="undefined"){for(var i in data["weather"]){var row=data["weather"][i];var $object=$('[data-regionalise-weather="'+i+'"]');if(typeof row==="object"){if(i==="issue-weather-today"){for(var key in row){if(key==="params"){$object.find(".param.wind").html(row[key]["wind"]+"km/h");$object.find(".param.direction").html(row[key]["direction"]);$object.find(".param.condensation").html(row[key]["rain"]+"mm")}else if(key==="station"){$object.find("h3").html(row[key])}else{$object.find("ul li:nth-of-type("+(key-1)+") .lage").removeClass().addClass("lage lage-wetter-"+row[key]["symbol"]);$object.find("ul li:nth-of-type("+(key-1)+") .temp").html(row[key]["temp"]+"°")}}if($object.hasClass("issue-loading--inprogress")){$object.removeClass("issue-loading--inprogress").addClass("issue-loading--finished").delay(1e3).queue(function(){$(this).removeClass("issue-loading").dequeue()})}}else if(i==="issue-weather-mini"){if(typeof row["url"]!=="undefined"){$object.find("a").attr("href",row["url"])}if(typeof row["symbol"]!=="undefined"){$object.find(".lage").attr("class","lage width-75 lage-wetter-"+row["symbol"])}if(typeof row["minTemp"]!=="undefined"&&typeof row["maxTemp"]!=="undefined"){$object.find(".temp").text(row["maxTemp"]+"°C / "+row["minTemp"]+"°C")}if(typeof row["name"]!=="undefined"){$object.find(".issue").text(row["name"])}$object.show(500)}}}}if(typeof data["epaper"]!=="undefined"){for(var i in data["epaper"]){var row=data["epaper"][i];var $object=$('[data-regionalise-epaper="'+i+'"]');if(typeof row==="object"){for(var key in row){if(i==="epaper-header"){$epaper=$('[data-regionalise-epaper="'+i+'"] [data-epaper-date]');$epaper.find("a").html('<img src="'+row[key]["image"]+'" />')}else{$epaper=$('[data-regionalise-epaper="'+i+'"] [data-epaper-date="'+key+'"]');$epaper.find("img").attr("src",row[key]["image"]).attr("alt",row[key]["title"]).attr("data-src",row[key]["image"]);$epaper.find("a").attr("href",row[key]["url"]).html(row[key]["title"])}}}if($object.hasClass("issue-loading--inprogress")){$object.removeClass("issue-loading--inprogress").addClass("issue-loading--finished").delay(1e3).queue(function(){$(this).removeClass("issue-loading").dequeue()})}}}if(typeof data["epaperBox"]!=="undefined"){for(var i in data["epaperBox"]){var row=data["epaperBox"][i];var $slider=$("#"+i);$slider.find("[data-epaper-index]").hide();if(typeof row==="object"){for(var key in row){$epaper=$slider.find('[data-epaper-index="'+key+'"]');$epaper.show().removeClass("epaper-hidden");$epaper.find("img").attr("src",row[key]["image"]).attr("alt",row[key]["title"]);$epaper.find("a").attr("href",row[key]["url"]).html(row[key]["title"]);$epaper.find(".date").html(row[key]["date"]);if(typeof row[key]["srcset"]!=="undefined"){var srcset=row[key]["srcset"];$epaper.find("img").attr("srcset",srcset)}else{$epaper.find("img").removeAttr("srcset")}}}if($slider.hasClass("issue-loading--inprogress")){$slider.removeClass("issue-loading--inprogress").addClass("issue-loading--finished").delay(1e3).queue(function(){$(this).removeClass("issue-loading").dequeue()})}}}if(typeof data["physicians"]!=="undefined"){for(var i in data["physicians"]){var row=data["physicians"][i]["output"];var $object=$('[data-regionalise-physicians="'+data["physicians"][i]["tpl"]+'"]');$object.replaceWith($(row));$object=$('[data-regionalise-template="'+data["physicians"][i]["tpl"]+'"]');
// if box has an overlay showing loading information, remove this overlay once the data is loaded
if($object.hasClass("issue-loading--inprogress")){$object.removeClass("issue-loading--inprogress").addClass("issue-loading--finished").delay(1e3).queue(function(){$(this).removeClass("issue-loading").dequeue()})}}}if(typeof data["onduty"]!=="undefined"){for(var i in data["onduty"]){var row=data["onduty"][i];var $onduty=$('[data-regionalise-onduty="'+i+'"]');if(typeof row==="object"){$onduty.html("");for(var key in row){$onduty=$('[data-regionalise-onduty="'+i+'"]');$onduty.append('<div class="on-duty-entry">'+'<div class="on-duty-entry__physician">'+row[key]["Arzt"]+"</div>"+'<div class="on-duty-entry__locations">'+row[key]["Orte"]+"</div>"+'<address class="icon on-duty-entry__address">'+'<a href="https://www.google.com/maps/place/'+row[key]["Adresse"]+'" class="icon-location">'+row[key]["Adresse"]+"</a>"+"</address>"+'<div class="icon-phone icon on-duty-entry__telephone">'+row[key]["Telefon"]+"</div>"+"</div>")}}if($onduty.hasClass("issue-loading--inprogress")){$onduty.removeClass("issue-loading--inprogress").addClass("issue-loading--finished").delay(1e3).queue(function(){$(this).removeClass("issue-loading").dequeue()})}}}if(typeof data["isActiveChannelLocalIssue"]!=="undefined"&&data["isActiveChannelLocalIssue"]==true){$("li[data-current-issue-abbreviation]").addClass("nav-item--active")}if(typeof LazyLoad!=="undefined"&&lazyLoadInstance){lazyLoadInstance.update()}self.loadContentXhr=null},error:function(jqXHR,textStatus,errorThrown){self.loadContentXhr=null},complete:function(jqXHR,textStatus){self.loadContentXhr=null;Geocoding.displayAutoRegHint()}})}else{$(".issue-loading--inprogress").each(function(){$(this).removeClass("issue-loading--inprogress").addClass("issue-loading--finished");$(this).removeClass("issue-loading").dequeue()});$(".issue-loading-inline--inprogress").each(function(){$(this).removeClass("issue-loading-inline--inprogress").addClass("issue-loading-inline--finished")})}};self.hasIssueCookie=function(){return $.cookie(self.options.cookieName)!==null}};var Regionalise;(function(){Regionalise=new frontend.Regionalise})();
/**
 * function as called on every page load, is now in the frontend._page.tpl to
 * differ from load without cookie and normal load
 */
/*
$(document).on(frontend.events.CONTENT_LOADED, function  () {
    Regionalise.loadContent();
});
*/var frontend=frontend||{};frontend.User=function(config){var self=this;self.sessionLoaded=false;self.loggedIn=false;self.blockedForComments=false;
/**
     * The default config.
     */self.defaults={cookieName:"NSESSID",issueCookieName:"localIssue",issueCookieDomain:".noen.at",sessionUpdateUrl:"https://www.noen.at/community/sessionupdate",issueUpdateUrl:"https://www.noen.at/community/changeLocalIssue"};self.options={};$.extend(self.options,self.defaults,config);
/**
     * Constructor;
     */
(function(){
// we could do stuff here
})();self.loadSessionXhr=null;self.updateLocalIssueXhr=null;self.loadSession=function(){if(self.hasSessionCookie()||self.hasUserCookie()){
// we just do session update if we have a PHPSESSID cookie
if(self.loadSessionXhr!==null||self.sessionLoaded){
// do nothing if session request is active or if we already loaded the session
return}self.loadSessionXhr=$.ajax({type:"POST",url:self.options.sessionUpdateUrl,dataType:"json",xhrFields:{withCredentials:true},success:function(data,textStatus,jqXHR){$(document).trigger(frontend.events.SESSION_LOADED,data);self.sessionLoaded=true;if(data&&data.loggedIn){self.loggedIn=true}if(data&&data.blockedForComments){self.blockedForComments=true}},error:function(jqXHR,textStatus,errorThrown){self.sessionLoaded=false;self.loggedIn=false},complete:function(jqXHR,textStatus){self.loadSessionXhr=null}})}else{$(document).trigger(frontend.events.SESSION_LOADED,{loggedin:false});self.sessionLoaded=true}};self.hasSessionCookie=function(){return $.cookie(self.options.cookieName)!==null};self.hasUserCookie=function(){return $.cookie("spunQ_User")!==null};self.updateLocalIssue=function(localIssue,redirectUrl){if($.cookie(self.options.issueCookieName)===localIssue){
// cookie does not change, to nothing
return null}$.cookie(self.options.issueCookieName,localIssue,{expires:365,domain:self.options.issueCookieDomain,path:"/"});if(!self.sessionLoaded&&self.loadSessionXhr===null){
// the issue is updated on session update anyway, so we dont have to do it
return null}
// now we are logged in, we have a different cookie, call ajax
if(self.updateLocalIssueXhr!==null){
// do nothing if a request is already running
return}self.updateLocalIssueXhr=$.ajax({type:"POST",url:self.options.issueUpdateUrl,dataType:"json",xhrFields:{withCredentials:true},success:function(data,textStatus,jqXHR){if(typeof redirectUrl!=="undefined"){window.location=redirectUrl}
// do nothing
},error:function(jqXHR,textStatus,errorThrown){},complete:function(jqXHR,textStatus){}})}};var User;(function(){User=new frontend.User({sessionUpdateUrl:"https://www.noen.at/community/sessionupdate"})})();$(document).on(frontend.events.HEADER_LOADED,function(){User.loadSession()});$(document).on(frontend.events.SESSION_LOADED,function(event,userData){if(userData.loggedIn){
// needed for update on login
if(!User.loggedIn){User.loggedIn=true;User.sessionLoaded=true}$(".user-login-link--comments").hide();
// Change visibility of clickdummy or form if user has logged in and is on a page where the user can post comments.
if($("#commentclickdummy").length>0){$("#commentformwrapper").css("display","block");$("#commentclickdummy").css("display","none")}if(userData.blockedForComments){User.blockedForComments=true;$("#commentformwrapper").hide();$(".answer-dummy").hide();$("#usercommentblocknote").show()}else if(User.loggedIn){User.blockedForComments=false;$("#commentformwrapper").show()}$(".user-cockpit").addClass("user-logged-in");$("body").addClass("user-logged-in");if(userData.externalEditor){$(".user-cockpit").addClass("user-is-external-editor")}
// push login state to GTM data layer
window.dataLayer=window.dataLayer||[];window.dataLayer.push({Login:"1"});$(".quizcontainer .loginNotice").addClass("hide");$(".questionnaireContainer").removeClass("hide");$(".questionnaireContainer").find(".submitButton").addClass("loggedIn");$(".questionnaireContainer").find(".submitButton").removeClass("loginNotice");$(".formbuildercontainer .loginNotice").addClass("hide");$(".formbuilderContainer").removeClass("hide");$(".formbuilderContainer").find(".submitButton").addClass("loggedIn");$(".formbuilderContainer").find(".submitButton").removeClass("loginNotice");
// move text entered before login to real text area
if($("#commentclickdummy textarea").length>0&&$("#commentclickdummy textarea").val().length>0){$("#commentformwrapper textarea").val($("#commentclickdummy textarea").val());$("#commentformwrapper form").trigger("submit")}
// check if user has up or down voted a comment before login and perform the voting
// process after the login
$(".comment-votes .comment-vote-up").each(function(i){if($(this).data("upvote-after-login")===1){cms.Comments.doUpVote($(this).data("comment-id"))}});$(".comment-votes .comment-vote-down").each(function(i){if($(this).data("downvote-after-login")===1){cms.Comments.doDownVote($(this).data("comment-id"))}});$(".user-control span.userFirstName").html(userData.firstName);$("#loginSuccess.user-control span.userName").html(userData.firstName+" "+userData.lastName);$("#loginbox #loginSuccess .section-separator h2").html("Angemeldet als "+userData.firstName+" "+userData.lastName);$(".box.apps .login .text").html("Profil");if(userData.dataUsageDisplay){setTimeout(function(){$("#user-confirm-privacy").fancybox({hideOnContentClick:false,hideOnOverlayClick:false,showCloseButton:false,enableEscapeButton:false,centerOnScroll:true}).click()},600)}}else{
// push login state to GTM data layer
window.dataLayer=window.dataLayer||[];window.dataLayer.push({Login:"0"});$(document).on(frontend.events.CONTENT_LOADED,function(){$("#abo-portal-login").removeClass("hide");$("#abo-portal-loading-content").addClass("hide")})}});"use strict";
// Version 1.0.0
window.loadGlossyShellLibrary=function(window,jQuery,glossyShell){glossyShell.bridge={
//////////////////////////////////////////////////////////////////////////
// Init
init:function(){var deferred=new jQuery.Deferred;if(this.isIOSAppWithBridge()){var _this=this;if(this.isWKWebView()){setTimeout(function(){deferred.resolve()},0)}else{if(window.WebViewJavascriptBridge){this.connectToIOSBridge(WebViewJavascriptBridge);setTimeout(function(){deferred.resolve()},0)}else{document.addEventListener("WebViewJavascriptBridgeReady",function(){_this.connectToIOSBridge(WebViewJavascriptBridge);deferred.resolve()},false)}}}else if(this.isAndroidAppWithBridge()){setTimeout(function(){deferred.resolve()},0)}else{setTimeout(function(){deferred.reject("Not running in GlossyShell App")},0)}return deferred.promise()},shouldHaveBridge:function(){if(this.isIOSAppWithBridge()||this.isAndroidAppWithBridge()){return true}return false},isAndroidAppWithBridge:function(){if(this.appVersion()>=500&&/GlossyShell/i.test(navigator.userAgent)){return true}return false},isIOSAppWithBridge:function(){if(this.appVersion()>=500&&/GlossyShell/i.test(navigator.userAgent)){return true}return false},isWKWebView:function(){var isWKWebView=false;if(window.webkit&&window.webkit.messageHandlers){isWKWebView=true}return isWKWebView},appVersion:function(){
// grab (GlossyShell/)(xxx.x.x)
var glossyShellFields=RegExp("( GlossyShell/)([^ ]+)").exec(navigator.userAgent);if(!glossyShellFields||glossyShellFields.length<3){return 0}return window.parseFloat(glossyShellFields[2])},
//////////////////////////////////////////////////////////////////////////
// iOS Bridge Helper
iosBridge:null,iosBridgeQueue:[],connectToIOSBridge:function(bridge){this.iosBridge=bridge;
// send all messages that have been queued
for(var i=0;i<this.iosBridgeQueue.length;i++){var q=this.iosBridgeQueue[i];this.iosBridge.callHandler(q["handlerName"],q["data"],q["callback"])}bridge.init(function(message,responseCallback){console.log("Received message: "+message);if(responseCallback){responseCallback("Right back atcha")}})},callIOSBridgeHandler:function(name,data,callback){if(this.isWKWebView()){window.webkit.messageHandlers.glossyShell.postMessage({handlerName:name,data:data});setTimeout(function(){callback("done")},0)}else{if(this.iosBridge){this.iosBridge.callHandler(name,data,callback)}else{this.iosBridgeQueue.push({handlerName:name,data:data,callback:callback})}}},
//////////////////////////////////////////////////////////////////////////
// OEWA
/**
     * @param {String} Path to be tracked
     * @returns {jQuery.promise} arg1 => true||false
     */
trackOEWA:function(path){var deferred=new jQuery.Deferred;if(this.isIOSAppWithBridge()){this.callIOSBridgeHandler("trackOEWA",path,function(value){deferred.resolve(value)})}else if(this.isAndroidAppWithBridge()){setTimeout(function(){deferred.resolve(window.glossyShellAndroidBridge.trackOEWA(path))},0)}else{setTimeout(function(){deferred.reject("Not running in GlossyShell App")},0)}return deferred.promise()},
//////////////////////////////////////////////////////////////////////////
// Test
ping:function(){var deferred=new jQuery.Deferred;if(this.isIOSAppWithBridge()){this.callIOSBridgeHandler("ping",null,function(value){deferred.resolve(value)})}else if(this.isAndroidAppWithBridge()){setTimeout(function(){deferred.resolve(window.glossyShellAndroidBridge.ping())},0)}else{setTimeout(function(){deferred.reject("Not running in GlossyShell App")},0)}return deferred.promise()}}};
/*
Jquery Iframe Auto Height Plugin
Version 1.2.5 (09.10.2013)
Author : Ilker Guller (http://ilkerguller.com)
Description: This plugin can get contents of iframe and set height of iframe automatically. Also it has cross-domain fix (*).
Details: http://github.com/Sly777/Iframe-Height-Jquery-Plugin
*/
(function($){var uuid=0;// Unique ID counter for iframes with no ID
var iframeOptions={resizeMaxTry:4,// how many try that find true values
resizeWaitTime:50,// wait time before next try
minimumHeight:200,// minimum height for iframe
defaultHeight:3e3,// default height for iframe
heightOffset:0,// default top offset for iframe
exceptPages:"",// Pages that doesnt need auto height
debugMode:false,// Debug mode
visibilitybeforeload:false,// If you change this to true, iframe will be invisible when every iframe load
blockCrossDomain:false,// Set true if you dont want use cross domain fix
externalHeightName:"bodyHeight",// Height data name that comes from postMessage (CDI) and gives height value
onMessageFunctionName:"getHeight",// Function name that plugin calls this to get data from external source
domainName:"*",// Set this if you want to get data from specific domain
watcher:false,// Set true if you want to watch iframe document changes automatic
watcherTime:400};$.iframeHeight=function(el,options){var base=this;$.iframeHeight.resizeTimeout=null;$.iframeHeight.resizeCount=0;base.$el=$(el);base.el=el;base.$el.before("<div id='iframeHeight-Container-"+uuid+"' style='padding: 0; margin: 0; border: none; background-color: transparent;'></div>");base.$el.appendTo("#iframeHeight-Container-"+uuid);base.$container=$("#iframeHeight-Container-"+uuid);base.$el.data("iframeHeight",base);base.watcher=null;base.debug={FirstTime:true,Init:function(){if(!("console"in window))console={};"log info warn error dir clear".replace(/\w+/g,function(f){if(!(f in console))console[f]=console.log||new Function})},Log:function(message){if(this.FirstTime&&this.FirstTime===true){this.Init();this.FirstTime=false}if(base.options.debugMode&&base.options.debugMode===true&&console&&(message!==null||message!=="")){console["log"]("Iframe Plugin : "+message)}},GetBrowserInfo:function(pub){// this function is from Jquery.Migrate with IE6 & Browser Null Fix
var matched,browserObj;var uaMatch=function(ua){ua=ua.toLowerCase();if(/*@cc_on/*@if(@_jscript_version<=5.6)1@else@*/0/*@end@*/){ua="msie 6.0"}var match=/(chrome)[ \/]([\w.]+)/.exec(ua)||/(webkit)[ \/]([\w.]+)/.exec(ua)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua)||/(msie) ([\w.]+)/.exec(ua)||ua.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua)||[];return{browserObj:match[1]||"",version:match[2]||"0"}};matched=uaMatch(navigator.userAgent);browserObj={chrome:false,safari:false,mozilla:false,msie:false,webkit:false};if(matched.browserObj){browserObj[matched.browserObj]=true;browserObj.version=matched.version}if(browserObj.chrome){browserObj.webkit=true}else if(browserObj.webkit){browserObj.safari=true}pub=browserObj;return pub}(this.GetBrowserInfo||{})};var isThisCDI=function(){try{var contentHtml;if(base.debug.GetBrowserInfo.msie&&base.debug.GetBrowserInfo.version=="7.0"){contentHtml=base.$el.get(0).contentWindow.location.href}else{contentHtml=base.$el.get(0).contentDocument.location.href}base.debug.Log("This page is non-Cross Domain - "+contentHtml);return false}catch(err){base.debug.Log("This page is Cross Domain");return true}};base.resetIframe=function(){if(base.options.visibilitybeforeload&&!(base.debug.GetBrowserInfo.msie&&base.debug.GetBrowserInfo.version=="7.0"))base.$el.css("visibility","hidden");base.debug.Log("Old Height is "+base.$el.height()+"px");base.$el.css("height","").removeAttr("height");base.debug.Log("Reset iframe");base.debug.Log("Height is "+base.$el.height()+"px after reset")};base.resizeFromOutside=function(event){if(base.options.blockCrossDomain){base.debug.Log("Blocked cross domain fix");return false}if(typeof event==="undefined")return false;if(typeof event.data=="string"){if(event.data=="reset"){base.$el.css("height","").removeAttr("height")}else{if(!/^ifh*/.test(event.data))return false;if(typeof parseInt(event.data.substring(3))!="number")return false;var frameHeightPx=parseInt(event.data.substring(3))+parseInt(base.options.heightOffset);base.resetIframe();base.setIframeHeight(frameHeightPx)}}else{return false}return true};base.checkMessageEvent=function(){// it works on IE8+, Chrome, Firefox3+, Opera and Safari
if(base.options.blockCrossDomain||base.debug.GetBrowserInfo.msie&&base.debug.GetBrowserInfo.version=="7.0"){base.debug.Log("Blocked cross domain fix");return false}base.resetIframe();if(base.options.visibilitybeforeload&&!(base.debug.GetBrowserInfo.msie&&base.debug.GetBrowserInfo.version=="7.0"))base.$el.css("visibility","visible");if(window.addEventListener){window.addEventListener("message",base.resizeFromOutside,false)}else if(window.attachEvent){window.attachEvent("onmessage",base.resizeFromOutside)}if(!base.$el.id){base.$el.id="iframe-id-"+ ++uuid}var frame=document.getElementById(base.$el.attr("id"));var message=base.options.onMessageFunctionName;if(frame.contentWindow.postMessage){frame.contentWindow.postMessage(message,"*")}else{base.debug.Log("Your browser does not support the postMessage method!");return false}base.debug.Log("Cross Domain Iframe started");return true};var tryFixIframe=function(){if($.iframeHeight.resizeCount<=base.options.resizeMaxTry){$.iframeHeight.resizeCount++;$.iframeHeight.resizeTimeout=setTimeout($.iframeHeight.resizeIframe,base.options.resizeWaitTime);base.debug.Log($.iframeHeight.resizeCount+" time(s) tried")}else{clearTimeout($.iframeHeight.resizeTimeout);$.iframeHeight.resizeCount=0;base.debug.Log("set default height for iframe");base.setIframeHeight(base.options.defaultHeight+base.options.heightOffset)}};base.sendInfotoTop=function(){if(top.length>0&&typeof JSON!="undefined"){var data={};data[base.options.externalHeightName].value=$(document).height();var domain="*";data=JSON.stringify(data);top.postMessage(data,domain);base.debug.Log("sent info to top page");return false}return true};base.setIframeHeight=function(_height){base.$el.height(_height).css("height",_height);if(base.$el.data("iframeheight")!=_height)base.$container.height(_height).css("height",_height);if(base.options.visibilitybeforeload&&!(base.debug.GetBrowserInfo.msie&&base.debug.GetBrowserInfo.version=="7.0"))base.$el.css("visibility","visible");base.debug.Log("Now iframe height is "+_height+"px");base.$el.data("iframeheight",_height)};$.iframeHeight.resizeIframe=function(){base.resetIframe();if(isThisCDI()){base.$el.height(base.options.defaultHeight+base.options.heightOffset).css("height",base.options.defaultHeight+base.options.heightOffset);if(base.options.visibilitybeforeload&&!(base.debug.GetBrowserInfo.msie&&base.debug.GetBrowserInfo.version=="7.0"))base.$el.css("visibility","visible");base.checkMessageEvent()}else{if(base.$el.css("height")===base.options.minimumHeight+"px"){base.resetIframe()}if(base.$el.get(0).contentWindow.document.body!==null){base.debug.Log("This page has body info");var _pageHeight=$(base.$el.get(0).contentWindow.document).height();var _pageName=base.$el.get(0).contentWindow.document.location.pathname.substring(base.$el.get(0).contentWindow.document.location.pathname.lastIndexOf("/")+1).toLowerCase();base.debug.Log("page height : "+_pageHeight+"px || page name : "+_pageName);if(_pageHeight<=base.options.minimumHeight&&base.options.exceptPages.indexOf(_pageName)==-1){tryFixIframe()}else if(_pageHeight>base.options.minimumHeight&&base.options.exceptPages.indexOf(_pageName)==-1){base.setIframeHeight(_pageHeight+base.options.heightOffset)}}else{base.debug.Log("This page has not body info");tryFixIframe()}}};this.$el.bind("updateIframe",function(){$.iframeHeight.resizeIframe();base.debug.Log("Updated Iframe Manually")});this.$el.bind("killWatcher",function(){window.clearInterval(base.watcher);base.debug.Log("Killed Watcher")});base.init=function(){base.options=$.extend({},$.iframeHeight.defaultOptions,options);if(base.options.watcher==true)base.options.blockCrossDomain=true;base.debug.Log(base.options);
//noinspection JSValidateTypes
if(base.$el.get(0).tagName===undefined||base.$el.get(0).tagName.toLowerCase()!=="iframe"){base.debug.Log("This element is not iframe!");return false}$.iframeHeight.resizeIframe();base.$el.load(function(){$.iframeHeight.resizeIframe()});if(base.options.watcher){base.watcher=setInterval(function(){$.iframeHeight.resizeIframe();base.debug.Log("Checked Iframe")},base.options.watcherTime)}return true};base.init()};$.iframeHeight.defaultOptions=iframeOptions;$.fn.iframeHeight=function(options){return this.each(function(){new $.iframeHeight(this,options)})};$.iframeHeightExternal=function(){if(arguments.length===1){if($.isPlainObject(arguments[0])){iframeOptions=$.extend({},$.iframeHeight.defaultOptions,arguments[0])}}if(window.addEventListener){window.addEventListener("message",OnMessage,false)}else if(window.attachEvent){window.attachEvent("onmessage",OnMessage)}function OnMessage(event){var _domain;if("domain"in event){_domain=event.domain}if("origin"in event){_domain=event.origin}if(iframeOptions.domainName!=="*"){if(_domain!==iframeOptions.domainName){$.iframeHeight.debug.Log("It's not same domain. Blocked!");return}}if(event.data==iframeOptions.onMessageFunctionName){var message="ifh"+$(document).height();event.source.postMessage(message,event.origin)}}return{update:function(){this.reset();window.__domainname=iframeOptions.domainName;setTimeout(function(){var message="ifh"+$(document).height();parent.postMessage(message,window.__domainname)},90)},reset:function(){parent.postMessage("reset",iframeOptions.domainName)}}}})(jQuery);
/*
 * Copyright (C) 2012 PrimeBox (info@primebox.co.uk)
 *
 * This work is licensed under the Creative Commons
 * Attribution 3.0 Unported License. To view a copy
 * of this license, visit
 * http://creativecommons.org/licenses/by/3.0/.
 *
 * Documentation available at:
 * http://www.primebox.co.uk/projects/cookie-bar/
 *
 * When using this software you use it at your own risk. We hold
 * no responsibility for any damage caused by using this plugin
 * or the documentation provided.
 */
(function($){$.cookieBar=function(options,val){if(options=="cookies"){var doReturn="cookies"}else if(options=="set"){var doReturn="set"}else{var doReturn=false}var defaults={message:"We use cookies to track usage and preferences.",//Message displayed on bar
acceptButton:true,//Set to true to show accept/enable button
acceptText:"I Understand",//Text on accept/enable button
acceptFunction:function(cookieValue){if(cookieValue!="enabled"&&cookieValue!="accepted")window.location=window.location.href},//Function to run after accept
declineButton:false,//Set to true to show decline/disable button
declineText:"Disable Cookies",//Text on decline/disable button
declineFunction:function(cookieValue){if(cookieValue=="enabled"||cookieValue=="accepted")window.location=window.location.href},//Function to run after decline
policyButton:false,//Set to true to show Privacy Policy button
policyText:"Privacy Policy",//Text on Privacy Policy button
policyURL:"/privacy-policy/",//URL of Privacy Policy
autoEnable:true,//Set to true for cookies to be accepted automatically. Banner still shows
acceptOnContinue:false,//Set to true to accept cookies when visitor moves to another page
acceptOnScroll:false,//Set to true to accept cookies when visitor scrolls X pixels up or down
acceptAnyClick:false,//Set to true to accept cookies when visitor clicks anywhere on the page
expireDays:365,//Number of days for cookieBar cookie to be stored for
renewOnVisit:false,//Renew the cookie upon revisit to website
forceShow:false,//Force cookieBar to show regardless of user cookie preference
effect:"slide",//Options: slide, fade, hide
element:"body",//Element to append/prepend cookieBar to. Remember "." for class or "#" for id.
append:false,//Set to true for cookieBar HTML to be placed at base of website. Actual position may change according to CSS
fixed:false,//Set to true to add the class "fixed" to the cookie bar. Default CSS should fix the position
bottom:false,//Force CSS when fixed, so bar appears at bottom of website
zindex:"",//Can be set in CSS, although some may prefer to set here
domain:String(window.location.hostname),//Location of privacy policy
referrer:String(document.referrer)};var options=$.extend(defaults,options);
//Sets expiration date for cookie
var expireDate=new Date;expireDate.setTime(expireDate.getTime()+options.expireDays*864e5);expireDate=expireDate.toGMTString();var cookieEntry="cb-enabled={value}; expires="+expireDate+"; path=/";
//Retrieves current cookie preference
var i,cookieValue="",aCookie,aCookies=document.cookie.split("; ");for(i=0;i<aCookies.length;i++){aCookie=aCookies[i].split("=");if(aCookie[0]=="cb-enabled"){cookieValue=aCookie[1]}}
//Sets up default cookie preference if not already set
if(cookieValue==""&&doReturn!="cookies"&&options.autoEnable){cookieValue="enabled";document.cookie=cookieEntry.replace("{value}","enabled")}else if((cookieValue=="accepted"||cookieValue=="declined")&&doReturn!="cookies"&&options.renewOnVisit){document.cookie=cookieEntry.replace("{value}",cookieValue)}if(options.acceptOnContinue){if(options.referrer.indexOf(options.domain)>=0&&String(window.location.href).indexOf(options.policyURL)==-1&&doReturn!="cookies"&&doReturn!="set"&&cookieValue!="accepted"&&cookieValue!="declined"){doReturn="set";val="accepted"}}if(doReturn=="cookies"){
//Returns true if cookies are enabled, false otherwise
if(cookieValue=="enabled"||cookieValue=="accepted"){return true}else{return false}}else if(doReturn=="set"&&(val=="accepted"||val=="declined")){
//Sets value of cookie to 'accepted' or 'declined'
document.cookie=cookieEntry.replace("{value}",val);if(val=="accepted"){return true}else{return false}}else{
//Sets up enable/accept button if required
var message=options.message.replace("{policy_url}",options.policyURL);if(options.acceptButton){var acceptButton='<a href="" class="cb-enable">'+options.acceptText+"</a>"}else{var acceptButton=""}
//Sets up disable/decline button if required
if(options.declineButton){var declineButton='<a href="" class="cb-disable">'+options.declineText+"</a>"}else{var declineButton=""}
//Sets up privacy policy button if required
if(options.policyButton){var policyButton='<a href="'+options.policyURL+'" class="cb-policy">'+options.policyText+"</a>"}else{var policyButton=""}
//Whether to add "fixed" class to cookie bar
if(options.fixed){if(options.bottom){var fixed=' class="fixed bottom"'}else{var fixed=' class="fixed"'}}else{var fixed=""}if(options.zindex!=""){var zindex=' style="z-index:'+options.zindex+';"'}else{var zindex=""}
//Displays the cookie bar if arguments met
if(options.forceShow||cookieValue=="enabled"||cookieValue==""){if(options.append){$(options.element).append('<div id="cookie-bar"'+fixed+zindex+"><p>"+message+acceptButton+declineButton+policyButton+"</p></div>")}else{$(options.element).prepend('<div id="cookie-bar"'+fixed+zindex+"><p>"+message+acceptButton+declineButton+policyButton+"</p></div>")}}var removeBar=function(func){if(options.acceptOnScroll)$(document).off("scroll");if(typeof func==="function")func(cookieValue);if(options.effect=="slide"){$("#cookie-bar").slideUp(300,function(){$("#cookie-bar").remove()})}else if(options.effect=="fade"){$("#cookie-bar").fadeOut(300,function(){$("#cookie-bar").remove()})}else{$("#cookie-bar").hide(0,function(){$("#cookie-bar").remove()})}$(document).unbind("click",anyClick)};var cookieAccept=function(){document.cookie=cookieEntry.replace("{value}","accepted");removeBar(options.acceptFunction)};var cookieDecline=function(){var deleteDate=new Date;deleteDate.setTime(deleteDate.getTime()-864e6);deleteDate=deleteDate.toGMTString();aCookies=document.cookie.split("; ");for(i=0;i<aCookies.length;i++){aCookie=aCookies[i].split("=");if(aCookie[0].indexOf("_")>=0){document.cookie=aCookie[0]+"=0; expires="+deleteDate+"; domain="+options.domain.replace("www","")+"; path=/"}else{document.cookie=aCookie[0]+"=0; expires="+deleteDate+"; path=/"}}document.cookie=cookieEntry.replace("{value}","declined");removeBar(options.declineFunction)};var anyClick=function(e){if(!$(e.target).hasClass("cb-policy"))cookieAccept()};$("#cookie-bar .cb-enable").click(function(){cookieAccept();return false});$("#cookie-bar .cb-disable").click(function(){cookieDecline();return false});if(options.acceptOnScroll){var scrollStart=$(document).scrollTop(),scrollNew,scrollDiff;$(document).on("scroll",function(){scrollNew=$(document).scrollTop();if(scrollNew>scrollStart){scrollDiff=scrollNew-scrollStart}else{scrollDiff=scrollStart-scrollNew}if(scrollDiff>=Math.round(options.acceptOnScroll))cookieAccept()})}if(options.acceptAnyClick){$(document).bind("click",anyClick)}}}})(jQuery);
/*!
 * jScrollPane - v2.0.22 - 2015-04-25
 * http://jscrollpane.kelvinluck.com/
 *
 * Copyright (c) 2014 Kelvin Luck
 * Dual licensed under the MIT or GPL licenses.
 */
// Script: jScrollPane - cross browser customisable scrollbars
//
// *Version: 2.0.22, Last updated: 2015-04-25*
//
// Project Home - http://jscrollpane.kelvinluck.com/
// GitHub       - http://github.com/vitch/jScrollPane
// Source       - http://github.com/vitch/jScrollPane/raw/master/script/jquery.jscrollpane.js
// (Minified)   - http://github.com/vitch/jScrollPane/raw/master/script/jquery.jscrollpane.min.js
//
// About: License
//
// Copyright (c) 2014 Kelvin Luck
// Dual licensed under the MIT or GPL Version 2 licenses.
// http://jscrollpane.kelvinluck.com/MIT-LICENSE.txt
// http://jscrollpane.kelvinluck.com/GPL-LICENSE.txt
//
// About: Examples
//
// All examples and demos are available through the jScrollPane example site at:
// http://jscrollpane.kelvinluck.com/
//
// About: Support and Testing
//
// This plugin is tested on the browsers below and has been found to work reliably on them. If you run
// into a problem on one of the supported browsers then please visit the support section on the jScrollPane
// website (http://jscrollpane.kelvinluck.com/) for more information on getting support. You are also
// welcome to fork the project on GitHub if you can contribute a fix for a given issue.
//
// jQuery Versions - tested in 1.4.2+ - reported to work in 1.3.x
// Browsers Tested - Firefox 3.6.8, Safari 5, Opera 10.6, Chrome 5.0, IE 6, 7, 8
//
// About: Release History
//
// 2.0.22 - (2015-04-25) Resolve a memory leak due to an event handler that isn't cleaned up in destroy (thanks @timjnh)
// 2.0.21 - (2015-02-24) Simplify UMD pattern: fixes browserify when loading jQuery outside of bundle
// 2.0.20 - (2014-10-23) Adds AMD support (thanks @carlosrberto) and support for overflow-x/overflow-y (thanks @darimpulso)
// 2.0.19 - (2013-11-16) Changes for more reliable scroll amount with latest mousewheel plugin (thanks @brandonaaron)
// 2.0.18 - (2013-10-23) Fix for issue with gutters and scrollToElement (thanks @Dubiy)
// 2.0.17 - (2013-08-17) Working correctly when box-sizing is set to border-box (thanks @pieht)
// 2.0.16 - (2013-07-30) Resetting left position when scroll is removed. Fixes #189
// 2.0.15 - (2013-07-29) Fixed issue with scrollToElement where the destX and destY are undefined.
// 2.0.14 - (2013-05-01) Updated to most recent mouse wheel plugin (see #106) and related changes for sensible scroll speed
// 2.0.13 - (2013-05-01) Switched to semver compatible version name
// 2.0.0beta12 - (2012-09-27) fix for jQuery 1.8+
// 2.0.0beta11 - (2012-05-14)
// 2.0.0beta10 - (2011-04-17) cleaner required size calculation, improved keyboard support, stickToBottom/Left, other small fixes
// 2.0.0beta9 - (2011-01-31) new API methods, bug fixes and correct keyboard support for FF/OSX
// 2.0.0beta8 - (2011-01-29) touchscreen support, improved keyboard support
// 2.0.0beta7 - (2011-01-23) scroll speed consistent (thanks Aivo Paas)
// 2.0.0beta6 - (2010-12-07) scrollToElement horizontal support
// 2.0.0beta5 - (2010-10-18) jQuery 1.4.3 support, various bug fixes
// 2.0.0beta4 - (2010-09-17) clickOnTrack support, bug fixes
// 2.0.0beta3 - (2010-08-27) Horizontal mousewheel, mwheelIntent, keyboard support, bug fixes
// 2.0.0beta2 - (2010-08-21) Bug fixes
// 2.0.0beta1 - (2010-08-17) Rewrite to follow modern best practices and enable horizontal scrolling, initially hidden
//							 elements and dynamically sized elements.
// 1.x - (2006-12-31 - 2010-07-31) Initial version, hosted at googlecode, deprecated
(function(factory){if(typeof define==="function"&&define.amd){
// AMD. Register as an anonymous module.
define(["jquery"],factory)}else if(typeof exports==="object"){
// Node/CommonJS style for Browserify
module.exports=factory(require("jquery"))}else{
// Browser globals
factory(jQuery)}})(function($){$.fn.jScrollPane=function(settings){
// JScrollPane "class" - public methods are available through $('selector').data('jsp')
function JScrollPane(elem,s){var settings,jsp=this,pane,paneWidth,paneHeight,container,contentWidth,contentHeight,percentInViewH,percentInViewV,isScrollableV,isScrollableH,verticalDrag,dragMaxY,verticalDragPosition,horizontalDrag,dragMaxX,horizontalDragPosition,verticalBar,verticalTrack,scrollbarWidth,verticalTrackHeight,verticalDragHeight,arrowUp,arrowDown,horizontalBar,horizontalTrack,horizontalTrackWidth,horizontalDragWidth,arrowLeft,arrowRight,reinitialiseInterval,originalPadding,originalPaddingTotalWidth,previousContentWidth,wasAtTop=true,wasAtLeft=true,wasAtBottom=false,wasAtRight=false,originalElement=elem.clone(false,false).empty(),mwEvent=$.fn.mwheelIntent?"mwheelIntent.jsp":"mousewheel.jsp";if(elem.css("box-sizing")==="border-box"){originalPadding=0;originalPaddingTotalWidth=0}else{originalPadding=elem.css("paddingTop")+" "+elem.css("paddingRight")+" "+elem.css("paddingBottom")+" "+elem.css("paddingLeft");originalPaddingTotalWidth=(parseInt(elem.css("paddingLeft"),10)||0)+(parseInt(elem.css("paddingRight"),10)||0)}function initialise(s){var/*firstChild, lastChild, */isMaintainingPositon,lastContentX,lastContentY,hasContainingSpaceChanged,originalScrollTop,originalScrollLeft,maintainAtBottom=false,maintainAtRight=false;settings=s;if(pane===undefined){originalScrollTop=elem.scrollTop();originalScrollLeft=elem.scrollLeft();elem.css({overflow:"hidden",padding:0});
// TODO: Deal with where width/ height is 0 as it probably means the element is hidden and we should
// come back to it later and check once it is unhidden...
paneWidth=elem.innerWidth()+originalPaddingTotalWidth;paneHeight=elem.innerHeight();elem.width(paneWidth);pane=$('<div class="jspPane" />').css("padding",originalPadding).append(elem.children());container=$('<div class="jspContainer" />').css({width:paneWidth+"px",height:paneHeight+"px"}).append(pane).appendTo(elem);
/*
                     // Move any margins from the first and last children up to the container so they can still
                     // collapse with neighbouring elements as they would before jScrollPane
                     firstChild = pane.find(':first-child');
                     lastChild = pane.find(':last-child');
                     elem.css(
                     {
                     'margin-top': firstChild.css('margin-top'),
                     'margin-bottom': lastChild.css('margin-bottom')
                     }
                     );
                     firstChild.css('margin-top', 0);
                     lastChild.css('margin-bottom', 0);
                     */}else{elem.css("width","");maintainAtBottom=settings.stickToBottom&&isCloseToBottom();maintainAtRight=settings.stickToRight&&isCloseToRight();hasContainingSpaceChanged=elem.innerWidth()+originalPaddingTotalWidth!=paneWidth||elem.outerHeight()!=paneHeight;if(hasContainingSpaceChanged){paneWidth=elem.innerWidth()+originalPaddingTotalWidth;paneHeight=elem.innerHeight();container.css({width:paneWidth+"px",height:paneHeight+"px"})}
// If nothing changed since last check...
if(!hasContainingSpaceChanged&&previousContentWidth==contentWidth&&pane.outerHeight()==contentHeight){elem.width(paneWidth);return}previousContentWidth=contentWidth;pane.css("width","");elem.width(paneWidth);container.find(">.jspVerticalBar,>.jspHorizontalBar").remove().end()}pane.css("overflow","auto");if(s.contentWidth){contentWidth=s.contentWidth}else{contentWidth=pane[0].scrollWidth}contentHeight=pane[0].scrollHeight;pane.css("overflow","");percentInViewH=contentWidth/paneWidth;percentInViewV=contentHeight/paneHeight;isScrollableV=percentInViewV>1;isScrollableH=percentInViewH>1;
//console.log(paneWidth, paneHeight, contentWidth, contentHeight, percentInViewH, percentInViewV, isScrollableH, isScrollableV);
if(!(isScrollableH||isScrollableV)){elem.removeClass("jspScrollable");pane.css({top:0,left:0,width:container.width()-originalPaddingTotalWidth});removeMousewheel();removeFocusHandler();removeKeyboardNav();removeClickOnTrack()}else{elem.addClass("jspScrollable");isMaintainingPositon=settings.maintainPosition&&(verticalDragPosition||horizontalDragPosition);if(isMaintainingPositon){lastContentX=contentPositionX();lastContentY=contentPositionY()}initialiseVerticalScroll();initialiseHorizontalScroll();resizeScrollbars();if(isMaintainingPositon){scrollToX(maintainAtRight?contentWidth-paneWidth:lastContentX,false);scrollToY(maintainAtBottom?contentHeight-paneHeight:lastContentY,false)}initFocusHandler();initMousewheel();initTouch();if(settings.enableKeyboardNavigation){initKeyboardNav()}if(settings.clickOnTrack){initClickOnTrack()}observeHash();if(settings.hijackInternalLinks){hijackInternalLinks()}}if(settings.autoReinitialise&&!reinitialiseInterval){reinitialiseInterval=setInterval(function(){initialise(settings)},settings.autoReinitialiseDelay)}else if(!settings.autoReinitialise&&reinitialiseInterval){clearInterval(reinitialiseInterval)}originalScrollTop&&elem.scrollTop(0)&&scrollToY(originalScrollTop,false);originalScrollLeft&&elem.scrollLeft(0)&&scrollToX(originalScrollLeft,false);elem.trigger("jsp-initialised",[isScrollableH||isScrollableV])}function initialiseVerticalScroll(){if(isScrollableV){container.append($('<div class="jspVerticalBar" />').append($('<div class="jspCap jspCapTop" />'),$('<div class="jspTrack" />').append($('<div class="jspDrag" />').append($('<div class="jspDragTop" />'),$('<div class="jspDragBottom" />'))),$('<div class="jspCap jspCapBottom" />')));verticalBar=container.find(">.jspVerticalBar");verticalTrack=verticalBar.find(">.jspTrack");verticalDrag=verticalTrack.find(">.jspDrag");if(settings.showArrows){arrowUp=$('<a class="jspArrow jspArrowUp" />').bind("mousedown.jsp",getArrowScroll(0,-1)).bind("click.jsp",nil);arrowDown=$('<a class="jspArrow jspArrowDown" />').bind("mousedown.jsp",getArrowScroll(0,1)).bind("click.jsp",nil);if(settings.arrowScrollOnHover){arrowUp.bind("mouseover.jsp",getArrowScroll(0,-1,arrowUp));arrowDown.bind("mouseover.jsp",getArrowScroll(0,1,arrowDown))}appendArrows(verticalTrack,settings.verticalArrowPositions,arrowUp,arrowDown)}verticalTrackHeight=paneHeight;container.find(">.jspVerticalBar>.jspCap:visible,>.jspVerticalBar>.jspArrow").each(function(){verticalTrackHeight-=$(this).outerHeight()});verticalDrag.hover(function(){verticalDrag.addClass("jspHover")},function(){verticalDrag.removeClass("jspHover")}).bind("mousedown.jsp",function(e){
// Stop IE from allowing text selection
$("html").bind("dragstart.jsp selectstart.jsp",nil);verticalDrag.addClass("jspActive");var startY=e.pageY-verticalDrag.position().top;$("html").bind("mousemove.jsp",function(e){positionDragY(e.pageY-startY,false)}).bind("mouseup.jsp mouseleave.jsp",cancelDrag);return false});sizeVerticalScrollbar()}}function sizeVerticalScrollbar(){verticalTrack.height(verticalTrackHeight+"px");verticalDragPosition=0;scrollbarWidth=settings.verticalGutter+verticalTrack.outerWidth();
// Make the pane thinner to allow for the vertical scrollbar
pane.width(paneWidth-scrollbarWidth-originalPaddingTotalWidth);
// Add margin to the left of the pane if scrollbars are on that side (to position
// the scrollbar on the left or right set it's left or right property in CSS)
try{if(verticalBar.position().left===0){pane.css("margin-left",scrollbarWidth+"px")}}catch(err){}}function initialiseHorizontalScroll(){if(isScrollableH){container.append($('<div class="jspHorizontalBar" />').append($('<div class="jspCap jspCapLeft" />'),$('<div class="jspTrack" />').append($('<div class="jspDrag" />').append($('<div class="jspDragLeft" />'),$('<div class="jspDragRight" />'))),$('<div class="jspCap jspCapRight" />')));horizontalBar=container.find(">.jspHorizontalBar");horizontalTrack=horizontalBar.find(">.jspTrack");horizontalDrag=horizontalTrack.find(">.jspDrag");if(settings.showArrows){arrowLeft=$('<a class="jspArrow jspArrowLeft" />').bind("mousedown.jsp",getArrowScroll(-1,0)).bind("click.jsp",nil);arrowRight=$('<a class="jspArrow jspArrowRight" />').bind("mousedown.jsp",getArrowScroll(1,0)).bind("click.jsp",nil);if(settings.arrowScrollOnHover){arrowLeft.bind("mouseover.jsp",getArrowScroll(-1,0,arrowLeft));arrowRight.bind("mouseover.jsp",getArrowScroll(1,0,arrowRight))}appendArrows(horizontalTrack,settings.horizontalArrowPositions,arrowLeft,arrowRight)}horizontalDrag.hover(function(){horizontalDrag.addClass("jspHover")},function(){horizontalDrag.removeClass("jspHover")}).bind("mousedown.jsp",function(e){
// Stop IE from allowing text selection
$("html").bind("dragstart.jsp selectstart.jsp",nil);horizontalDrag.addClass("jspActive");var startX=e.pageX-horizontalDrag.position().left;$("html").bind("mousemove.jsp",function(e){positionDragX(e.pageX-startX,false)}).bind("mouseup.jsp mouseleave.jsp",cancelDrag);return false});horizontalTrackWidth=container.innerWidth();sizeHorizontalScrollbar()}}function sizeHorizontalScrollbar(){container.find(">.jspHorizontalBar>.jspCap:visible,>.jspHorizontalBar>.jspArrow").each(function(){horizontalTrackWidth-=$(this).outerWidth()});horizontalTrack.width(horizontalTrackWidth+"px");horizontalDragPosition=0}function resizeScrollbars(){if(isScrollableH&&isScrollableV){var horizontalTrackHeight=horizontalTrack.outerHeight(),verticalTrackWidth=verticalTrack.outerWidth();verticalTrackHeight-=horizontalTrackHeight;$(horizontalBar).find(">.jspCap:visible,>.jspArrow").each(function(){horizontalTrackWidth+=$(this).outerWidth()});horizontalTrackWidth-=verticalTrackWidth;paneHeight-=verticalTrackWidth;paneWidth-=horizontalTrackHeight;horizontalTrack.parent().append($('<div class="jspCorner" />').css("width",horizontalTrackHeight+"px"));sizeVerticalScrollbar();sizeHorizontalScrollbar()}
// reflow content
if(isScrollableH){pane.width(container.outerWidth()-originalPaddingTotalWidth+"px")}contentHeight=pane.outerHeight();percentInViewV=contentHeight/paneHeight;if(isScrollableH){horizontalDragWidth=Math.ceil(1/percentInViewH*horizontalTrackWidth);if(horizontalDragWidth>settings.horizontalDragMaxWidth){horizontalDragWidth=settings.horizontalDragMaxWidth}else if(horizontalDragWidth<settings.horizontalDragMinWidth){horizontalDragWidth=settings.horizontalDragMinWidth}horizontalDrag.width(horizontalDragWidth+"px");dragMaxX=horizontalTrackWidth-horizontalDragWidth;_positionDragX(horizontalDragPosition);// To update the state for the arrow buttons
}if(isScrollableV){verticalDragHeight=Math.ceil(1/percentInViewV*verticalTrackHeight);if(verticalDragHeight>settings.verticalDragMaxHeight){verticalDragHeight=settings.verticalDragMaxHeight}else if(verticalDragHeight<settings.verticalDragMinHeight){verticalDragHeight=settings.verticalDragMinHeight}verticalDrag.height(verticalDragHeight+"px");dragMaxY=verticalTrackHeight-verticalDragHeight;_positionDragY(verticalDragPosition);// To update the state for the arrow buttons
}}function appendArrows(ele,p,a1,a2){var p1="before",p2="after",aTemp;
// Sniff for mac... Is there a better way to determine whether the arrows would naturally appear
// at the top or the bottom of the bar?
if(p=="os"){p=/Mac/.test(navigator.platform)?"after":"split"}if(p==p1){p2=p}else if(p==p2){p1=p;aTemp=a1;a1=a2;a2=aTemp}ele[p1](a1)[p2](a2)}function getArrowScroll(dirX,dirY,ele){return function(){arrowScroll(dirX,dirY,this,ele);this.blur();return false}}function arrowScroll(dirX,dirY,arrow,ele){arrow=$(arrow).addClass("jspActive");var eve,scrollTimeout,isFirst=true,doScroll=function(){if(dirX!==0){jsp.scrollByX(dirX*settings.arrowButtonSpeed)}if(dirY!==0){jsp.scrollByY(dirY*settings.arrowButtonSpeed)}scrollTimeout=setTimeout(doScroll,isFirst?settings.initialDelay:settings.arrowRepeatFreq);isFirst=false};doScroll();eve=ele?"mouseout.jsp":"mouseup.jsp";ele=ele||$("html");ele.bind(eve,function(){arrow.removeClass("jspActive");scrollTimeout&&clearTimeout(scrollTimeout);scrollTimeout=null;ele.unbind(eve)})}function initClickOnTrack(){removeClickOnTrack();if(isScrollableV){verticalTrack.bind("mousedown.jsp",function(e){if(e.originalTarget===undefined||e.originalTarget==e.currentTarget){var clickedTrack=$(this),offset=clickedTrack.offset(),direction=e.pageY-offset.top-verticalDragPosition,scrollTimeout,isFirst=true,doScroll=function(){var offset=clickedTrack.offset(),pos=e.pageY-offset.top-verticalDragHeight/2,contentDragY=paneHeight*settings.scrollPagePercent,dragY=dragMaxY*contentDragY/(contentHeight-paneHeight);if(direction<0){if(verticalDragPosition-dragY>pos){jsp.scrollByY(-contentDragY)}else{positionDragY(pos)}}else if(direction>0){if(verticalDragPosition+dragY<pos){jsp.scrollByY(contentDragY)}else{positionDragY(pos)}}else{cancelClick();return}scrollTimeout=setTimeout(doScroll,isFirst?settings.initialDelay:settings.trackClickRepeatFreq);isFirst=false},cancelClick=function(){scrollTimeout&&clearTimeout(scrollTimeout);scrollTimeout=null;$(document).unbind("mouseup.jsp",cancelClick)};doScroll();$(document).bind("mouseup.jsp",cancelClick);return false}})}if(isScrollableH){horizontalTrack.bind("mousedown.jsp",function(e){if(e.originalTarget===undefined||e.originalTarget==e.currentTarget){var clickedTrack=$(this),offset=clickedTrack.offset(),direction=e.pageX-offset.left-horizontalDragPosition,scrollTimeout,isFirst=true,doScroll=function(){var offset=clickedTrack.offset(),pos=e.pageX-offset.left-horizontalDragWidth/2,contentDragX=paneWidth*settings.scrollPagePercent,dragX=dragMaxX*contentDragX/(contentWidth-paneWidth);if(direction<0){if(horizontalDragPosition-dragX>pos){jsp.scrollByX(-contentDragX)}else{positionDragX(pos)}}else if(direction>0){if(horizontalDragPosition+dragX<pos){jsp.scrollByX(contentDragX)}else{positionDragX(pos)}}else{cancelClick();return}scrollTimeout=setTimeout(doScroll,isFirst?settings.initialDelay:settings.trackClickRepeatFreq);isFirst=false},cancelClick=function(){scrollTimeout&&clearTimeout(scrollTimeout);scrollTimeout=null;$(document).unbind("mouseup.jsp",cancelClick)};doScroll();$(document).bind("mouseup.jsp",cancelClick);return false}})}}function removeClickOnTrack(){if(horizontalTrack){horizontalTrack.unbind("mousedown.jsp")}if(verticalTrack){verticalTrack.unbind("mousedown.jsp")}}function cancelDrag(){$("html").unbind("dragstart.jsp selectstart.jsp mousemove.jsp mouseup.jsp mouseleave.jsp");if(verticalDrag){verticalDrag.removeClass("jspActive")}if(horizontalDrag){horizontalDrag.removeClass("jspActive")}}function positionDragY(destY,animate){if(!isScrollableV){return}if(destY<0){destY=0}else if(destY>dragMaxY){destY=dragMaxY}
// can't just check if(animate) because false is a valid value that could be passed in...
if(animate===undefined){animate=settings.animateScroll}if(animate){jsp.animate(verticalDrag,"top",destY,_positionDragY)}else{verticalDrag.css("top",destY);_positionDragY(destY)}}function _positionDragY(destY){if(destY===undefined){destY=verticalDrag.position().top}container.scrollTop(0);verticalDragPosition=destY||0;var isAtTop=verticalDragPosition===0,isAtBottom=verticalDragPosition==dragMaxY,percentScrolled=destY/dragMaxY,destTop=-percentScrolled*(contentHeight-paneHeight);if(wasAtTop!=isAtTop||wasAtBottom!=isAtBottom){wasAtTop=isAtTop;wasAtBottom=isAtBottom;elem.trigger("jsp-arrow-change",[wasAtTop,wasAtBottom,wasAtLeft,wasAtRight])}updateVerticalArrows(isAtTop,isAtBottom);pane.css("top",destTop);elem.trigger("jsp-scroll-y",[-destTop,isAtTop,isAtBottom]).trigger("scroll")}function positionDragX(destX,animate){if(!isScrollableH){return}if(destX<0){destX=0}else if(destX>dragMaxX){destX=dragMaxX}if(animate===undefined){animate=settings.animateScroll}if(animate){jsp.animate(horizontalDrag,"left",destX,_positionDragX)}else{horizontalDrag.css("left",destX);_positionDragX(destX)}}function _positionDragX(destX){if(destX===undefined){destX=horizontalDrag.position().left}container.scrollTop(0);horizontalDragPosition=destX||0;var isAtLeft=horizontalDragPosition===0,isAtRight=horizontalDragPosition==dragMaxX,percentScrolled=destX/dragMaxX,destLeft=-percentScrolled*(contentWidth-paneWidth);if(wasAtLeft!=isAtLeft||wasAtRight!=isAtRight){wasAtLeft=isAtLeft;wasAtRight=isAtRight;elem.trigger("jsp-arrow-change",[wasAtTop,wasAtBottom,wasAtLeft,wasAtRight])}updateHorizontalArrows(isAtLeft,isAtRight);pane.css("left",destLeft);elem.trigger("jsp-scroll-x",[-destLeft,isAtLeft,isAtRight]).trigger("scroll")}function updateVerticalArrows(isAtTop,isAtBottom){if(settings.showArrows){arrowUp[isAtTop?"addClass":"removeClass"]("jspDisabled");arrowDown[isAtBottom?"addClass":"removeClass"]("jspDisabled")}}function updateHorizontalArrows(isAtLeft,isAtRight){if(settings.showArrows){arrowLeft[isAtLeft?"addClass":"removeClass"]("jspDisabled");arrowRight[isAtRight?"addClass":"removeClass"]("jspDisabled")}}function scrollToY(destY,animate){var percentScrolled=destY/(contentHeight-paneHeight);positionDragY(percentScrolled*dragMaxY,animate)}function scrollToX(destX,animate){var percentScrolled=destX/(contentWidth-paneWidth);positionDragX(percentScrolled*dragMaxX,animate)}function scrollToElement(ele,stickToTop,animate){var e,eleHeight,eleWidth,eleTop=0,eleLeft=0,viewportTop,viewportLeft,maxVisibleEleTop,maxVisibleEleLeft,destY,destX;
// Legal hash values aren't necessarily legal jQuery selectors so we need to catch any
// errors from the lookup...
try{e=$(ele)}catch(err){return}eleHeight=e.outerHeight();eleWidth=e.outerWidth();container.scrollTop(0);container.scrollLeft(0);
// loop through parents adding the offset top of any elements that are relatively positioned between
// the focused element and the jspPane so we can get the true distance from the top
// of the focused element to the top of the scrollpane...
while(!e.is(".jspPane")){eleTop+=e.position().top;eleLeft+=e.position().left;e=e.offsetParent();if(/^body|html$/i.test(e[0].nodeName)){
// we ended up too high in the document structure. Quit!
return}}viewportTop=contentPositionY();maxVisibleEleTop=viewportTop+paneHeight;if(eleTop<viewportTop||stickToTop){// element is above viewport
destY=eleTop-settings.horizontalGutter}else if(eleTop+eleHeight>maxVisibleEleTop){// element is below viewport
destY=eleTop-paneHeight+eleHeight+settings.horizontalGutter}if(!isNaN(destY)){scrollToY(destY,animate)}viewportLeft=contentPositionX();maxVisibleEleLeft=viewportLeft+paneWidth;if(eleLeft<viewportLeft||stickToTop){// element is to the left of viewport
destX=eleLeft-settings.horizontalGutter}else if(eleLeft+eleWidth>maxVisibleEleLeft){// element is to the right viewport
destX=eleLeft-paneWidth+eleWidth+settings.horizontalGutter}if(!isNaN(destX)){scrollToX(destX,animate)}}function contentPositionX(){return-pane.position().left}function contentPositionY(){return-pane.position().top}function isCloseToBottom(){var scrollableHeight=contentHeight-paneHeight;return scrollableHeight>20&&scrollableHeight-contentPositionY()<10}function isCloseToRight(){var scrollableWidth=contentWidth-paneWidth;return scrollableWidth>20&&scrollableWidth-contentPositionX()<10}function initMousewheel(){container.unbind(mwEvent).bind(mwEvent,function(event,delta,deltaX,deltaY){if(!horizontalDragPosition)horizontalDragPosition=0;if(!verticalDragPosition)verticalDragPosition=0;var dX=horizontalDragPosition,dY=verticalDragPosition,factor=event.deltaFactor||settings.mouseWheelSpeed;jsp.scrollBy(deltaX*factor,-deltaY*factor,false);
// return true if there was no movement so rest of screen can scroll
return dX==horizontalDragPosition&&dY==verticalDragPosition})}function removeMousewheel(){container.unbind(mwEvent)}function nil(){return false}function initFocusHandler(){pane.find(":input,a").unbind("focus.jsp").bind("focus.jsp",function(e){scrollToElement(e.target,false)})}function removeFocusHandler(){pane.find(":input,a").unbind("focus.jsp")}function initKeyboardNav(){var keyDown,elementHasScrolled,validParents=[];isScrollableH&&validParents.push(horizontalBar[0]);isScrollableV&&validParents.push(verticalBar[0]);
// IE also focuses elements that don't have tabindex set.
pane.bind("focus.jsp",function(){elem.focus()});elem.attr("tabindex",0).unbind("keydown.jsp keypress.jsp").bind("keydown.jsp",function(e){if(e.target!==this&&!(validParents.length&&$(e.target).closest(validParents).length)){return}var dX=horizontalDragPosition,dY=verticalDragPosition;switch(e.keyCode){case 40:// down
case 38:// up
case 34:// page down
case 32:// space
case 33:// page up
case 39:// right
case 37:// left
keyDown=e.keyCode;keyDownHandler();break;case 35:// end
scrollToY(contentHeight-paneHeight);keyDown=null;break;case 36:// home
scrollToY(0);keyDown=null;break}elementHasScrolled=e.keyCode==keyDown&&dX!=horizontalDragPosition||dY!=verticalDragPosition;return!elementHasScrolled}).bind("keypress.jsp",// For FF/ OSX so that we can cancel the repeat key presses if the JSP scrolls...
function(e){if(e.keyCode==keyDown){keyDownHandler()}
// If the keypress is not related to the area, ignore it. Fixes problem with inputs inside scrolled area. Copied from line 955.
if(e.target!==this&&!(validParents.length&&$(e.target).closest(validParents).length)){return}return!elementHasScrolled});if(settings.hideFocus){elem.css("outline","none");if("hideFocus"in container[0]){elem.attr("hideFocus",true)}}else{elem.css("outline","");if("hideFocus"in container[0]){elem.attr("hideFocus",false)}}function keyDownHandler(){var dX=horizontalDragPosition,dY=verticalDragPosition;switch(keyDown){case 40:// down
jsp.scrollByY(settings.keyboardSpeed,false);break;case 38:// up
jsp.scrollByY(-settings.keyboardSpeed,false);break;case 34:// page down
case 32:// space
jsp.scrollByY(paneHeight*settings.scrollPagePercent,false);break;case 33:// page up
jsp.scrollByY(-paneHeight*settings.scrollPagePercent,false);break;case 39:// right
jsp.scrollByX(settings.keyboardSpeed,false);break;case 37:// left
jsp.scrollByX(-settings.keyboardSpeed,false);break}elementHasScrolled=dX!=horizontalDragPosition||dY!=verticalDragPosition;return elementHasScrolled}}function removeKeyboardNav(){elem.attr("tabindex","-1").removeAttr("tabindex").unbind("keydown.jsp keypress.jsp");pane.unbind(".jsp")}function observeHash(){if(location.hash&&location.hash.length>1){var e,retryInt,hash=escape(location.hash.substr(1));try{e=$("#"+hash+', a[name="'+hash+'"]')}catch(err){return}if(e.length&&pane.find(hash)){
// nasty workaround but it appears to take a little while before the hash has done its thing
// to the rendered page so we just wait until the container's scrollTop has been messed up.
if(container.scrollTop()===0){retryInt=setInterval(function(){if(container.scrollTop()>0){scrollToElement(e,true);$(document).scrollTop(container.position().top);clearInterval(retryInt)}},50)}else{scrollToElement(e,true);$(document).scrollTop(container.position().top)}}}}function hijackInternalLinks(){
// only register the link handler once
if($(document.body).data("jspHijack")){return}
// remember that the handler was bound
$(document.body).data("jspHijack",true);
// use live handler to also capture newly created links
$(document.body).delegate("a[href*=#]","click",function(event){
// does the link point to the same page?
// this also takes care of cases with a <base>-Tag or Links not starting with the hash #
// e.g. <a href="index.html#test"> when the current url already is index.html
var href=this.href.substr(0,this.href.indexOf("#")),locationHref=location.href,hash,element,container,jsp,scrollTop,elementTop;if(location.href.indexOf("#")!==-1){locationHref=location.href.substr(0,location.href.indexOf("#"))}if(href!==locationHref){
// the link points to another page
return}
// check if jScrollPane should handle this click event
hash=escape(this.href.substr(this.href.indexOf("#")+1));
// find the element on the page
element;try{element=$("#"+hash+', a[name="'+hash+'"]')}catch(e){
// hash is not a valid jQuery identifier
return}if(!element.length){
// this link does not point to an element on this page
return}container=element.closest(".jspScrollable");jsp=container.data("jsp");
// jsp might be another jsp instance than the one, that bound this event
// remember: this event is only bound once for all instances.
jsp.scrollToElement(element,true);if(container[0].scrollIntoView){
// also scroll to the top of the container (if it is not visible)
scrollTop=$(window).scrollTop();elementTop=element.offset().top;if(elementTop<scrollTop||elementTop>scrollTop+$(window).height()){container[0].scrollIntoView()}}
// jsp handled this event, prevent the browser default (scrolling :P)
event.preventDefault()})}
// Init touch on iPad, iPhone, iPod, Android
function initTouch(){var startX,startY,touchStartX,touchStartY,moved,moving=false;container.unbind("touchstart.jsp touchmove.jsp touchend.jsp click.jsp-touchclick").bind("touchstart.jsp",function(e){var touch=e.originalEvent.touches[0];startX=contentPositionX();startY=contentPositionY();touchStartX=touch.pageX;touchStartY=touch.pageY;moved=false;moving=true}).bind("touchmove.jsp",function(ev){if(!moving){return}var touchPos=ev.originalEvent.touches[0],dX=horizontalDragPosition,dY=verticalDragPosition;jsp.scrollTo(startX+touchStartX-touchPos.pageX,startY+touchStartY-touchPos.pageY);moved=moved||Math.abs(touchStartX-touchPos.pageX)>5||Math.abs(touchStartY-touchPos.pageY)>5;
// return true if there was no movement so rest of screen can scroll
return dX==horizontalDragPosition&&dY==verticalDragPosition}).bind("touchend.jsp",function(e){moving=false;
/*if(moved) {
                         return false;
                         }*/}).bind("click.jsp-touchclick",function(e){if(moved){moved=false;return false}})}function destroy(){var currentY=contentPositionY(),currentX=contentPositionX();elem.removeClass("jspScrollable").unbind(".jsp");pane.unbind(".jsp");elem.replaceWith(originalElement.append(pane.children()));originalElement.scrollTop(currentY);originalElement.scrollLeft(currentX);
// clear reinitialize timer if active
if(reinitialiseInterval){clearInterval(reinitialiseInterval)}}
// Public API
$.extend(jsp,{
// Reinitialises the scroll pane (if it's internal dimensions have changed since the last time it
// was initialised). The settings object which is passed in will override any settings from the
// previous time it was initialised - if you don't pass any settings then the ones from the previous
// initialisation will be used.
reinitialise:function(s){s=$.extend({},settings,s);initialise(s)},
// Scrolls the specified element (a jQuery object, DOM node or jQuery selector string) into view so
// that it can be seen within the viewport. If stickToTop is true then the element will appear at
// the top of the viewport, if it is false then the viewport will scroll as little as possible to
// show the element. You can also specify if you want animation to occur. If you don't provide this
// argument then the animateScroll value from the settings object is used instead.
scrollToElement:function(ele,stickToTop,animate){scrollToElement(ele,stickToTop,animate)},
// Scrolls the pane so that the specified co-ordinates within the content are at the top left
// of the viewport. animate is optional and if not passed then the value of animateScroll from
// the settings object this jScrollPane was initialised with is used.
scrollTo:function(destX,destY,animate){scrollToX(destX,animate);scrollToY(destY,animate)},
// Scrolls the pane so that the specified co-ordinate within the content is at the left of the
// viewport. animate is optional and if not passed then the value of animateScroll from the settings
// object this jScrollPane was initialised with is used.
scrollToX:function(destX,animate){scrollToX(destX,animate)},
// Scrolls the pane so that the specified co-ordinate within the content is at the top of the
// viewport. animate is optional and if not passed then the value of animateScroll from the settings
// object this jScrollPane was initialised with is used.
scrollToY:function(destY,animate){scrollToY(destY,animate)},
// Scrolls the pane to the specified percentage of its maximum horizontal scroll position. animate
// is optional and if not passed then the value of animateScroll from the settings object this
// jScrollPane was initialised with is used.
scrollToPercentX:function(destPercentX,animate){scrollToX(destPercentX*(contentWidth-paneWidth),animate)},
// Scrolls the pane to the specified percentage of its maximum vertical scroll position. animate
// is optional and if not passed then the value of animateScroll from the settings object this
// jScrollPane was initialised with is used.
scrollToPercentY:function(destPercentY,animate){scrollToY(destPercentY*(contentHeight-paneHeight),animate)},
// Scrolls the pane by the specified amount of pixels. animate is optional and if not passed then
// the value of animateScroll from the settings object this jScrollPane was initialised with is used.
scrollBy:function(deltaX,deltaY,animate){jsp.scrollByX(deltaX,animate);jsp.scrollByY(deltaY,animate)},
// Scrolls the pane by the specified amount of pixels. animate is optional and if not passed then
// the value of animateScroll from the settings object this jScrollPane was initialised with is used.
scrollByX:function(deltaX,animate){var destX=contentPositionX()+Math[deltaX<0?"floor":"ceil"](deltaX),percentScrolled=destX/(contentWidth-paneWidth);positionDragX(percentScrolled*dragMaxX,animate)},
// Scrolls the pane by the specified amount of pixels. animate is optional and if not passed then
// the value of animateScroll from the settings object this jScrollPane was initialised with is used.
scrollByY:function(deltaY,animate){var destY=contentPositionY()+Math[deltaY<0?"floor":"ceil"](deltaY),percentScrolled=destY/(contentHeight-paneHeight);positionDragY(percentScrolled*dragMaxY,animate)},
// Positions the horizontal drag at the specified x position (and updates the viewport to reflect
// this). animate is optional and if not passed then the value of animateScroll from the settings
// object this jScrollPane was initialised with is used.
positionDragX:function(x,animate){positionDragX(x,animate)},
// Positions the vertical drag at the specified y position (and updates the viewport to reflect
// this). animate is optional and if not passed then the value of animateScroll from the settings
// object this jScrollPane was initialised with is used.
positionDragY:function(y,animate){positionDragY(y,animate)},
// This method is called when jScrollPane is trying to animate to a new position. You can override
// it if you want to provide advanced animation functionality. It is passed the following arguments:
//  * ele          - the element whose position is being animated
//  * prop         - the property that is being animated
//  * value        - the value it's being animated to
//  * stepCallback - a function that you must execute each time you update the value of the property
// You can use the default implementation (below) as a starting point for your own implementation.
animate:function(ele,prop,value,stepCallback){var params={};params[prop]=value;ele.animate(params,{duration:settings.animateDuration,easing:settings.animateEase,queue:false,step:stepCallback})},
// Returns the current x position of the viewport with regards to the content pane.
getContentPositionX:function(){return contentPositionX()},
// Returns the current y position of the viewport with regards to the content pane.
getContentPositionY:function(){return contentPositionY()},
// Returns the width of the content within the scroll pane.
getContentWidth:function(){return contentWidth},
// Returns the height of the content within the scroll pane.
getContentHeight:function(){return contentHeight},
// Returns the horizontal position of the viewport within the pane content.
getPercentScrolledX:function(){return contentPositionX()/(contentWidth-paneWidth)},
// Returns the vertical position of the viewport within the pane content.
getPercentScrolledY:function(){return contentPositionY()/(contentHeight-paneHeight)},
// Returns whether or not this scrollpane has a horizontal scrollbar.
getIsScrollableH:function(){return isScrollableH},
// Returns whether or not this scrollpane has a vertical scrollbar.
getIsScrollableV:function(){return isScrollableV},
// Gets a reference to the content pane. It is important that you use this method if you want to
// edit the content of your jScrollPane as if you access the element directly then you may have some
// problems (as your original element has had additional elements for the scrollbars etc added into
// it).
getContentPane:function(){return pane},
// Scrolls this jScrollPane down as far as it can currently scroll. If animate isn't passed then the
// animateScroll value from settings is used instead.
scrollToBottom:function(animate){positionDragY(dragMaxY,animate)},
// Hijacks the links on the page which link to content inside the scrollpane. If you have changed
// the content of your page (e.g. via AJAX) and want to make sure any new anchor links to the
// contents of your scroll pane will work then call this function.
hijackInternalLinks:$.noop,
// Removes the jScrollPane and returns the page to the state it was in before jScrollPane was
// initialised.
destroy:function(){destroy()}});initialise(s)}
// Pluginifying code...
settings=$.extend({},$.fn.jScrollPane.defaults,settings);
// Apply default speed
$.each(["arrowButtonSpeed","trackClickSpeed","keyboardSpeed"],function(){settings[this]=settings[this]||settings.speed});return this.each(function(){var elem=$(this),jspApi=elem.data("jsp");if(jspApi){jspApi.reinitialise(settings)}else{$("script",elem).filter('[type="text/javascript"],:not([type])').remove();jspApi=new JScrollPane(elem,settings);elem.data("jsp",jspApi)}})};$.fn.jScrollPane.defaults={showArrows:false,maintainPosition:true,stickToBottom:false,stickToRight:false,clickOnTrack:true,autoReinitialise:false,autoReinitialiseDelay:500,verticalDragMinHeight:0,verticalDragMaxHeight:99999,horizontalDragMinWidth:0,horizontalDragMaxWidth:99999,contentWidth:undefined,animateScroll:false,animateDuration:300,animateEase:"linear",hijackInternalLinks:false,verticalGutter:4,horizontalGutter:4,mouseWheelSpeed:3,arrowButtonSpeed:0,arrowRepeatFreq:50,arrowScrollOnHover:false,trackClickSpeed:0,trackClickRepeatFreq:70,verticalArrowPositions:"split",horizontalArrowPositions:"split",enableKeyboardNavigation:true,hideFocus:false,keyboardSpeed:0,initialDelay:300,// Delay before starting repeating
speed:30,// Default speed when others falsey
scrollPagePercent:.8}});
/**
 * jQuery Maxlength plugin
 * @package jQuery maxlength 1.0.5
 * @creatir Emil Stjerneman / http://www.stjerneman.com
 */
(function($){$.fn.maxlength=function(options){var settings=jQuery.extend({events:[],// Array of events to be triggerd
maxCharacters:10,// Characters limit
status:true,// True to show status indicator bewlow the element
statusClass:"status",// The class on the status div
statusText:"character left",// The status text
notificationClass:"notification",// Will be added to the emement when maxlength is reached
showAlert:false,// True to show a regular alert message
alertText:"You have typed too many characters.",// Text in the alert message
slider:false},options);
// Add the default event
$.merge(settings.events,["input"]);return this.each(function(){var item=$(this);var charactersLength=item.val().length;
// Update the status text
function updateStatus(){var charactersLeft=settings.maxCharacters-charactersLength;charactersLeft=charactersLeft<0?0:charactersLeft;item.prev("div").html(charactersLeft+" "+settings.statusText)}function checkChars(){var valid=true;
// Too many chars?
if(charactersLength>=settings.maxCharacters){
// Too may chars, set the valid boolean to false
valid=false;
// Add the notification class when we have too many chars
item.addClass(settings.notificationClass);
// Cut down the string
item.val(item.val().substr(0,settings.maxCharacters));
// Show the alert dialog box, if its set to true
showAlert()}else if(item.hasClass(settings.notificationClass)){item.removeClass(settings.notificationClass)}if(settings.status){updateStatus()}}
// Shows an alert msg
function showAlert(){if(settings.showAlert){alert(settings.alertText)}}
// Check if the element is valid.
function validateElement(){return item.is("textarea")||item.filter("input[type=text]")||item.filter("input[type=password]")}
// Validate
if(!validateElement()){return false}
// Loop through the events and bind them to the element
$.each(settings.events,function(i,n){item.bind(n,function(e){charactersLength=item.val().length;checkChars()})});
// Insert the status div
if(settings.status){item.before($("<div/>").addClass(settings.statusClass).html("-"));updateStatus()}
// Remove the status div
if(!settings.status){var removeThisDiv=item.prev("div."+settings.statusClass);if(removeThisDiv){removeThisDiv.remove()}}
// Slide counter
if(settings.slider){item.next().hide();item.focus(function(){item.next().slideDown("fast")});item.blur(function(){item.next().slideUp("fast")})}})}})(jQuery);
/*!
 * jQuery Mousewheel 3.1.13
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license
 * http://jquery.org/license
 */
(function(factory){if(typeof define==="function"&&define.amd){
// AMD. Register as an anonymous module.
define(["jquery"],factory)}else if(typeof exports==="object"){
// Node/CommonJS style for Browserify
module.exports=factory}else{
// Browser globals
factory(jQuery)}})(function($){var toFix=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],toBind="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],slice=Array.prototype.slice,nullLowestDeltaTimeout,lowestDelta;if($.event.fixHooks){for(var i=toFix.length;i;){$.event.fixHooks[toFix[--i]]=$.event.mouseHooks}}var special=$.event.special.mousewheel={version:"3.1.12",setup:function(){if(this.addEventListener){for(var i=toBind.length;i;){this.addEventListener(toBind[--i],handler,false)}}else{this.onmousewheel=handler}
// Store the line height and page height for this particular element
$.data(this,"mousewheel-line-height",special.getLineHeight(this));$.data(this,"mousewheel-page-height",special.getPageHeight(this))},teardown:function(){if(this.removeEventListener){for(var i=toBind.length;i;){this.removeEventListener(toBind[--i],handler,false)}}else{this.onmousewheel=null}
// Clean up the data we added to the element
$.removeData(this,"mousewheel-line-height");$.removeData(this,"mousewheel-page-height")},getLineHeight:function(elem){var $elem=$(elem),$parent=$elem["offsetParent"in $.fn?"offsetParent":"parent"]();if(!$parent.length){$parent=$("body")}return parseInt($parent.css("fontSize"),10)||parseInt($elem.css("fontSize"),10)||16},getPageHeight:function(elem){return $(elem).height()},settings:{adjustOldDeltas:true,// see shouldAdjustOldDeltas() below
normalizeOffset:true}};$.fn.extend({mousewheel:function(fn){return fn?this.bind("mousewheel",fn):this.trigger("mousewheel")},unmousewheel:function(fn){return this.unbind("mousewheel",fn)}});function handler(event){var orgEvent=event||window.event,args=slice.call(arguments,1),delta=0,deltaX=0,deltaY=0,absDelta=0,offsetX=0,offsetY=0;event=$.event.fix(orgEvent);event.type="mousewheel";
// Old school scrollwheel delta
if("detail"in orgEvent){deltaY=orgEvent.detail*-1}if("wheelDelta"in orgEvent){deltaY=orgEvent.wheelDelta}if("wheelDeltaY"in orgEvent){deltaY=orgEvent.wheelDeltaY}if("wheelDeltaX"in orgEvent){deltaX=orgEvent.wheelDeltaX*-1}
// Firefox < 17 horizontal scrolling related to DOMMouseScroll event
if("axis"in orgEvent&&orgEvent.axis===orgEvent.HORIZONTAL_AXIS){deltaX=deltaY*-1;deltaY=0}
// Set delta to be deltaY or deltaX if deltaY is 0 for backwards compatabilitiy
delta=deltaY===0?deltaX:deltaY;
// New school wheel delta (wheel event)
if("deltaY"in orgEvent){deltaY=orgEvent.deltaY*-1;delta=deltaY}if("deltaX"in orgEvent){deltaX=orgEvent.deltaX;if(deltaY===0){delta=deltaX*-1}}
// No change actually happened, no reason to go any further
if(deltaY===0&&deltaX===0){return}
// Need to convert lines and pages to pixels if we aren't already in pixels
// There are three delta modes:
//   * deltaMode 0 is by pixels, nothing to do
//   * deltaMode 1 is by lines
//   * deltaMode 2 is by pages
if(orgEvent.deltaMode===1){var lineHeight=$.data(this,"mousewheel-line-height");delta*=lineHeight;deltaY*=lineHeight;deltaX*=lineHeight}else if(orgEvent.deltaMode===2){var pageHeight=$.data(this,"mousewheel-page-height");delta*=pageHeight;deltaY*=pageHeight;deltaX*=pageHeight}
// Store lowest absolute delta to normalize the delta values
absDelta=Math.max(Math.abs(deltaY),Math.abs(deltaX));if(!lowestDelta||absDelta<lowestDelta){lowestDelta=absDelta;
// Adjust older deltas if necessary
if(shouldAdjustOldDeltas(orgEvent,absDelta)){lowestDelta/=40}}
// Adjust older deltas if necessary
if(shouldAdjustOldDeltas(orgEvent,absDelta)){
// Divide all the things by 40!
delta/=40;deltaX/=40;deltaY/=40}
// Get a whole, normalized value for the deltas
delta=Math[delta>=1?"floor":"ceil"](delta/lowestDelta);deltaX=Math[deltaX>=1?"floor":"ceil"](deltaX/lowestDelta);deltaY=Math[deltaY>=1?"floor":"ceil"](deltaY/lowestDelta);
// Normalise offsetX and offsetY properties
if(special.settings.normalizeOffset&&this.getBoundingClientRect){var boundingRect=this.getBoundingClientRect();offsetX=event.clientX-boundingRect.left;offsetY=event.clientY-boundingRect.top}
// Add information to the event object
event.deltaX=deltaX;event.deltaY=deltaY;event.deltaFactor=lowestDelta;event.offsetX=offsetX;event.offsetY=offsetY;
// Go ahead and set deltaMode to 0 since we converted to pixels
// Although this is a little odd since we overwrite the deltaX/Y
// properties with normalized deltas.
event.deltaMode=0;
// Add event and delta to the front of the arguments
args.unshift(event,delta,deltaX,deltaY);
// Clearout lowestDelta after sometime to better
// handle multiple device types that give different
// a different lowestDelta
// Ex: trackpad = 3 and mouse wheel = 120
if(nullLowestDeltaTimeout){clearTimeout(nullLowestDeltaTimeout)}nullLowestDeltaTimeout=setTimeout(nullLowestDelta,200);return($.event.dispatch||$.event.handle).apply(this,args)}function nullLowestDelta(){lowestDelta=null}function shouldAdjustOldDeltas(orgEvent,absDelta){
// If this is an older event and the delta is divisable by 120,
// then we are assuming that the browser is treating this as an
// older mouse wheel event and that we should divide the deltas
// by 40 to try and get a more usable deltaFactor.
// Side note, this actually impacts the reported scroll distance
// in older browsers and can cause scrolling to be slower than native.
// Turn this off by setting $.event.special.mousewheel.settings.adjustOldDeltas to false.
return special.settings.adjustOldDeltas&&orgEvent.type==="mousewheel"&&absDelta%120===0}});
/*! jQuery UI - v1.11.4 - 2015-06-25
* http://jqueryui.com
* Includes: core.js, widget.js, mouse.js, position.js, datepicker.js, menu.js, selectmenu.js, draggable.js, droppable.js, sortable.js
* Copyright 2015 jQuery Foundation and other contributors; Licensed MIT */
(function(factory){if(typeof define==="function"&&define.amd){
// AMD. Register as an anonymous module.
define(["jquery"],factory)}else{
// Browser globals
factory(jQuery)}})(function($){
/*!
 * jQuery UI Core 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/category/ui-core/
 */
// $.ui might exist from components with no dependencies, e.g., $.ui.position
$.ui=$.ui||{};$.extend($.ui,{version:"1.11.4",keyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}});
// plugins
$.fn.extend({scrollParent:function(includeHidden){var position=this.css("position"),excludeStaticParent=position==="absolute",overflowRegex=includeHidden?/(auto|scroll|hidden)/:/(auto|scroll)/,scrollParent=this.parents().filter(function(){var parent=$(this);if(excludeStaticParent&&parent.css("position")==="static"){return false}return overflowRegex.test(parent.css("overflow")+parent.css("overflow-y")+parent.css("overflow-x"))}).eq(0);return position==="fixed"||!scrollParent.length?$(this[0].ownerDocument||document):scrollParent},uniqueId:function(){var uuid=0;return function(){return this.each(function(){if(!this.id){this.id="ui-id-"+ ++uuid}})}}(),removeUniqueId:function(){return this.each(function(){if(/^ui-id-\d+$/.test(this.id)){$(this).removeAttr("id")}})}});
// selectors
function focusable(element,isTabIndexNotNaN){var map,mapName,img,nodeName=element.nodeName.toLowerCase();if("area"===nodeName){map=element.parentNode;mapName=map.name;if(!element.href||!mapName||map.nodeName.toLowerCase()!=="map"){return false}img=$("img[usemap='#"+mapName+"']")[0];return!!img&&visible(img)}return(/^(input|select|textarea|button|object)$/.test(nodeName)?!element.disabled:"a"===nodeName?element.href||isTabIndexNotNaN:isTabIndexNotNaN)&&
// the element and all of its ancestors must be visible
visible(element)}function visible(element){return $.expr.filters.visible(element)&&!$(element).parents().addBack().filter(function(){return $.css(this,"visibility")==="hidden"}).length}$.extend($.expr[":"],{data:$.expr.createPseudo?$.expr.createPseudo(function(dataName){return function(elem){return!!$.data(elem,dataName)}}):
// support: jQuery <1.8
function(elem,i,match){return!!$.data(elem,match[3])},focusable:function(element){return focusable(element,!isNaN($.attr(element,"tabindex")))},tabbable:function(element){var tabIndex=$.attr(element,"tabindex"),isTabIndexNaN=isNaN(tabIndex);return(isTabIndexNaN||tabIndex>=0)&&focusable(element,!isTabIndexNaN)}});
// support: jQuery <1.8
if(!$("<a>").outerWidth(1).jquery){$.each(["Width","Height"],function(i,name){var side=name==="Width"?["Left","Right"]:["Top","Bottom"],type=name.toLowerCase(),orig={innerWidth:$.fn.innerWidth,innerHeight:$.fn.innerHeight,outerWidth:$.fn.outerWidth,outerHeight:$.fn.outerHeight};function reduce(elem,size,border,margin){$.each(side,function(){size-=parseFloat($.css(elem,"padding"+this))||0;if(border){size-=parseFloat($.css(elem,"border"+this+"Width"))||0}if(margin){size-=parseFloat($.css(elem,"margin"+this))||0}});return size}$.fn["inner"+name]=function(size){if(size===undefined){return orig["inner"+name].call(this)}return this.each(function(){$(this).css(type,reduce(this,size)+"px")})};$.fn["outer"+name]=function(size,margin){if(typeof size!=="number"){return orig["outer"+name].call(this,size)}return this.each(function(){$(this).css(type,reduce(this,size,true,margin)+"px")})}})}
// support: jQuery <1.8
if(!$.fn.addBack){$.fn.addBack=function(selector){return this.add(selector==null?this.prevObject:this.prevObject.filter(selector))}}
// support: jQuery 1.6.1, 1.6.2 (http://bugs.jquery.com/ticket/9413)
if($("<a>").data("a-b","a").removeData("a-b").data("a-b")){$.fn.removeData=function(removeData){return function(key){if(arguments.length){return removeData.call(this,$.camelCase(key))}else{return removeData.call(this)}}}($.fn.removeData)}
// deprecated
$.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase());$.fn.extend({focus:function(orig){return function(delay,fn){return typeof delay==="number"?this.each(function(){var elem=this;setTimeout(function(){$(elem).focus();if(fn){fn.call(elem)}},delay)}):orig.apply(this,arguments)}}($.fn.focus),disableSelection:function(){var eventType="onselectstart"in document.createElement("div")?"selectstart":"mousedown";return function(){return this.bind(eventType+".ui-disableSelection",function(event){event.preventDefault()})}}(),enableSelection:function(){return this.unbind(".ui-disableSelection")},zIndex:function(zIndex){if(zIndex!==undefined){return this.css("zIndex",zIndex)}if(this.length){var elem=$(this[0]),position,value;while(elem.length&&elem[0]!==document){
// Ignore z-index if position is set to a value where z-index is ignored by the browser
// This makes behavior of this function consistent across browsers
// WebKit always returns auto if the element is positioned
position=elem.css("position");if(position==="absolute"||position==="relative"||position==="fixed"){
// IE returns 0 when zIndex is not specified
// other browsers return a string
// we ignore the case of nested elements with an explicit value of 0
// <div style="z-index: -10;"><div style="z-index: 0;"></div></div>
value=parseInt(elem.css("zIndex"),10);if(!isNaN(value)&&value!==0){return value}}elem=elem.parent()}}return 0}});
// $.ui.plugin is deprecated. Use $.widget() extensions instead.
$.ui.plugin={add:function(module,option,set){var i,proto=$.ui[module].prototype;for(i in set){proto.plugins[i]=proto.plugins[i]||[];proto.plugins[i].push([option,set[i]])}},call:function(instance,name,args,allowDisconnected){var i,set=instance.plugins[name];if(!set){return}if(!allowDisconnected&&(!instance.element[0].parentNode||instance.element[0].parentNode.nodeType===11)){return}for(i=0;i<set.length;i++){if(instance.options[set[i][0]]){set[i][1].apply(instance.element,args)}}}};
/*!
 * jQuery UI Widget 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/jQuery.widget/
 */var widget_uuid=0,widget_slice=Array.prototype.slice;$.cleanData=function(orig){return function(elems){var events,elem,i;for(i=0;(elem=elems[i])!=null;i++){try{
// Only trigger remove when necessary to save time
events=$._data(elem,"events");if(events&&events.remove){$(elem).triggerHandler("remove")}
// http://bugs.jquery.com/ticket/8235
}catch(e){}}orig(elems)}}($.cleanData);$.widget=function(name,base,prototype){var fullName,existingConstructor,constructor,basePrototype,
// proxiedPrototype allows the provided prototype to remain unmodified
// so that it can be used as a mixin for multiple widgets (#8876)
proxiedPrototype={},namespace=name.split(".")[0];name=name.split(".")[1];fullName=namespace+"-"+name;if(!prototype){prototype=base;base=$.Widget}
// create selector for plugin
$.expr[":"][fullName.toLowerCase()]=function(elem){return!!$.data(elem,fullName)};$[namespace]=$[namespace]||{};existingConstructor=$[namespace][name];constructor=$[namespace][name]=function(options,element){
// allow instantiation without "new" keyword
if(!this._createWidget){return new constructor(options,element)}
// allow instantiation without initializing for simple inheritance
// must use "new" keyword (the code above always passes args)
if(arguments.length){this._createWidget(options,element)}};
// extend with the existing constructor to carry over any static properties
$.extend(constructor,existingConstructor,{version:prototype.version,
// copy the object used to create the prototype in case we need to
// redefine the widget later
_proto:$.extend({},prototype),
// track widgets that inherit from this widget in case this widget is
// redefined after a widget inherits from it
_childConstructors:[]});basePrototype=new base;
// we need to make the options hash a property directly on the new instance
// otherwise we'll modify the options hash on the prototype that we're
// inheriting from
basePrototype.options=$.widget.extend({},basePrototype.options);$.each(prototype,function(prop,value){if(!$.isFunction(value)){proxiedPrototype[prop]=value;return}proxiedPrototype[prop]=function(){var _super=function(){return base.prototype[prop].apply(this,arguments)},_superApply=function(args){return base.prototype[prop].apply(this,args)};return function(){var __super=this._super,__superApply=this._superApply,returnValue;this._super=_super;this._superApply=_superApply;returnValue=value.apply(this,arguments);this._super=__super;this._superApply=__superApply;return returnValue}}()});constructor.prototype=$.widget.extend(basePrototype,{
// TODO: remove support for widgetEventPrefix
// always use the name + a colon as the prefix, e.g., draggable:start
// don't prefix for widgets that aren't DOM-based
widgetEventPrefix:existingConstructor?basePrototype.widgetEventPrefix||name:name},proxiedPrototype,{constructor:constructor,namespace:namespace,widgetName:name,widgetFullName:fullName});
// If this widget is being redefined then we need to find all widgets that
// are inheriting from it and redefine all of them so that they inherit from
// the new version of this widget. We're essentially trying to replace one
// level in the prototype chain.
if(existingConstructor){$.each(existingConstructor._childConstructors,function(i,child){var childPrototype=child.prototype;
// redefine the child widget using the same prototype that was
// originally used, but inherit from the new version of the base
$.widget(childPrototype.namespace+"."+childPrototype.widgetName,constructor,child._proto)});
// remove the list of existing child constructors from the old constructor
// so the old child constructors can be garbage collected
delete existingConstructor._childConstructors}else{base._childConstructors.push(constructor)}$.widget.bridge(name,constructor);return constructor};$.widget.extend=function(target){var input=widget_slice.call(arguments,1),inputIndex=0,inputLength=input.length,key,value;for(;inputIndex<inputLength;inputIndex++){for(key in input[inputIndex]){value=input[inputIndex][key];if(input[inputIndex].hasOwnProperty(key)&&value!==undefined){
// Clone objects
if($.isPlainObject(value)){target[key]=$.isPlainObject(target[key])?$.widget.extend({},target[key],value):
// Don't extend strings, arrays, etc. with objects
$.widget.extend({},value);
// Copy everything else by reference
}else{target[key]=value}}}}return target};$.widget.bridge=function(name,object){var fullName=object.prototype.widgetFullName||name;$.fn[name]=function(options){var isMethodCall=typeof options==="string",args=widget_slice.call(arguments,1),returnValue=this;if(isMethodCall){this.each(function(){var methodValue,instance=$.data(this,fullName);if(options==="instance"){returnValue=instance;return false}if(!instance){return $.error("cannot call methods on "+name+" prior to initialization; "+"attempted to call method '"+options+"'")}if(!$.isFunction(instance[options])||options.charAt(0)==="_"){return $.error("no such method '"+options+"' for "+name+" widget instance")}methodValue=instance[options].apply(instance,args);if(methodValue!==instance&&methodValue!==undefined){returnValue=methodValue&&methodValue.jquery?returnValue.pushStack(methodValue.get()):methodValue;return false}})}else{
// Allow multiple hashes to be passed on init
if(args.length){options=$.widget.extend.apply(null,[options].concat(args))}this.each(function(){var instance=$.data(this,fullName);if(instance){instance.option(options||{});if(instance._init){instance._init()}}else{$.data(this,fullName,new object(options,this))}})}return returnValue}};$.Widget=function(){};$.Widget._childConstructors=[];$.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{disabled:false,
// callbacks
create:null},_createWidget:function(options,element){element=$(element||this.defaultElement||this)[0];this.element=$(element);this.uuid=widget_uuid++;this.eventNamespace="."+this.widgetName+this.uuid;this.bindings=$();this.hoverable=$();this.focusable=$();if(element!==this){$.data(element,this.widgetFullName,this);this._on(true,this.element,{remove:function(event){if(event.target===element){this.destroy()}}});this.document=$(element.style?
// element within the document
element.ownerDocument:
// element is window or document
element.document||element);this.window=$(this.document[0].defaultView||this.document[0].parentWindow)}this.options=$.widget.extend({},this.options,this._getCreateOptions(),options);this._create();this._trigger("create",null,this._getCreateEventData());this._init()},_getCreateOptions:$.noop,_getCreateEventData:$.noop,_create:$.noop,_init:$.noop,destroy:function(){this._destroy();
// we can probably remove the unbind calls in 2.0
// all event bindings should go through this._on()
this.element.unbind(this.eventNamespace).removeData(this.widgetFullName).removeData($.camelCase(this.widgetFullName));this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled "+"ui-state-disabled");
// clean up events and states
this.bindings.unbind(this.eventNamespace);this.hoverable.removeClass("ui-state-hover");this.focusable.removeClass("ui-state-focus")},_destroy:$.noop,widget:function(){return this.element},option:function(key,value){var options=key,parts,curOption,i;if(arguments.length===0){
// don't return a reference to the internal hash
return $.widget.extend({},this.options)}if(typeof key==="string"){
// handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
options={};parts=key.split(".");key=parts.shift();if(parts.length){curOption=options[key]=$.widget.extend({},this.options[key]);for(i=0;i<parts.length-1;i++){curOption[parts[i]]=curOption[parts[i]]||{};curOption=curOption[parts[i]]}key=parts.pop();if(arguments.length===1){return curOption[key]===undefined?null:curOption[key]}curOption[key]=value}else{if(arguments.length===1){return this.options[key]===undefined?null:this.options[key]}options[key]=value}}this._setOptions(options);return this},_setOptions:function(options){var key;for(key in options){this._setOption(key,options[key])}return this},_setOption:function(key,value){this.options[key]=value;if(key==="disabled"){this.widget().toggleClass(this.widgetFullName+"-disabled",!!value);
// If the widget is becoming disabled, then nothing is interactive
if(value){this.hoverable.removeClass("ui-state-hover");this.focusable.removeClass("ui-state-focus")}}return this},enable:function(){return this._setOptions({disabled:false})},disable:function(){return this._setOptions({disabled:true})},_on:function(suppressDisabledCheck,element,handlers){var delegateElement,instance=this;
// no suppressDisabledCheck flag, shuffle arguments
if(typeof suppressDisabledCheck!=="boolean"){handlers=element;element=suppressDisabledCheck;suppressDisabledCheck=false}
// no element argument, shuffle and use this.element
if(!handlers){handlers=element;element=this.element;delegateElement=this.widget()}else{element=delegateElement=$(element);this.bindings=this.bindings.add(element)}$.each(handlers,function(event,handler){function handlerProxy(){
// allow widgets to customize the disabled handling
// - disabled as an array instead of boolean
// - disabled class as method for disabling individual parts
if(!suppressDisabledCheck&&(instance.options.disabled===true||$(this).hasClass("ui-state-disabled"))){return}return(typeof handler==="string"?instance[handler]:handler).apply(instance,arguments)}
// copy the guid so direct unbinding works
if(typeof handler!=="string"){handlerProxy.guid=handler.guid=handler.guid||handlerProxy.guid||$.guid++}var match=event.match(/^([\w:-]*)\s*(.*)$/),eventName=match[1]+instance.eventNamespace,selector=match[2];if(selector){delegateElement.delegate(selector,eventName,handlerProxy)}else{element.bind(eventName,handlerProxy)}})},_off:function(element,eventName){eventName=(eventName||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace;element.unbind(eventName).undelegate(eventName);
// Clear the stack to avoid memory leaks (#10056)
this.bindings=$(this.bindings.not(element).get());this.focusable=$(this.focusable.not(element).get());this.hoverable=$(this.hoverable.not(element).get())},_delay:function(handler,delay){function handlerProxy(){return(typeof handler==="string"?instance[handler]:handler).apply(instance,arguments)}var instance=this;return setTimeout(handlerProxy,delay||0)},_hoverable:function(element){this.hoverable=this.hoverable.add(element);this._on(element,{mouseenter:function(event){$(event.currentTarget).addClass("ui-state-hover")},mouseleave:function(event){$(event.currentTarget).removeClass("ui-state-hover")}})},_focusable:function(element){this.focusable=this.focusable.add(element);this._on(element,{focusin:function(event){$(event.currentTarget).addClass("ui-state-focus")},focusout:function(event){$(event.currentTarget).removeClass("ui-state-focus")}})},_trigger:function(type,event,data){var prop,orig,callback=this.options[type];data=data||{};event=$.Event(event);event.type=(type===this.widgetEventPrefix?type:this.widgetEventPrefix+type).toLowerCase();
// the original event may come from any element
// so we need to reset the target on the new event
event.target=this.element[0];
// copy original event properties over to the new event
orig=event.originalEvent;if(orig){for(prop in orig){if(!(prop in event)){event[prop]=orig[prop]}}}this.element.trigger(event,data);return!($.isFunction(callback)&&callback.apply(this.element[0],[event].concat(data))===false||event.isDefaultPrevented())}};$.each({show:"fadeIn",hide:"fadeOut"},function(method,defaultEffect){$.Widget.prototype["_"+method]=function(element,options,callback){if(typeof options==="string"){options={effect:options}}var hasOptions,effectName=!options?method:options===true||typeof options==="number"?defaultEffect:options.effect||defaultEffect;options=options||{};if(typeof options==="number"){options={duration:options}}hasOptions=!$.isEmptyObject(options);options.complete=callback;if(options.delay){element.delay(options.delay)}if(hasOptions&&$.effects&&$.effects.effect[effectName]){element[method](options)}else if(effectName!==method&&element[effectName]){element[effectName](options.duration,options.easing,callback)}else{element.queue(function(next){$(this)[method]();if(callback){callback.call(element[0])}next()})}}});var widget=$.widget;
/*!
 * jQuery UI Mouse 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/mouse/
 */var mouseHandled=false;$(document).mouseup(function(){mouseHandled=false});var mouse=$.widget("ui.mouse",{version:"1.11.4",options:{cancel:"input,textarea,button,select,option",distance:1,delay:0},_mouseInit:function(){var that=this;this.element.bind("mousedown."+this.widgetName,function(event){return that._mouseDown(event)}).bind("click."+this.widgetName,function(event){if(true===$.data(event.target,that.widgetName+".preventClickEvent")){$.removeData(event.target,that.widgetName+".preventClickEvent");event.stopImmediatePropagation();return false}});this.started=false},
// TODO: make sure destroying one instance of mouse doesn't mess with
// other instances of mouse
_mouseDestroy:function(){this.element.unbind("."+this.widgetName);if(this._mouseMoveDelegate){this.document.unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate)}},_mouseDown:function(event){
// don't let more than one widget handle mouseStart
if(mouseHandled){return}this._mouseMoved=false;
// we may have missed mouseup (out of window)
this._mouseStarted&&this._mouseUp(event);this._mouseDownEvent=event;var that=this,btnIsLeft=event.which===1,
// event.target.nodeName works around a bug in IE 8 with
// disabled inputs (#7620)
elIsCancel=typeof this.options.cancel==="string"&&event.target.nodeName?$(event.target).closest(this.options.cancel).length:false;if(!btnIsLeft||elIsCancel||!this._mouseCapture(event)){return true}this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){that.mouseDelayMet=true},this.options.delay)}if(this._mouseDistanceMet(event)&&this._mouseDelayMet(event)){this._mouseStarted=this._mouseStart(event)!==false;if(!this._mouseStarted){event.preventDefault();return true}}
// Click event may never have fired (Gecko & Opera)
if(true===$.data(event.target,this.widgetName+".preventClickEvent")){$.removeData(event.target,this.widgetName+".preventClickEvent")}
// these delegates are required to keep context
this._mouseMoveDelegate=function(event){return that._mouseMove(event)};this._mouseUpDelegate=function(event){return that._mouseUp(event)};this.document.bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);event.preventDefault();mouseHandled=true;return true},_mouseMove:function(event){
// Only check for mouseups outside the document if you've moved inside the document
// at least once. This prevents the firing of mouseup in the case of IE<9, which will
// fire a mousemove event if content is placed under the cursor. See #7778
// Support: IE <9
if(this._mouseMoved){
// IE mouseup check - mouseup happened when mouse was out of window
if($.ui.ie&&(!document.documentMode||document.documentMode<9)&&!event.button){return this._mouseUp(event);
// Iframe mouseup check - mouseup occurred in another document
}else if(!event.which){return this._mouseUp(event)}}if(event.which||event.button){this._mouseMoved=true}if(this._mouseStarted){this._mouseDrag(event);return event.preventDefault()}if(this._mouseDistanceMet(event)&&this._mouseDelayMet(event)){this._mouseStarted=this._mouseStart(this._mouseDownEvent,event)!==false;this._mouseStarted?this._mouseDrag(event):this._mouseUp(event)}return!this._mouseStarted},_mouseUp:function(event){this.document.unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;if(event.target===this._mouseDownEvent.target){$.data(event.target,this.widgetName+".preventClickEvent",true)}this._mouseStop(event)}mouseHandled=false;return false},_mouseDistanceMet:function(event){return Math.max(Math.abs(this._mouseDownEvent.pageX-event.pageX),Math.abs(this._mouseDownEvent.pageY-event.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},
// These are placeholder methods, to be overriden by extending plugin
_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return true}});
/*!
 * jQuery UI Position 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/position/
 */
(function(){$.ui=$.ui||{};var cachedScrollbarWidth,supportsOffsetFractions,max=Math.max,abs=Math.abs,round=Math.round,rhorizontal=/left|center|right/,rvertical=/top|center|bottom/,roffset=/[\+\-]\d+(\.[\d]+)?%?/,rposition=/^\w+/,rpercent=/%$/,_position=$.fn.position;function getOffsets(offsets,width,height){return[parseFloat(offsets[0])*(rpercent.test(offsets[0])?width/100:1),parseFloat(offsets[1])*(rpercent.test(offsets[1])?height/100:1)]}function parseCss(element,property){return parseInt($.css(element,property),10)||0}function getDimensions(elem){var raw=elem[0];if(raw.nodeType===9){return{width:elem.width(),height:elem.height(),offset:{top:0,left:0}}}if($.isWindow(raw)){return{width:elem.width(),height:elem.height(),offset:{top:elem.scrollTop(),left:elem.scrollLeft()}}}if(raw.preventDefault){return{width:0,height:0,offset:{top:raw.pageY,left:raw.pageX}}}return{width:elem.outerWidth(),height:elem.outerHeight(),offset:elem.offset()}}$.position={scrollbarWidth:function(){if(cachedScrollbarWidth!==undefined){return cachedScrollbarWidth}var w1,w2,div=$("<div style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>"),innerDiv=div.children()[0];$("body").append(div);w1=innerDiv.offsetWidth;div.css("overflow","scroll");w2=innerDiv.offsetWidth;if(w1===w2){w2=div[0].clientWidth}div.remove();return cachedScrollbarWidth=w1-w2},getScrollInfo:function(within){var overflowX=within.isWindow||within.isDocument?"":within.element.css("overflow-x"),overflowY=within.isWindow||within.isDocument?"":within.element.css("overflow-y"),hasOverflowX=overflowX==="scroll"||overflowX==="auto"&&within.width<within.element[0].scrollWidth,hasOverflowY=overflowY==="scroll"||overflowY==="auto"&&within.height<within.element[0].scrollHeight;return{width:hasOverflowY?$.position.scrollbarWidth():0,height:hasOverflowX?$.position.scrollbarWidth():0}},getWithinInfo:function(element){var withinElement=$(element||window),isWindow=$.isWindow(withinElement[0]),isDocument=!!withinElement[0]&&withinElement[0].nodeType===9;return{element:withinElement,isWindow:isWindow,isDocument:isDocument,offset:withinElement.offset()||{left:0,top:0},scrollLeft:withinElement.scrollLeft(),scrollTop:withinElement.scrollTop(),
// support: jQuery 1.6.x
// jQuery 1.6 doesn't support .outerWidth/Height() on documents or windows
width:isWindow||isDocument?withinElement.width():withinElement.outerWidth(),height:isWindow||isDocument?withinElement.height():withinElement.outerHeight()}}};$.fn.position=function(options){if(!options||!options.of){return _position.apply(this,arguments)}
// make a copy, we don't want to modify arguments
options=$.extend({},options);var atOffset,targetWidth,targetHeight,targetOffset,basePosition,dimensions,target=$(options.of),within=$.position.getWithinInfo(options.within),scrollInfo=$.position.getScrollInfo(within),collision=(options.collision||"flip").split(" "),offsets={};dimensions=getDimensions(target);if(target[0].preventDefault){
// force left top to allow flipping
options.at="left top"}targetWidth=dimensions.width;targetHeight=dimensions.height;targetOffset=dimensions.offset;
// clone to reuse original targetOffset later
basePosition=$.extend({},targetOffset);
// force my and at to have valid horizontal and vertical positions
// if a value is missing or invalid, it will be converted to center
$.each(["my","at"],function(){var pos=(options[this]||"").split(" "),horizontalOffset,verticalOffset;if(pos.length===1){pos=rhorizontal.test(pos[0])?pos.concat(["center"]):rvertical.test(pos[0])?["center"].concat(pos):["center","center"]}pos[0]=rhorizontal.test(pos[0])?pos[0]:"center";pos[1]=rvertical.test(pos[1])?pos[1]:"center";
// calculate offsets
horizontalOffset=roffset.exec(pos[0]);verticalOffset=roffset.exec(pos[1]);offsets[this]=[horizontalOffset?horizontalOffset[0]:0,verticalOffset?verticalOffset[0]:0];
// reduce to just the positions without the offsets
options[this]=[rposition.exec(pos[0])[0],rposition.exec(pos[1])[0]]});
// normalize collision option
if(collision.length===1){collision[1]=collision[0]}if(options.at[0]==="right"){basePosition.left+=targetWidth}else if(options.at[0]==="center"){basePosition.left+=targetWidth/2}if(options.at[1]==="bottom"){basePosition.top+=targetHeight}else if(options.at[1]==="center"){basePosition.top+=targetHeight/2}atOffset=getOffsets(offsets.at,targetWidth,targetHeight);basePosition.left+=atOffset[0];basePosition.top+=atOffset[1];return this.each(function(){var collisionPosition,using,elem=$(this),elemWidth=elem.outerWidth(),elemHeight=elem.outerHeight(),marginLeft=parseCss(this,"marginLeft"),marginTop=parseCss(this,"marginTop"),collisionWidth=elemWidth+marginLeft+parseCss(this,"marginRight")+scrollInfo.width,collisionHeight=elemHeight+marginTop+parseCss(this,"marginBottom")+scrollInfo.height,position=$.extend({},basePosition),myOffset=getOffsets(offsets.my,elem.outerWidth(),elem.outerHeight());if(options.my[0]==="right"){position.left-=elemWidth}else if(options.my[0]==="center"){position.left-=elemWidth/2}if(options.my[1]==="bottom"){position.top-=elemHeight}else if(options.my[1]==="center"){position.top-=elemHeight/2}position.left+=myOffset[0];position.top+=myOffset[1];
// if the browser doesn't support fractions, then round for consistent results
if(!supportsOffsetFractions){position.left=round(position.left);position.top=round(position.top)}collisionPosition={marginLeft:marginLeft,marginTop:marginTop};$.each(["left","top"],function(i,dir){if($.ui.position[collision[i]]){$.ui.position[collision[i]][dir](position,{targetWidth:targetWidth,targetHeight:targetHeight,elemWidth:elemWidth,elemHeight:elemHeight,collisionPosition:collisionPosition,collisionWidth:collisionWidth,collisionHeight:collisionHeight,offset:[atOffset[0]+myOffset[0],atOffset[1]+myOffset[1]],my:options.my,at:options.at,within:within,elem:elem})}});if(options.using){
// adds feedback as second argument to using callback, if present
using=function(props){var left=targetOffset.left-position.left,right=left+targetWidth-elemWidth,top=targetOffset.top-position.top,bottom=top+targetHeight-elemHeight,feedback={target:{element:target,left:targetOffset.left,top:targetOffset.top,width:targetWidth,height:targetHeight},element:{element:elem,left:position.left,top:position.top,width:elemWidth,height:elemHeight},horizontal:right<0?"left":left>0?"right":"center",vertical:bottom<0?"top":top>0?"bottom":"middle"};if(targetWidth<elemWidth&&abs(left+right)<targetWidth){feedback.horizontal="center"}if(targetHeight<elemHeight&&abs(top+bottom)<targetHeight){feedback.vertical="middle"}if(max(abs(left),abs(right))>max(abs(top),abs(bottom))){feedback.important="horizontal"}else{feedback.important="vertical"}options.using.call(this,props,feedback)}}elem.offset($.extend(position,{using:using}))})};$.ui.position={fit:{left:function(position,data){var within=data.within,withinOffset=within.isWindow?within.scrollLeft:within.offset.left,outerWidth=within.width,collisionPosLeft=position.left-data.collisionPosition.marginLeft,overLeft=withinOffset-collisionPosLeft,overRight=collisionPosLeft+data.collisionWidth-outerWidth-withinOffset,newOverRight;
// element is wider than within
if(data.collisionWidth>outerWidth){
// element is initially over the left side of within
if(overLeft>0&&overRight<=0){newOverRight=position.left+overLeft+data.collisionWidth-outerWidth-withinOffset;position.left+=overLeft-newOverRight;
// element is initially over right side of within
}else if(overRight>0&&overLeft<=0){position.left=withinOffset;
// element is initially over both left and right sides of within
}else{if(overLeft>overRight){position.left=withinOffset+outerWidth-data.collisionWidth}else{position.left=withinOffset}}
// too far left -> align with left edge
}else if(overLeft>0){position.left+=overLeft;
// too far right -> align with right edge
}else if(overRight>0){position.left-=overRight;
// adjust based on position and margin
}else{position.left=max(position.left-collisionPosLeft,position.left)}},top:function(position,data){var within=data.within,withinOffset=within.isWindow?within.scrollTop:within.offset.top,outerHeight=data.within.height,collisionPosTop=position.top-data.collisionPosition.marginTop,overTop=withinOffset-collisionPosTop,overBottom=collisionPosTop+data.collisionHeight-outerHeight-withinOffset,newOverBottom;
// element is taller than within
if(data.collisionHeight>outerHeight){
// element is initially over the top of within
if(overTop>0&&overBottom<=0){newOverBottom=position.top+overTop+data.collisionHeight-outerHeight-withinOffset;position.top+=overTop-newOverBottom;
// element is initially over bottom of within
}else if(overBottom>0&&overTop<=0){position.top=withinOffset;
// element is initially over both top and bottom of within
}else{if(overTop>overBottom){position.top=withinOffset+outerHeight-data.collisionHeight}else{position.top=withinOffset}}
// too far up -> align with top
}else if(overTop>0){position.top+=overTop;
// too far down -> align with bottom edge
}else if(overBottom>0){position.top-=overBottom;
// adjust based on position and margin
}else{position.top=max(position.top-collisionPosTop,position.top)}}},flip:{left:function(position,data){var within=data.within,withinOffset=within.offset.left+within.scrollLeft,outerWidth=within.width,offsetLeft=within.isWindow?within.scrollLeft:within.offset.left,collisionPosLeft=position.left-data.collisionPosition.marginLeft,overLeft=collisionPosLeft-offsetLeft,overRight=collisionPosLeft+data.collisionWidth-outerWidth-offsetLeft,myOffset=data.my[0]==="left"?-data.elemWidth:data.my[0]==="right"?data.elemWidth:0,atOffset=data.at[0]==="left"?data.targetWidth:data.at[0]==="right"?-data.targetWidth:0,offset=-2*data.offset[0],newOverRight,newOverLeft;if(overLeft<0){newOverRight=position.left+myOffset+atOffset+offset+data.collisionWidth-outerWidth-withinOffset;if(newOverRight<0||newOverRight<abs(overLeft)){position.left+=myOffset+atOffset+offset}}else if(overRight>0){newOverLeft=position.left-data.collisionPosition.marginLeft+myOffset+atOffset+offset-offsetLeft;if(newOverLeft>0||abs(newOverLeft)<overRight){position.left+=myOffset+atOffset+offset}}},top:function(position,data){var within=data.within,withinOffset=within.offset.top+within.scrollTop,outerHeight=within.height,offsetTop=within.isWindow?within.scrollTop:within.offset.top,collisionPosTop=position.top-data.collisionPosition.marginTop,overTop=collisionPosTop-offsetTop,overBottom=collisionPosTop+data.collisionHeight-outerHeight-offsetTop,top=data.my[1]==="top",myOffset=top?-data.elemHeight:data.my[1]==="bottom"?data.elemHeight:0,atOffset=data.at[1]==="top"?data.targetHeight:data.at[1]==="bottom"?-data.targetHeight:0,offset=-2*data.offset[1],newOverTop,newOverBottom;if(overTop<0){newOverBottom=position.top+myOffset+atOffset+offset+data.collisionHeight-outerHeight-withinOffset;if(newOverBottom<0||newOverBottom<abs(overTop)){position.top+=myOffset+atOffset+offset}}else if(overBottom>0){newOverTop=position.top-data.collisionPosition.marginTop+myOffset+atOffset+offset-offsetTop;if(newOverTop>0||abs(newOverTop)<overBottom){position.top+=myOffset+atOffset+offset}}}},flipfit:{left:function(){$.ui.position.flip.left.apply(this,arguments);$.ui.position.fit.left.apply(this,arguments)},top:function(){$.ui.position.flip.top.apply(this,arguments);$.ui.position.fit.top.apply(this,arguments)}}};
// fraction support test
(function(){var testElement,testElementParent,testElementStyle,offsetLeft,i,body=document.getElementsByTagName("body")[0],div=document.createElement("div");
//Create a "fake body" for testing based on method used in jQuery.support
testElement=document.createElement(body?"div":"body");testElementStyle={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"};if(body){$.extend(testElementStyle,{position:"absolute",left:"-1000px",top:"-1000px"})}for(i in testElementStyle){testElement.style[i]=testElementStyle[i]}testElement.appendChild(div);testElementParent=body||document.documentElement;testElementParent.insertBefore(testElement,testElementParent.firstChild);div.style.cssText="position: absolute; left: 10.7432222px;";offsetLeft=$(div).offset().left;supportsOffsetFractions=offsetLeft>10&&offsetLeft<11;testElement.innerHTML="";testElementParent.removeChild(testElement)})()})();var position=$.ui.position;
/*!
 * jQuery UI Datepicker 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/datepicker/
 */$.extend($.ui,{datepicker:{version:"1.11.4"}});var datepicker_instActive;function datepicker_getZindex(elem){var position,value;while(elem.length&&elem[0]!==document){
// Ignore z-index if position is set to a value where z-index is ignored by the browser
// This makes behavior of this function consistent across browsers
// WebKit always returns auto if the element is positioned
position=elem.css("position");if(position==="absolute"||position==="relative"||position==="fixed"){
// IE returns 0 when zIndex is not specified
// other browsers return a string
// we ignore the case of nested elements with an explicit value of 0
// <div style="z-index: -10;"><div style="z-index: 0;"></div></div>
value=parseInt(elem.css("zIndex"),10);if(!isNaN(value)&&value!==0){return value}}elem=elem.parent()}return 0}
/* Date picker manager.
   Use the singleton instance of this class, $.datepicker, to interact with the date picker.
   Settings for (groups of) date pickers are maintained in an instance object,
   allowing multiple different settings on the same page. */function Datepicker(){this._curInst=null;// The current instance in use
this._keyEvent=false;// If the last event was a key event
this._disabledInputs=[];// List of date picker inputs that have been disabled
this._datepickerShowing=false;// True if the popup picker is showing , false if not
this._inDialog=false;// True if showing within a "dialog", false if not
this._mainDivId="ui-datepicker-div";// The ID of the main datepicker division
this._inlineClass="ui-datepicker-inline";// The name of the inline marker class
this._appendClass="ui-datepicker-append";// The name of the append marker class
this._triggerClass="ui-datepicker-trigger";// The name of the trigger marker class
this._dialogClass="ui-datepicker-dialog";// The name of the dialog marker class
this._disableClass="ui-datepicker-disabled";// The name of the disabled covering marker class
this._unselectableClass="ui-datepicker-unselectable";// The name of the unselectable cell marker class
this._currentClass="ui-datepicker-current-day";// The name of the current day marker class
this._dayOverClass="ui-datepicker-days-cell-over";// The name of the day hover marker class
this.regional=[];// Available regional settings, indexed by language code
this.regional[""]={// Default regional settings
closeText:"Done",// Display text for close link
prevText:"Prev",// Display text for previous month link
nextText:"Next",// Display text for next month link
currentText:"Today",// Display text for current month link
monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],// Names of months for drop-down and formatting
monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],// For formatting
dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],// For formatting
dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],// For formatting
dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],// Column headings for days starting at Sunday
weekHeader:"Wk",// Column header for week of the year
dateFormat:"mm/dd/yy",// See format options on parseDate
firstDay:0,// The first day of the week, Sun = 0, Mon = 1, ...
isRTL:false,// True if right-to-left language, false if left-to-right
showMonthAfterYear:false,// True if the year select precedes month, false for month then year
yearSuffix:""};this._defaults={// Global defaults for all the date picker instances
showOn:"focus",// "focus" for popup on focus,
// "button" for trigger button, or "both" for either
showAnim:"fadeIn",// Name of jQuery animation for popup
showOptions:{},// Options for enhanced animations
defaultDate:null,// Used when field is blank: actual date,
// +/-number for offset from today, null for today
appendText:"",// Display text following the input box, e.g. showing the format
buttonText:"...",// Text for trigger button
buttonImage:"",// URL for trigger button image
buttonImageOnly:false,// True if the image appears alone, false if it appears on a button
hideIfNoPrevNext:false,// True to hide next/previous month links
// if not applicable, false to just disable them
navigationAsDateFormat:false,// True if date formatting applied to prev/today/next links
gotoCurrent:false,// True if today link goes back to current selection instead
changeMonth:false,// True if month can be selected directly, false if only prev/next
changeYear:false,// True if year can be selected directly, false if only prev/next
yearRange:"c-10:c+10",// Range of years to display in drop-down,
// either relative to today's year (-nn:+nn), relative to currently displayed year
// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)
showOtherMonths:false,// True to show dates in other months, false to leave blank
selectOtherMonths:false,// True to allow selection of dates in other months, false for unselectable
showWeek:false,// True to show week of the year, false to not show it
calculateWeek:this.iso8601Week,// How to calculate the week of the year,
// takes a Date and returns the number of the week for it
shortYearCutoff:"+10",// Short year values < this are in the current century,
// > this are in the previous century,
// string value starting with "+" for current year + value
minDate:null,// The earliest selectable date, or null for no limit
maxDate:null,// The latest selectable date, or null for no limit
duration:"fast",// Duration of display/closure
beforeShowDay:null,// Function that takes a date and returns an array with
// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or "",
// [2] = cell title (optional), e.g. $.datepicker.noWeekends
beforeShow:null,// Function that takes an input field and
// returns a set of custom settings for the date picker
onSelect:null,// Define a callback function when a date is selected
onChangeMonthYear:null,// Define a callback function when the month or year is changed
onClose:null,// Define a callback function when the datepicker is closed
numberOfMonths:1,// Number of months to show at a time
showCurrentAtPos:0,// The position in multipe months at which to show the current month (starting at 0)
stepMonths:1,// Number of months to step back/forward
stepBigMonths:12,// Number of months to step back/forward for the big links
altField:"",// Selector for an alternate field to store selected dates into
altFormat:"",// The date format to use for the alternate field
constrainInput:true,// The input is constrained by the current date format
showButtonPanel:false,// True to show button panel, false to not show it
autoSize:false,// True to size the input for the date format, false to leave as is
disabled:false};$.extend(this._defaults,this.regional[""]);this.regional.en=$.extend(true,{},this.regional[""]);this.regional["en-US"]=$.extend(true,{},this.regional.en);this.dpDiv=datepicker_bindHover($("<div id='"+this._mainDivId+"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>"))}$.extend(Datepicker.prototype,{
/* Class name added to elements to indicate already configured with a date picker. */
markerClassName:"hasDatepicker",
//Keep track of the maximum number of rows displayed (see #7043)
maxRows:4,
// TODO rename to "widget" when switching to widget factory
_widgetDatepicker:function(){return this.dpDiv},
/* Override the default settings for all instances of the date picker.
     * @param  settings  object - the new settings to use as defaults (anonymous object)
     * @return the manager object
     */
setDefaults:function(settings){datepicker_extendRemove(this._defaults,settings||{});return this},
/* Attach the date picker to a jQuery selection.
     * @param  target   element - the target input field or division or span
     * @param  settings  object - the new settings to use for this date picker instance (anonymous)
     */
_attachDatepicker:function(target,settings){var nodeName,inline,inst;nodeName=target.nodeName.toLowerCase();inline=nodeName==="div"||nodeName==="span";if(!target.id){this.uuid+=1;target.id="dp"+this.uuid}inst=this._newInst($(target),inline);inst.settings=$.extend({},settings||{});if(nodeName==="input"){this._connectDatepicker(target,inst)}else if(inline){this._inlineDatepicker(target,inst)}},
/* Create a new instance object. */
_newInst:function(target,inline){var id=target[0].id.replace(/([^A-Za-z0-9_\-])/g,"\\\\$1");// escape jQuery meta chars
return{id:id,input:target,// associated target
selectedDay:0,selectedMonth:0,selectedYear:0,// current selection
drawMonth:0,drawYear:0,// month being drawn
inline:inline,// is datepicker inline or not
dpDiv:!inline?this.dpDiv:// presentation div
datepicker_bindHover($("<div class='"+this._inlineClass+" ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>"))}},
/* Attach the date picker to an input field. */
_connectDatepicker:function(target,inst){var input=$(target);inst.append=$([]);inst.trigger=$([]);if(input.hasClass(this.markerClassName)){return}this._attachments(input,inst);input.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp);this._autoSize(inst);$.data(target,"datepicker",inst);
//If disabled option is true, disable the datepicker once it has been attached to the input (see ticket #5665)
if(inst.settings.disabled){this._disableDatepicker(target)}},
/* Make attachments based on settings. */
_attachments:function(input,inst){var showOn,buttonText,buttonImage,appendText=this._get(inst,"appendText"),isRTL=this._get(inst,"isRTL");if(inst.append){inst.append.remove()}if(appendText){inst.append=$("<span class='"+this._appendClass+"'>"+appendText+"</span>");input[isRTL?"before":"after"](inst.append)}input.unbind("focus",this._showDatepicker);if(inst.trigger){inst.trigger.remove()}showOn=this._get(inst,"showOn");if(showOn==="focus"||showOn==="both"){// pop-up date picker when in the marked field
input.focus(this._showDatepicker)}if(showOn==="button"||showOn==="both"){// pop-up date picker when button clicked
buttonText=this._get(inst,"buttonText");buttonImage=this._get(inst,"buttonImage");inst.trigger=$(this._get(inst,"buttonImageOnly")?$("<img/>").addClass(this._triggerClass).attr({src:buttonImage,alt:buttonText,title:buttonText}):$("<button type='button'></button>").addClass(this._triggerClass).html(!buttonImage?buttonText:$("<img/>").attr({src:buttonImage,alt:buttonText,title:buttonText})));input[isRTL?"before":"after"](inst.trigger);inst.trigger.click(function(){if($.datepicker._datepickerShowing&&$.datepicker._lastInput===input[0]){$.datepicker._hideDatepicker()}else if($.datepicker._datepickerShowing&&$.datepicker._lastInput!==input[0]){$.datepicker._hideDatepicker();$.datepicker._showDatepicker(input[0])}else{$.datepicker._showDatepicker(input[0])}return false})}},
/* Apply the maximum length for the date format. */
_autoSize:function(inst){if(this._get(inst,"autoSize")&&!inst.inline){var findMax,max,maxI,i,date=new Date(2009,12-1,20),// Ensure double digits
dateFormat=this._get(inst,"dateFormat");if(dateFormat.match(/[DM]/)){findMax=function(names){max=0;maxI=0;for(i=0;i<names.length;i++){if(names[i].length>max){max=names[i].length;maxI=i}}return maxI};date.setMonth(findMax(this._get(inst,dateFormat.match(/MM/)?"monthNames":"monthNamesShort")));date.setDate(findMax(this._get(inst,dateFormat.match(/DD/)?"dayNames":"dayNamesShort"))+20-date.getDay())}inst.input.attr("size",this._formatDate(inst,date).length)}},
/* Attach an inline date picker to a div. */
_inlineDatepicker:function(target,inst){var divSpan=$(target);if(divSpan.hasClass(this.markerClassName)){return}divSpan.addClass(this.markerClassName).append(inst.dpDiv);$.data(target,"datepicker",inst);this._setDate(inst,this._getDefaultDate(inst),true);this._updateDatepicker(inst);this._updateAlternate(inst);
//If disabled option is true, disable the datepicker before showing it (see ticket #5665)
if(inst.settings.disabled){this._disableDatepicker(target)}
// Set display:block in place of inst.dpDiv.show() which won't work on disconnected elements
// http://bugs.jqueryui.com/ticket/7552 - A Datepicker created on a detached div has zero height
inst.dpDiv.css("display","block")},
/* Pop-up the date picker in a "dialog" box.
     * @param  input element - ignored
     * @param  date string or Date - the initial date to display
     * @param  onSelect  function - the function to call when a date is selected
     * @param  settings  object - update the dialog date picker instance's settings (anonymous object)
     * @param  pos int[2] - coordinates for the dialog's position within the screen or
     *                  event - with x/y coordinates or
     *                  leave empty for default (screen centre)
     * @return the manager object
     */
_dialogDatepicker:function(input,date,onSelect,settings,pos){var id,browserWidth,browserHeight,scrollX,scrollY,inst=this._dialogInst;// internal instance
if(!inst){this.uuid+=1;id="dp"+this.uuid;this._dialogInput=$("<input type='text' id='"+id+"' style='position: absolute; top: -100px; width: 0px;'/>");this._dialogInput.keydown(this._doKeyDown);$("body").append(this._dialogInput);inst=this._dialogInst=this._newInst(this._dialogInput,false);inst.settings={};$.data(this._dialogInput[0],"datepicker",inst)}datepicker_extendRemove(inst.settings,settings||{});date=date&&date.constructor===Date?this._formatDate(inst,date):date;this._dialogInput.val(date);this._pos=pos?pos.length?pos:[pos.pageX,pos.pageY]:null;if(!this._pos){browserWidth=document.documentElement.clientWidth;browserHeight=document.documentElement.clientHeight;scrollX=document.documentElement.scrollLeft||document.body.scrollLeft;scrollY=document.documentElement.scrollTop||document.body.scrollTop;this._pos=// should use actual width/height below
[browserWidth/2-100+scrollX,browserHeight/2-150+scrollY]}
// move input on screen for focus, but hidden behind dialog
this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px");inst.settings.onSelect=onSelect;this._inDialog=true;this.dpDiv.addClass(this._dialogClass);this._showDatepicker(this._dialogInput[0]);if($.blockUI){$.blockUI(this.dpDiv)}$.data(this._dialogInput[0],"datepicker",inst);return this},
/* Detach a datepicker from its control.
     * @param  target   element - the target input field or division or span
     */
_destroyDatepicker:function(target){var nodeName,$target=$(target),inst=$.data(target,"datepicker");if(!$target.hasClass(this.markerClassName)){return}nodeName=target.nodeName.toLowerCase();$.removeData(target,"datepicker");if(nodeName==="input"){inst.append.remove();inst.trigger.remove();$target.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)}else if(nodeName==="div"||nodeName==="span"){$target.removeClass(this.markerClassName).empty()}if(datepicker_instActive===inst){datepicker_instActive=null}},
/* Enable the date picker to a jQuery selection.
     * @param  target   element - the target input field or division or span
     */
_enableDatepicker:function(target){var nodeName,inline,$target=$(target),inst=$.data(target,"datepicker");if(!$target.hasClass(this.markerClassName)){return}nodeName=target.nodeName.toLowerCase();if(nodeName==="input"){target.disabled=false;inst.trigger.filter("button").each(function(){this.disabled=false}).end().filter("img").css({opacity:"1.0",cursor:""})}else if(nodeName==="div"||nodeName==="span"){inline=$target.children("."+this._inlineClass);inline.children().removeClass("ui-state-disabled");inline.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",false)}this._disabledInputs=$.map(this._disabledInputs,function(value){return value===target?null:value});// delete entry
},
/* Disable the date picker to a jQuery selection.
     * @param  target   element - the target input field or division or span
     */
_disableDatepicker:function(target){var nodeName,inline,$target=$(target),inst=$.data(target,"datepicker");if(!$target.hasClass(this.markerClassName)){return}nodeName=target.nodeName.toLowerCase();if(nodeName==="input"){target.disabled=true;inst.trigger.filter("button").each(function(){this.disabled=true}).end().filter("img").css({opacity:"0.5",cursor:"default"})}else if(nodeName==="div"||nodeName==="span"){inline=$target.children("."+this._inlineClass);inline.children().addClass("ui-state-disabled");inline.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",true)}this._disabledInputs=$.map(this._disabledInputs,function(value){return value===target?null:value});// delete entry
this._disabledInputs[this._disabledInputs.length]=target},
/* Is the first field in a jQuery collection disabled as a datepicker?
     * @param  target   element - the target input field or division or span
     * @return boolean - true if disabled, false if enabled
     */
_isDisabledDatepicker:function(target){if(!target){return false}for(var i=0;i<this._disabledInputs.length;i++){if(this._disabledInputs[i]===target){return true}}return false},
/* Retrieve the instance data for the target control.
     * @param  target  element - the target input field or division or span
     * @return  object - the associated instance data
     * @throws  error if a jQuery problem getting data
     */
_getInst:function(target){try{return $.data(target,"datepicker")}catch(err){throw"Missing instance data for this datepicker"}},
/* Update or retrieve the settings for a date picker attached to an input field or division.
     * @param  target  element - the target input field or division or span
     * @param  name object - the new settings to update or
     *              string - the name of the setting to change or retrieve,
     *              when retrieving also "all" for all instance settings or
     *              "defaults" for all global defaults
     * @param  value   any - the new value for the setting
     *              (omit if above is an object or to retrieve a value)
     */
_optionDatepicker:function(target,name,value){var settings,date,minDate,maxDate,inst=this._getInst(target);if(arguments.length===2&&typeof name==="string"){return name==="defaults"?$.extend({},$.datepicker._defaults):inst?name==="all"?$.extend({},inst.settings):this._get(inst,name):null}settings=name||{};if(typeof name==="string"){settings={};settings[name]=value}if(inst){if(this._curInst===inst){this._hideDatepicker()}date=this._getDateDatepicker(target,true);minDate=this._getMinMaxDate(inst,"min");maxDate=this._getMinMaxDate(inst,"max");datepicker_extendRemove(inst.settings,settings);
// reformat the old minDate/maxDate values if dateFormat changes and a new minDate/maxDate isn't provided
if(minDate!==null&&settings.dateFormat!==undefined&&settings.minDate===undefined){inst.settings.minDate=this._formatDate(inst,minDate)}if(maxDate!==null&&settings.dateFormat!==undefined&&settings.maxDate===undefined){inst.settings.maxDate=this._formatDate(inst,maxDate)}if("disabled"in settings){if(settings.disabled){this._disableDatepicker(target)}else{this._enableDatepicker(target)}}this._attachments($(target),inst);this._autoSize(inst);this._setDate(inst,date);this._updateAlternate(inst);this._updateDatepicker(inst)}},
// change method deprecated
_changeDatepicker:function(target,name,value){this._optionDatepicker(target,name,value)},
/* Redraw the date picker attached to an input field or division.
     * @param  target  element - the target input field or division or span
     */
_refreshDatepicker:function(target){var inst=this._getInst(target);if(inst){this._updateDatepicker(inst)}},
/* Set the dates for a jQuery selection.
     * @param  target element - the target input field or division or span
     * @param  date Date - the new date
     */
_setDateDatepicker:function(target,date){var inst=this._getInst(target);if(inst){this._setDate(inst,date);this._updateDatepicker(inst);this._updateAlternate(inst)}},
/* Get the date(s) for the first entry in a jQuery selection.
     * @param  target element - the target input field or division or span
     * @param  noDefault boolean - true if no default date is to be used
     * @return Date - the current date
     */
_getDateDatepicker:function(target,noDefault){var inst=this._getInst(target);if(inst&&!inst.inline){this._setDateFromField(inst,noDefault)}return inst?this._getDate(inst):null},
/* Handle keystrokes. */
_doKeyDown:function(event){var onSelect,dateStr,sel,inst=$.datepicker._getInst(event.target),handled=true,isRTL=inst.dpDiv.is(".ui-datepicker-rtl");inst._keyEvent=true;if($.datepicker._datepickerShowing){switch(event.keyCode){case 9:$.datepicker._hideDatepicker();handled=false;break;// hide on tab out
case 13:sel=$("td."+$.datepicker._dayOverClass+":not(."+$.datepicker._currentClass+")",inst.dpDiv);if(sel[0]){$.datepicker._selectDay(event.target,inst.selectedMonth,inst.selectedYear,sel[0])}onSelect=$.datepicker._get(inst,"onSelect");if(onSelect){dateStr=$.datepicker._formatDate(inst);
// trigger custom callback
onSelect.apply(inst.input?inst.input[0]:null,[dateStr,inst])}else{$.datepicker._hideDatepicker()}return false;// don't submit the form
case 27:$.datepicker._hideDatepicker();break;// hide on escape
case 33:$.datepicker._adjustDate(event.target,event.ctrlKey?-$.datepicker._get(inst,"stepBigMonths"):-$.datepicker._get(inst,"stepMonths"),"M");break;// previous month/year on page up/+ ctrl
case 34:$.datepicker._adjustDate(event.target,event.ctrlKey?+$.datepicker._get(inst,"stepBigMonths"):+$.datepicker._get(inst,"stepMonths"),"M");break;// next month/year on page down/+ ctrl
case 35:if(event.ctrlKey||event.metaKey){$.datepicker._clearDate(event.target)}handled=event.ctrlKey||event.metaKey;break;// clear on ctrl or command +end
case 36:if(event.ctrlKey||event.metaKey){$.datepicker._gotoToday(event.target)}handled=event.ctrlKey||event.metaKey;break;// current on ctrl or command +home
case 37:if(event.ctrlKey||event.metaKey){$.datepicker._adjustDate(event.target,isRTL?+1:-1,"D")}handled=event.ctrlKey||event.metaKey;
// -1 day on ctrl or command +left
if(event.originalEvent.altKey){$.datepicker._adjustDate(event.target,event.ctrlKey?-$.datepicker._get(inst,"stepBigMonths"):-$.datepicker._get(inst,"stepMonths"),"M")}
// next month/year on alt +left on Mac
break;case 38:if(event.ctrlKey||event.metaKey){$.datepicker._adjustDate(event.target,-7,"D")}handled=event.ctrlKey||event.metaKey;break;// -1 week on ctrl or command +up
case 39:if(event.ctrlKey||event.metaKey){$.datepicker._adjustDate(event.target,isRTL?-1:+1,"D")}handled=event.ctrlKey||event.metaKey;
// +1 day on ctrl or command +right
if(event.originalEvent.altKey){$.datepicker._adjustDate(event.target,event.ctrlKey?+$.datepicker._get(inst,"stepBigMonths"):+$.datepicker._get(inst,"stepMonths"),"M")}
// next month/year on alt +right
break;case 40:if(event.ctrlKey||event.metaKey){$.datepicker._adjustDate(event.target,+7,"D")}handled=event.ctrlKey||event.metaKey;break;// +1 week on ctrl or command +down
default:handled=false}}else if(event.keyCode===36&&event.ctrlKey){// display the date picker on ctrl+home
$.datepicker._showDatepicker(this)}else{handled=false}if(handled){event.preventDefault();event.stopPropagation()}},
/* Filter entered characters - based on date format. */
_doKeyPress:function(event){var chars,chr,inst=$.datepicker._getInst(event.target);if($.datepicker._get(inst,"constrainInput")){chars=$.datepicker._possibleChars($.datepicker._get(inst,"dateFormat"));chr=String.fromCharCode(event.charCode==null?event.keyCode:event.charCode);return event.ctrlKey||event.metaKey||(chr<" "||!chars||chars.indexOf(chr)>-1)}},
/* Synchronise manual entry and field/alternate field. */
_doKeyUp:function(event){var date,inst=$.datepicker._getInst(event.target);if(inst.input.val()!==inst.lastVal){try{date=$.datepicker.parseDate($.datepicker._get(inst,"dateFormat"),inst.input?inst.input.val():null,$.datepicker._getFormatConfig(inst));if(date){// only if valid
$.datepicker._setDateFromField(inst);$.datepicker._updateAlternate(inst);$.datepicker._updateDatepicker(inst)}}catch(err){}}return true},
/* Pop-up the date picker for a given input field.
     * If false returned from beforeShow event handler do not show.
     * @param  input  element - the input field attached to the date picker or
     *                  event - if triggered by focus
     */
_showDatepicker:function(input){input=input.target||input;if(input.nodeName.toLowerCase()!=="input"){// find from button/image trigger
input=$("input",input.parentNode)[0]}if($.datepicker._isDisabledDatepicker(input)||$.datepicker._lastInput===input){// already here
return}var inst,beforeShow,beforeShowSettings,isFixed,offset,showAnim,duration;inst=$.datepicker._getInst(input);if($.datepicker._curInst&&$.datepicker._curInst!==inst){$.datepicker._curInst.dpDiv.stop(true,true);if(inst&&$.datepicker._datepickerShowing){$.datepicker._hideDatepicker($.datepicker._curInst.input[0])}}beforeShow=$.datepicker._get(inst,"beforeShow");beforeShowSettings=beforeShow?beforeShow.apply(input,[input,inst]):{};if(beforeShowSettings===false){return}datepicker_extendRemove(inst.settings,beforeShowSettings);inst.lastVal=null;$.datepicker._lastInput=input;$.datepicker._setDateFromField(inst);if($.datepicker._inDialog){// hide cursor
input.value=""}if(!$.datepicker._pos){// position below input
$.datepicker._pos=$.datepicker._findPos(input);$.datepicker._pos[1]+=input.offsetHeight;// add the height
}isFixed=false;$(input).parents().each(function(){isFixed|=$(this).css("position")==="fixed";return!isFixed});offset={left:$.datepicker._pos[0],top:$.datepicker._pos[1]};$.datepicker._pos=null;
//to avoid flashes on Firefox
inst.dpDiv.empty();
// determine sizing offscreen
inst.dpDiv.css({position:"absolute",display:"block",top:"-1000px"});$.datepicker._updateDatepicker(inst);
// fix width for dynamic number of date pickers
// and adjust position before showing
offset=$.datepicker._checkOffset(inst,offset,isFixed);inst.dpDiv.css({position:$.datepicker._inDialog&&$.blockUI?"static":isFixed?"fixed":"absolute",display:"none",left:offset.left+"px",top:offset.top+"px"});if(!inst.inline){showAnim=$.datepicker._get(inst,"showAnim");duration=$.datepicker._get(inst,"duration");inst.dpDiv.css("z-index",datepicker_getZindex($(input))+1);$.datepicker._datepickerShowing=true;if($.effects&&$.effects.effect[showAnim]){inst.dpDiv.show(showAnim,$.datepicker._get(inst,"showOptions"),duration)}else{inst.dpDiv[showAnim||"show"](showAnim?duration:null)}if($.datepicker._shouldFocusInput(inst)){inst.input.focus()}$.datepicker._curInst=inst}},
/* Generate the date picker content. */
_updateDatepicker:function(inst){this.maxRows=4;//Reset the max number of rows being displayed (see #7043)
datepicker_instActive=inst;// for delegate hover events
inst.dpDiv.empty().append(this._generateHTML(inst));this._attachHandlers(inst);var origyearshtml,numMonths=this._getNumberOfMonths(inst),cols=numMonths[1],width=17,activeCell=inst.dpDiv.find("."+this._dayOverClass+" a");if(activeCell.length>0){datepicker_handleMouseover.apply(activeCell.get(0))}inst.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width("");if(cols>1){inst.dpDiv.addClass("ui-datepicker-multi-"+cols).css("width",width*cols+"em")}inst.dpDiv[(numMonths[0]!==1||numMonths[1]!==1?"add":"remove")+"Class"]("ui-datepicker-multi");inst.dpDiv[(this._get(inst,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl");if(inst===$.datepicker._curInst&&$.datepicker._datepickerShowing&&$.datepicker._shouldFocusInput(inst)){inst.input.focus()}
// deffered render of the years select (to avoid flashes on Firefox)
if(inst.yearshtml){origyearshtml=inst.yearshtml;setTimeout(function(){
//assure that inst.yearshtml didn't change.
if(origyearshtml===inst.yearshtml&&inst.yearshtml){inst.dpDiv.find("select.ui-datepicker-year:first").replaceWith(inst.yearshtml)}origyearshtml=inst.yearshtml=null},0)}},
// #6694 - don't focus the input if it's already focused
// this breaks the change event in IE
// Support: IE and jQuery <1.9
_shouldFocusInput:function(inst){return inst.input&&inst.input.is(":visible")&&!inst.input.is(":disabled")&&!inst.input.is(":focus")},
/* Check positioning to remain on screen. */
_checkOffset:function(inst,offset,isFixed){var dpWidth=inst.dpDiv.outerWidth(),dpHeight=inst.dpDiv.outerHeight(),inputWidth=inst.input?inst.input.outerWidth():0,inputHeight=inst.input?inst.input.outerHeight():0,viewWidth=document.documentElement.clientWidth+(isFixed?0:$(document).scrollLeft()),viewHeight=document.documentElement.clientHeight+(isFixed?0:$(document).scrollTop());offset.left-=this._get(inst,"isRTL")?dpWidth-inputWidth:0;offset.left-=isFixed&&offset.left===inst.input.offset().left?$(document).scrollLeft():0;offset.top-=isFixed&&offset.top===inst.input.offset().top+inputHeight?$(document).scrollTop():0;
// now check if datepicker is showing outside window viewport - move to a better place if so.
offset.left-=Math.min(offset.left,offset.left+dpWidth>viewWidth&&viewWidth>dpWidth?Math.abs(offset.left+dpWidth-viewWidth):0);offset.top-=Math.min(offset.top,offset.top+dpHeight>viewHeight&&viewHeight>dpHeight?Math.abs(dpHeight+inputHeight):0);return offset},
/* Find an object's position on the screen. */
_findPos:function(obj){var position,inst=this._getInst(obj),isRTL=this._get(inst,"isRTL");while(obj&&(obj.type==="hidden"||obj.nodeType!==1||$.expr.filters.hidden(obj))){obj=obj[isRTL?"previousSibling":"nextSibling"]}position=$(obj).offset();return[position.left,position.top]},
/* Hide the date picker from view.
     * @param  input  element - the input field attached to the date picker
     */
_hideDatepicker:function(input){var showAnim,duration,postProcess,onClose,inst=this._curInst;if(!inst||input&&inst!==$.data(input,"datepicker")){return}if(this._datepickerShowing){showAnim=this._get(inst,"showAnim");duration=this._get(inst,"duration");postProcess=function(){$.datepicker._tidyDialog(inst)};
// DEPRECATED: after BC for 1.8.x $.effects[ showAnim ] is not needed
if($.effects&&($.effects.effect[showAnim]||$.effects[showAnim])){inst.dpDiv.hide(showAnim,$.datepicker._get(inst,"showOptions"),duration,postProcess)}else{inst.dpDiv[showAnim==="slideDown"?"slideUp":showAnim==="fadeIn"?"fadeOut":"hide"](showAnim?duration:null,postProcess)}if(!showAnim){postProcess()}this._datepickerShowing=false;onClose=this._get(inst,"onClose");if(onClose){onClose.apply(inst.input?inst.input[0]:null,[inst.input?inst.input.val():"",inst])}this._lastInput=null;if(this._inDialog){this._dialogInput.css({position:"absolute",left:"0",top:"-100px"});if($.blockUI){$.unblockUI();$("body").append(this.dpDiv)}}this._inDialog=false}},
/* Tidy up after a dialog display. */
_tidyDialog:function(inst){inst.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},
/* Close date picker if clicked elsewhere. */
_checkExternalClick:function(event){if(!$.datepicker._curInst){return}var $target=$(event.target),inst=$.datepicker._getInst($target[0]);if($target[0].id!==$.datepicker._mainDivId&&$target.parents("#"+$.datepicker._mainDivId).length===0&&!$target.hasClass($.datepicker.markerClassName)&&!$target.closest("."+$.datepicker._triggerClass).length&&$.datepicker._datepickerShowing&&!($.datepicker._inDialog&&$.blockUI)||$target.hasClass($.datepicker.markerClassName)&&$.datepicker._curInst!==inst){$.datepicker._hideDatepicker()}},
/* Adjust one of the date sub-fields. */
_adjustDate:function(id,offset,period){var target=$(id),inst=this._getInst(target[0]);if(this._isDisabledDatepicker(target[0])){return}this._adjustInstDate(inst,offset+(period==="M"?this._get(inst,"showCurrentAtPos"):0),// undo positioning
period);this._updateDatepicker(inst)},
/* Action for current link. */
_gotoToday:function(id){var date,target=$(id),inst=this._getInst(target[0]);if(this._get(inst,"gotoCurrent")&&inst.currentDay){inst.selectedDay=inst.currentDay;inst.drawMonth=inst.selectedMonth=inst.currentMonth;inst.drawYear=inst.selectedYear=inst.currentYear}else{date=new Date;inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear()}this._notifyChange(inst);this._adjustDate(target)},
/* Action for selecting a new month/year. */
_selectMonthYear:function(id,select,period){var target=$(id),inst=this._getInst(target[0]);inst["selected"+(period==="M"?"Month":"Year")]=inst["draw"+(period==="M"?"Month":"Year")]=parseInt(select.options[select.selectedIndex].value,10);this._notifyChange(inst);this._adjustDate(target)},
/* Action for selecting a day. */
_selectDay:function(id,month,year,td){var inst,target=$(id);if($(td).hasClass(this._unselectableClass)||this._isDisabledDatepicker(target[0])){return}inst=this._getInst(target[0]);inst.selectedDay=inst.currentDay=$("a",td).html();inst.selectedMonth=inst.currentMonth=month;inst.selectedYear=inst.currentYear=year;this._selectDate(id,this._formatDate(inst,inst.currentDay,inst.currentMonth,inst.currentYear))},
/* Erase the input field and hide the date picker. */
_clearDate:function(id){var target=$(id);this._selectDate(target,"")},
/* Update the input field with the selected date. */
_selectDate:function(id,dateStr){var onSelect,target=$(id),inst=this._getInst(target[0]);dateStr=dateStr!=null?dateStr:this._formatDate(inst);if(inst.input){inst.input.val(dateStr)}this._updateAlternate(inst);onSelect=this._get(inst,"onSelect");if(onSelect){onSelect.apply(inst.input?inst.input[0]:null,[dateStr,inst]);// trigger custom callback
}else if(inst.input){inst.input.trigger("change");// fire the change event
}if(inst.inline){this._updateDatepicker(inst)}else{this._hideDatepicker();this._lastInput=inst.input[0];if(typeof inst.input[0]!=="object"){inst.input.focus();// restore focus
}this._lastInput=null}},
/* Update any alternate field to synchronise with the main field. */
_updateAlternate:function(inst){var altFormat,date,dateStr,altField=this._get(inst,"altField");if(altField){// update alternate field too
altFormat=this._get(inst,"altFormat")||this._get(inst,"dateFormat");date=this._getDate(inst);dateStr=this.formatDate(altFormat,date,this._getFormatConfig(inst));$(altField).each(function(){$(this).val(dateStr)})}},
/* Set as beforeShowDay function to prevent selection of weekends.
     * @param  date  Date - the date to customise
     * @return [boolean, string] - is this date selectable?, what is its CSS class?
     */
noWeekends:function(date){var day=date.getDay();return[day>0&&day<6,""]},
/* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition.
     * @param  date  Date - the date to get the week for
     * @return  number - the number of the week within the year that contains this date
     */
iso8601Week:function(date){var time,checkDate=new Date(date.getTime());
// Find Thursday of this week starting on Monday
checkDate.setDate(checkDate.getDate()+4-(checkDate.getDay()||7));time=checkDate.getTime();checkDate.setMonth(0);// Compare with Jan 1
checkDate.setDate(1);return Math.floor(Math.round((time-checkDate)/864e5)/7)+1},
/* Parse a string value into a date object.
     * See formatDate below for the possible formats.
     *
     * @param  format string - the expected format of the date
     * @param  value string - the date in the above format
     * @param  settings Object - attributes include:
     *                  shortYearCutoff  number - the cutoff year for determining the century (optional)
     *                  dayNamesShort   string[7] - abbreviated names of the days from Sunday (optional)
     *                  dayNames        string[7] - names of the days from Sunday (optional)
     *                  monthNamesShort string[12] - abbreviated names of the months (optional)
     *                  monthNames      string[12] - names of the months (optional)
     * @return  Date - the extracted date value or null if value is blank
     */
parseDate:function(format,value,settings){if(format==null||value==null){throw"Invalid arguments"}value=typeof value==="object"?value.toString():value+"";if(value===""){return null}var iFormat,dim,extra,iValue=0,shortYearCutoffTemp=(settings?settings.shortYearCutoff:null)||this._defaults.shortYearCutoff,shortYearCutoff=typeof shortYearCutoffTemp!=="string"?shortYearCutoffTemp:(new Date).getFullYear()%100+parseInt(shortYearCutoffTemp,10),dayNamesShort=(settings?settings.dayNamesShort:null)||this._defaults.dayNamesShort,dayNames=(settings?settings.dayNames:null)||this._defaults.dayNames,monthNamesShort=(settings?settings.monthNamesShort:null)||this._defaults.monthNamesShort,monthNames=(settings?settings.monthNames:null)||this._defaults.monthNames,year=-1,month=-1,day=-1,doy=-1,literal=false,date,
// Check whether a format character is doubled
lookAhead=function(match){var matches=iFormat+1<format.length&&format.charAt(iFormat+1)===match;if(matches){iFormat++}return matches},
// Extract a number from the string value
getNumber=function(match){var isDoubled=lookAhead(match),size=match==="@"?14:match==="!"?20:match==="y"&&isDoubled?4:match==="o"?3:2,minSize=match==="y"?size:1,digits=new RegExp("^\\d{"+minSize+","+size+"}"),num=value.substring(iValue).match(digits);if(!num){throw"Missing number at position "+iValue}iValue+=num[0].length;return parseInt(num[0],10)},
// Extract a name from the string value and convert to an index
getName=function(match,shortNames,longNames){var index=-1,names=$.map(lookAhead(match)?longNames:shortNames,function(v,k){return[[k,v]]}).sort(function(a,b){return-(a[1].length-b[1].length)});$.each(names,function(i,pair){var name=pair[1];if(value.substr(iValue,name.length).toLowerCase()===name.toLowerCase()){index=pair[0];iValue+=name.length;return false}});if(index!==-1){return index+1}else{throw"Unknown name at position "+iValue}},
// Confirm that a literal character matches the string value
checkLiteral=function(){if(value.charAt(iValue)!==format.charAt(iFormat)){throw"Unexpected literal at position "+iValue}iValue++};for(iFormat=0;iFormat<format.length;iFormat++){if(literal){if(format.charAt(iFormat)==="'"&&!lookAhead("'")){literal=false}else{checkLiteral()}}else{switch(format.charAt(iFormat)){case"d":day=getNumber("d");break;case"D":getName("D",dayNamesShort,dayNames);break;case"o":doy=getNumber("o");break;case"m":month=getNumber("m");break;case"M":month=getName("M",monthNamesShort,monthNames);break;case"y":year=getNumber("y");break;case"@":date=new Date(getNumber("@"));year=date.getFullYear();month=date.getMonth()+1;day=date.getDate();break;case"!":date=new Date((getNumber("!")-this._ticksTo1970)/1e4);year=date.getFullYear();month=date.getMonth()+1;day=date.getDate();break;case"'":if(lookAhead("'")){checkLiteral()}else{literal=true}break;default:checkLiteral()}}}if(iValue<value.length){extra=value.substr(iValue);if(!/^\s+/.test(extra)){throw"Extra/unparsed characters found in date: "+extra}}if(year===-1){year=(new Date).getFullYear()}else if(year<100){year+=(new Date).getFullYear()-(new Date).getFullYear()%100+(year<=shortYearCutoff?0:-100)}if(doy>-1){month=1;day=doy;do{dim=this._getDaysInMonth(year,month-1);if(day<=dim){break}month++;day-=dim}while(true)}date=this._daylightSavingAdjust(new Date(year,month-1,day));if(date.getFullYear()!==year||date.getMonth()+1!==month||date.getDate()!==day){throw"Invalid date";// E.g. 31/02/00
}return date},
/* Standard date formats. */
ATOM:"yy-mm-dd",// RFC 3339 (ISO 8601)
COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",// RFC 822
TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",// ISO 8601
_ticksTo1970:((1970-1)*365+Math.floor(1970/4)-Math.floor(1970/100)+Math.floor(1970/400))*24*60*60*1e7,
/* Format a date object into a string value.
     * The format can be combinations of the following:
     * d  - day of month (no leading zero)
     * dd - day of month (two digit)
     * o  - day of year (no leading zeros)
     * oo - day of year (three digit)
     * D  - day name short
     * DD - day name long
     * m  - month of year (no leading zero)
     * mm - month of year (two digit)
     * M  - month name short
     * MM - month name long
     * y  - year (two digit)
     * yy - year (four digit)
     * @ - Unix timestamp (ms since 01/01/1970)
     * ! - Windows ticks (100ns since 01/01/0001)
     * "..." - literal text
     * '' - single quote
     *
     * @param  format string - the desired format of the date
     * @param  date Date - the date value to format
     * @param  settings Object - attributes include:
     *                  dayNamesShort   string[7] - abbreviated names of the days from Sunday (optional)
     *                  dayNames        string[7] - names of the days from Sunday (optional)
     *                  monthNamesShort string[12] - abbreviated names of the months (optional)
     *                  monthNames      string[12] - names of the months (optional)
     * @return  string - the date in the above format
     */
formatDate:function(format,date,settings){if(!date){return""}var iFormat,dayNamesShort=(settings?settings.dayNamesShort:null)||this._defaults.dayNamesShort,dayNames=(settings?settings.dayNames:null)||this._defaults.dayNames,monthNamesShort=(settings?settings.monthNamesShort:null)||this._defaults.monthNamesShort,monthNames=(settings?settings.monthNames:null)||this._defaults.monthNames,
// Check whether a format character is doubled
lookAhead=function(match){var matches=iFormat+1<format.length&&format.charAt(iFormat+1)===match;if(matches){iFormat++}return matches},
// Format a number, with leading zero if necessary
formatNumber=function(match,value,len){var num=""+value;if(lookAhead(match)){while(num.length<len){num="0"+num}}return num},
// Format a name, short or long as requested
formatName=function(match,value,shortNames,longNames){return lookAhead(match)?longNames[value]:shortNames[value]},output="",literal=false;if(date){for(iFormat=0;iFormat<format.length;iFormat++){if(literal){if(format.charAt(iFormat)==="'"&&!lookAhead("'")){literal=false}else{output+=format.charAt(iFormat)}}else{switch(format.charAt(iFormat)){case"d":output+=formatNumber("d",date.getDate(),2);break;case"D":output+=formatName("D",date.getDay(),dayNamesShort,dayNames);break;case"o":output+=formatNumber("o",Math.round((new Date(date.getFullYear(),date.getMonth(),date.getDate()).getTime()-new Date(date.getFullYear(),0,0).getTime())/864e5),3);break;case"m":output+=formatNumber("m",date.getMonth()+1,2);break;case"M":output+=formatName("M",date.getMonth(),monthNamesShort,monthNames);break;case"y":output+=lookAhead("y")?date.getFullYear():(date.getYear()%100<10?"0":"")+date.getYear()%100;break;case"@":output+=date.getTime();break;case"!":output+=date.getTime()*1e4+this._ticksTo1970;break;case"'":if(lookAhead("'")){output+="'"}else{literal=true}break;default:output+=format.charAt(iFormat)}}}}return output},
/* Extract all possible characters from the date format. */
_possibleChars:function(format){var iFormat,chars="",literal=false,
// Check whether a format character is doubled
lookAhead=function(match){var matches=iFormat+1<format.length&&format.charAt(iFormat+1)===match;if(matches){iFormat++}return matches};for(iFormat=0;iFormat<format.length;iFormat++){if(literal){if(format.charAt(iFormat)==="'"&&!lookAhead("'")){literal=false}else{chars+=format.charAt(iFormat)}}else{switch(format.charAt(iFormat)){case"d":case"m":case"y":case"@":chars+="0123456789";break;case"D":case"M":return null;// Accept anything
case"'":if(lookAhead("'")){chars+="'"}else{literal=true}break;default:chars+=format.charAt(iFormat)}}}return chars},
/* Get a setting value, defaulting if necessary. */
_get:function(inst,name){return inst.settings[name]!==undefined?inst.settings[name]:this._defaults[name]},
/* Parse existing date and initialise date picker. */
_setDateFromField:function(inst,noDefault){if(inst.input.val()===inst.lastVal){return}var dateFormat=this._get(inst,"dateFormat"),dates=inst.lastVal=inst.input?inst.input.val():null,defaultDate=this._getDefaultDate(inst),date=defaultDate,settings=this._getFormatConfig(inst);try{date=this.parseDate(dateFormat,dates,settings)||defaultDate}catch(event){dates=noDefault?"":dates}inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear();inst.currentDay=dates?date.getDate():0;inst.currentMonth=dates?date.getMonth():0;inst.currentYear=dates?date.getFullYear():0;this._adjustInstDate(inst)},
/* Retrieve the default date shown on opening. */
_getDefaultDate:function(inst){return this._restrictMinMax(inst,this._determineDate(inst,this._get(inst,"defaultDate"),new Date))},
/* A date may be specified as an exact value or a relative one. */
_determineDate:function(inst,date,defaultDate){var offsetNumeric=function(offset){var date=new Date;date.setDate(date.getDate()+offset);return date},offsetString=function(offset){try{return $.datepicker.parseDate($.datepicker._get(inst,"dateFormat"),offset,$.datepicker._getFormatConfig(inst))}catch(e){
// Ignore
}var date=(offset.toLowerCase().match(/^c/)?$.datepicker._getDate(inst):null)||new Date,year=date.getFullYear(),month=date.getMonth(),day=date.getDate(),pattern=/([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,matches=pattern.exec(offset);while(matches){switch(matches[2]||"d"){case"d":case"D":day+=parseInt(matches[1],10);break;case"w":case"W":day+=parseInt(matches[1],10)*7;break;case"m":case"M":month+=parseInt(matches[1],10);day=Math.min(day,$.datepicker._getDaysInMonth(year,month));break;case"y":case"Y":year+=parseInt(matches[1],10);day=Math.min(day,$.datepicker._getDaysInMonth(year,month));break}matches=pattern.exec(offset)}return new Date(year,month,day)},newDate=date==null||date===""?defaultDate:typeof date==="string"?offsetString(date):typeof date==="number"?isNaN(date)?defaultDate:offsetNumeric(date):new Date(date.getTime());newDate=newDate&&newDate.toString()==="Invalid Date"?defaultDate:newDate;if(newDate){newDate.setHours(0);newDate.setMinutes(0);newDate.setSeconds(0);newDate.setMilliseconds(0)}return this._daylightSavingAdjust(newDate)},
/* Handle switch to/from daylight saving.
     * Hours may be non-zero on daylight saving cut-over:
     * > 12 when midnight changeover, but then cannot generate
     * midnight datetime, so jump to 1AM, otherwise reset.
     * @param  date  (Date) the date to check
     * @return  (Date) the corrected date
     */
_daylightSavingAdjust:function(date){if(!date){return null}date.setHours(date.getHours()>12?date.getHours()+2:0);return date},
/* Set the date(s) directly. */
_setDate:function(inst,date,noChange){var clear=!date,origMonth=inst.selectedMonth,origYear=inst.selectedYear,newDate=this._restrictMinMax(inst,this._determineDate(inst,date,new Date));inst.selectedDay=inst.currentDay=newDate.getDate();inst.drawMonth=inst.selectedMonth=inst.currentMonth=newDate.getMonth();inst.drawYear=inst.selectedYear=inst.currentYear=newDate.getFullYear();if((origMonth!==inst.selectedMonth||origYear!==inst.selectedYear)&&!noChange){this._notifyChange(inst)}this._adjustInstDate(inst);if(inst.input){inst.input.val(clear?"":this._formatDate(inst))}},
/* Retrieve the date(s) directly. */
_getDate:function(inst){var startDate=!inst.currentYear||inst.input&&inst.input.val()===""?null:this._daylightSavingAdjust(new Date(inst.currentYear,inst.currentMonth,inst.currentDay));return startDate},
/* Attach the onxxx handlers.  These are declared statically so
     * they work with static code transformers like Caja.
     */
_attachHandlers:function(inst){var stepMonths=this._get(inst,"stepMonths"),id="#"+inst.id.replace(/\\\\/g,"\\");inst.dpDiv.find("[data-handler]").map(function(){var handler={prev:function(){$.datepicker._adjustDate(id,-stepMonths,"M")},next:function(){$.datepicker._adjustDate(id,+stepMonths,"M")},hide:function(){$.datepicker._hideDatepicker()},today:function(){$.datepicker._gotoToday(id)},selectDay:function(){$.datepicker._selectDay(id,+this.getAttribute("data-month"),+this.getAttribute("data-year"),this);return false},selectMonth:function(){$.datepicker._selectMonthYear(id,this,"M");return false},selectYear:function(){$.datepicker._selectMonthYear(id,this,"Y");return false}};$(this).bind(this.getAttribute("data-event"),handler[this.getAttribute("data-handler")])})},
/* Generate the HTML for the current state of the date picker. */
_generateHTML:function(inst){var maxDraw,prevText,prev,nextText,next,currentText,gotoDate,controls,buttonPanel,firstDay,showWeek,dayNames,dayNamesMin,monthNames,monthNamesShort,beforeShowDay,showOtherMonths,selectOtherMonths,defaultDate,html,dow,row,group,col,selectedDate,cornerClass,calender,thead,day,daysInMonth,leadDays,curRows,numRows,printDate,dRow,tbody,daySettings,otherMonth,unselectable,tempDate=new Date,today=this._daylightSavingAdjust(new Date(tempDate.getFullYear(),tempDate.getMonth(),tempDate.getDate())),// clear time
isRTL=this._get(inst,"isRTL"),showButtonPanel=this._get(inst,"showButtonPanel"),hideIfNoPrevNext=this._get(inst,"hideIfNoPrevNext"),navigationAsDateFormat=this._get(inst,"navigationAsDateFormat"),numMonths=this._getNumberOfMonths(inst),showCurrentAtPos=this._get(inst,"showCurrentAtPos"),stepMonths=this._get(inst,"stepMonths"),isMultiMonth=numMonths[0]!==1||numMonths[1]!==1,currentDate=this._daylightSavingAdjust(!inst.currentDay?new Date(9999,9,9):new Date(inst.currentYear,inst.currentMonth,inst.currentDay)),minDate=this._getMinMaxDate(inst,"min"),maxDate=this._getMinMaxDate(inst,"max"),drawMonth=inst.drawMonth-showCurrentAtPos,drawYear=inst.drawYear;if(drawMonth<0){drawMonth+=12;drawYear--}if(maxDate){maxDraw=this._daylightSavingAdjust(new Date(maxDate.getFullYear(),maxDate.getMonth()-numMonths[0]*numMonths[1]+1,maxDate.getDate()));maxDraw=minDate&&maxDraw<minDate?minDate:maxDraw;while(this._daylightSavingAdjust(new Date(drawYear,drawMonth,1))>maxDraw){drawMonth--;if(drawMonth<0){drawMonth=11;drawYear--}}}inst.drawMonth=drawMonth;inst.drawYear=drawYear;prevText=this._get(inst,"prevText");prevText=!navigationAsDateFormat?prevText:this.formatDate(prevText,this._daylightSavingAdjust(new Date(drawYear,drawMonth-stepMonths,1)),this._getFormatConfig(inst));prev=this._canAdjustMonth(inst,-1,drawYear,drawMonth)?"<a class='ui-datepicker-prev ui-corner-all' data-handler='prev' data-event='click'"+" title='"+prevText+"'><span class='ui-icon ui-icon-circle-triangle-"+(isRTL?"e":"w")+"'>"+prevText+"</span></a>":hideIfNoPrevNext?"":"<a class='ui-datepicker-prev ui-corner-all ui-state-disabled' title='"+prevText+"'><span class='ui-icon ui-icon-circle-triangle-"+(isRTL?"e":"w")+"'>"+prevText+"</span></a>";nextText=this._get(inst,"nextText");nextText=!navigationAsDateFormat?nextText:this.formatDate(nextText,this._daylightSavingAdjust(new Date(drawYear,drawMonth+stepMonths,1)),this._getFormatConfig(inst));next=this._canAdjustMonth(inst,+1,drawYear,drawMonth)?"<a class='ui-datepicker-next ui-corner-all' data-handler='next' data-event='click'"+" title='"+nextText+"'><span class='ui-icon ui-icon-circle-triangle-"+(isRTL?"w":"e")+"'>"+nextText+"</span></a>":hideIfNoPrevNext?"":"<a class='ui-datepicker-next ui-corner-all ui-state-disabled' title='"+nextText+"'><span class='ui-icon ui-icon-circle-triangle-"+(isRTL?"w":"e")+"'>"+nextText+"</span></a>";currentText=this._get(inst,"currentText");gotoDate=this._get(inst,"gotoCurrent")&&inst.currentDay?currentDate:today;currentText=!navigationAsDateFormat?currentText:this.formatDate(currentText,gotoDate,this._getFormatConfig(inst));controls=!inst.inline?"<button type='button' class='ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all' data-handler='hide' data-event='click'>"+this._get(inst,"closeText")+"</button>":"";buttonPanel=showButtonPanel?"<div class='ui-datepicker-buttonpane ui-widget-content'>"+(isRTL?controls:"")+(this._isInRange(inst,gotoDate)?"<button type='button' class='ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all' data-handler='today' data-event='click'"+">"+currentText+"</button>":"")+(isRTL?"":controls)+"</div>":"";firstDay=parseInt(this._get(inst,"firstDay"),10);firstDay=isNaN(firstDay)?0:firstDay;showWeek=this._get(inst,"showWeek");dayNames=this._get(inst,"dayNames");dayNamesMin=this._get(inst,"dayNamesMin");monthNames=this._get(inst,"monthNames");monthNamesShort=this._get(inst,"monthNamesShort");beforeShowDay=this._get(inst,"beforeShowDay");showOtherMonths=this._get(inst,"showOtherMonths");selectOtherMonths=this._get(inst,"selectOtherMonths");defaultDate=this._getDefaultDate(inst);html="";dow;for(row=0;row<numMonths[0];row++){group="";this.maxRows=4;for(col=0;col<numMonths[1];col++){selectedDate=this._daylightSavingAdjust(new Date(drawYear,drawMonth,inst.selectedDay));cornerClass=" ui-corner-all";calender="";if(isMultiMonth){calender+="<div class='ui-datepicker-group";if(numMonths[1]>1){switch(col){case 0:calender+=" ui-datepicker-group-first";cornerClass=" ui-corner-"+(isRTL?"right":"left");break;case numMonths[1]-1:calender+=" ui-datepicker-group-last";cornerClass=" ui-corner-"+(isRTL?"left":"right");break;default:calender+=" ui-datepicker-group-middle";cornerClass="";break}}calender+="'>"}calender+="<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix"+cornerClass+"'>"+(/all|left/.test(cornerClass)&&row===0?isRTL?next:prev:"")+(/all|right/.test(cornerClass)&&row===0?isRTL?prev:next:"")+this._generateMonthYearHeader(inst,drawMonth,drawYear,minDate,maxDate,row>0||col>0,monthNames,monthNamesShort)+// draw month headers
"</div><table class='ui-datepicker-calendar'><thead>"+"<tr>";thead=showWeek?"<th class='ui-datepicker-week-col'>"+this._get(inst,"weekHeader")+"</th>":"";for(dow=0;dow<7;dow++){// days of the week
day=(dow+firstDay)%7;thead+="<th scope='col'"+((dow+firstDay+6)%7>=5?" class='ui-datepicker-week-end'":"")+">"+"<span title='"+dayNames[day]+"'>"+dayNamesMin[day]+"</span></th>"}calender+=thead+"</tr></thead><tbody>";daysInMonth=this._getDaysInMonth(drawYear,drawMonth);if(drawYear===inst.selectedYear&&drawMonth===inst.selectedMonth){inst.selectedDay=Math.min(inst.selectedDay,daysInMonth)}leadDays=(this._getFirstDayOfMonth(drawYear,drawMonth)-firstDay+7)%7;curRows=Math.ceil((leadDays+daysInMonth)/7);// calculate the number of rows to generate
numRows=isMultiMonth?this.maxRows>curRows?this.maxRows:curRows:curRows;//If multiple months, use the higher number of rows (see #7043)
this.maxRows=numRows;printDate=this._daylightSavingAdjust(new Date(drawYear,drawMonth,1-leadDays));for(dRow=0;dRow<numRows;dRow++){// create date picker rows
calender+="<tr>";tbody=!showWeek?"":"<td class='ui-datepicker-week-col'>"+this._get(inst,"calculateWeek")(printDate)+"</td>";for(dow=0;dow<7;dow++){// create date picker days
daySettings=beforeShowDay?beforeShowDay.apply(inst.input?inst.input[0]:null,[printDate]):[true,""];otherMonth=printDate.getMonth()!==drawMonth;unselectable=otherMonth&&!selectOtherMonths||!daySettings[0]||minDate&&printDate<minDate||maxDate&&printDate>maxDate;tbody+="<td class='"+((dow+firstDay+6)%7>=5?" ui-datepicker-week-end":"")+(// highlight weekends
otherMonth?" ui-datepicker-other-month":"")+(// highlight days from other months
printDate.getTime()===selectedDate.getTime()&&drawMonth===inst.selectedMonth&&inst._keyEvent||// user pressed key
defaultDate.getTime()===printDate.getTime()&&defaultDate.getTime()===selectedDate.getTime()?
// or defaultDate is current printedDate and defaultDate is selectedDate
" "+this._dayOverClass:"")+(// highlight selected day
unselectable?" "+this._unselectableClass+" ui-state-disabled":"")+(// highlight unselectable days
otherMonth&&!showOtherMonths?"":" "+daySettings[1]+(// highlight custom dates
printDate.getTime()===currentDate.getTime()?" "+this._currentClass:"")+(// highlight selected day
printDate.getTime()===today.getTime()?" ui-datepicker-today":""))+"'"+(// highlight today (if different)
(!otherMonth||showOtherMonths)&&daySettings[2]?" title='"+daySettings[2].replace(/'/g,"&#39;")+"'":"")+(// cell title
unselectable?"":" data-handler='selectDay' data-event='click' data-month='"+printDate.getMonth()+"' data-year='"+printDate.getFullYear()+"'")+">"+(// actions
otherMonth&&!showOtherMonths?"&#xa0;":// display for other months
unselectable?"<span class='ui-state-default'>"+printDate.getDate()+"</span>":"<a class='ui-state-default"+(printDate.getTime()===today.getTime()?" ui-state-highlight":"")+(printDate.getTime()===currentDate.getTime()?" ui-state-active":"")+(// highlight selected day
otherMonth?" ui-priority-secondary":"")+// distinguish dates from other months
"' href='#'>"+printDate.getDate()+"</a>")+"</td>";// display selectable date
printDate.setDate(printDate.getDate()+1);printDate=this._daylightSavingAdjust(printDate)}calender+=tbody+"</tr>"}drawMonth++;if(drawMonth>11){drawMonth=0;drawYear++}calender+="</tbody></table>"+(isMultiMonth?"</div>"+(numMonths[0]>0&&col===numMonths[1]-1?"<div class='ui-datepicker-row-break'></div>":""):"");group+=calender}html+=group}html+=buttonPanel;inst._keyEvent=false;return html},
/* Generate the month and year header. */
_generateMonthYearHeader:function(inst,drawMonth,drawYear,minDate,maxDate,secondary,monthNames,monthNamesShort){var inMinYear,inMaxYear,month,years,thisYear,determineYear,year,endYear,changeMonth=this._get(inst,"changeMonth"),changeYear=this._get(inst,"changeYear"),showMonthAfterYear=this._get(inst,"showMonthAfterYear"),html="<div class='ui-datepicker-title'>",monthHtml="";
// month selection
if(secondary||!changeMonth){monthHtml+="<span class='ui-datepicker-month'>"+monthNames[drawMonth]+"</span>"}else{inMinYear=minDate&&minDate.getFullYear()===drawYear;inMaxYear=maxDate&&maxDate.getFullYear()===drawYear;monthHtml+="<select class='ui-datepicker-month' data-handler='selectMonth' data-event='change'>";for(month=0;month<12;month++){if((!inMinYear||month>=minDate.getMonth())&&(!inMaxYear||month<=maxDate.getMonth())){monthHtml+="<option value='"+month+"'"+(month===drawMonth?" selected='selected'":"")+">"+monthNamesShort[month]+"</option>"}}monthHtml+="</select>"}if(!showMonthAfterYear){html+=monthHtml+(secondary||!(changeMonth&&changeYear)?"&#xa0;":"")}
// year selection
if(!inst.yearshtml){inst.yearshtml="";if(secondary||!changeYear){html+="<span class='ui-datepicker-year'>"+drawYear+"</span>"}else{
// determine range of years to display
years=this._get(inst,"yearRange").split(":");thisYear=(new Date).getFullYear();determineYear=function(value){var year=value.match(/c[+\-].*/)?drawYear+parseInt(value.substring(1),10):value.match(/[+\-].*/)?thisYear+parseInt(value,10):parseInt(value,10);return isNaN(year)?thisYear:year};year=determineYear(years[0]);endYear=Math.max(year,determineYear(years[1]||""));year=minDate?Math.max(year,minDate.getFullYear()):year;endYear=maxDate?Math.min(endYear,maxDate.getFullYear()):endYear;inst.yearshtml+="<select class='ui-datepicker-year' data-handler='selectYear' data-event='change'>";for(;year<=endYear;year++){inst.yearshtml+="<option value='"+year+"'"+(year===drawYear?" selected='selected'":"")+">"+year+"</option>"}inst.yearshtml+="</select>";html+=inst.yearshtml;inst.yearshtml=null}}html+=this._get(inst,"yearSuffix");if(showMonthAfterYear){html+=(secondary||!(changeMonth&&changeYear)?"&#xa0;":"")+monthHtml}html+="</div>";// Close datepicker_header
return html},
/* Adjust one of the date sub-fields. */
_adjustInstDate:function(inst,offset,period){var year=inst.drawYear+(period==="Y"?offset:0),month=inst.drawMonth+(period==="M"?offset:0),day=Math.min(inst.selectedDay,this._getDaysInMonth(year,month))+(period==="D"?offset:0),date=this._restrictMinMax(inst,this._daylightSavingAdjust(new Date(year,month,day)));inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear();if(period==="M"||period==="Y"){this._notifyChange(inst)}},
/* Ensure a date is within any min/max bounds. */
_restrictMinMax:function(inst,date){var minDate=this._getMinMaxDate(inst,"min"),maxDate=this._getMinMaxDate(inst,"max"),newDate=minDate&&date<minDate?minDate:date;return maxDate&&newDate>maxDate?maxDate:newDate},
/* Notify change of month/year. */
_notifyChange:function(inst){var onChange=this._get(inst,"onChangeMonthYear");if(onChange){onChange.apply(inst.input?inst.input[0]:null,[inst.selectedYear,inst.selectedMonth+1,inst])}},
/* Determine the number of months to show. */
_getNumberOfMonths:function(inst){var numMonths=this._get(inst,"numberOfMonths");return numMonths==null?[1,1]:typeof numMonths==="number"?[1,numMonths]:numMonths},
/* Determine the current maximum date - ensure no time components are set. */
_getMinMaxDate:function(inst,minMax){return this._determineDate(inst,this._get(inst,minMax+"Date"),null)},
/* Find the number of days in a given month. */
_getDaysInMonth:function(year,month){return 32-this._daylightSavingAdjust(new Date(year,month,32)).getDate()},
/* Find the day of the week of the first of a month. */
_getFirstDayOfMonth:function(year,month){return new Date(year,month,1).getDay()},
/* Determines if we should allow a "next/prev" month display change. */
_canAdjustMonth:function(inst,offset,curYear,curMonth){var numMonths=this._getNumberOfMonths(inst),date=this._daylightSavingAdjust(new Date(curYear,curMonth+(offset<0?offset:numMonths[0]*numMonths[1]),1));if(offset<0){date.setDate(this._getDaysInMonth(date.getFullYear(),date.getMonth()))}return this._isInRange(inst,date)},
/* Is the given date in the accepted range? */
_isInRange:function(inst,date){var yearSplit,currentYear,minDate=this._getMinMaxDate(inst,"min"),maxDate=this._getMinMaxDate(inst,"max"),minYear=null,maxYear=null,years=this._get(inst,"yearRange");if(years){yearSplit=years.split(":");currentYear=(new Date).getFullYear();minYear=parseInt(yearSplit[0],10);maxYear=parseInt(yearSplit[1],10);if(yearSplit[0].match(/[+\-].*/)){minYear+=currentYear}if(yearSplit[1].match(/[+\-].*/)){maxYear+=currentYear}}return(!minDate||date.getTime()>=minDate.getTime())&&(!maxDate||date.getTime()<=maxDate.getTime())&&(!minYear||date.getFullYear()>=minYear)&&(!maxYear||date.getFullYear()<=maxYear)},
/* Provide the configuration settings for formatting/parsing. */
_getFormatConfig:function(inst){var shortYearCutoff=this._get(inst,"shortYearCutoff");shortYearCutoff=typeof shortYearCutoff!=="string"?shortYearCutoff:(new Date).getFullYear()%100+parseInt(shortYearCutoff,10);return{shortYearCutoff:shortYearCutoff,dayNamesShort:this._get(inst,"dayNamesShort"),dayNames:this._get(inst,"dayNames"),monthNamesShort:this._get(inst,"monthNamesShort"),monthNames:this._get(inst,"monthNames")}},
/* Format the given date for display. */
_formatDate:function(inst,day,month,year){if(!day){inst.currentDay=inst.selectedDay;inst.currentMonth=inst.selectedMonth;inst.currentYear=inst.selectedYear}var date=day?typeof day==="object"?day:this._daylightSavingAdjust(new Date(year,month,day)):this._daylightSavingAdjust(new Date(inst.currentYear,inst.currentMonth,inst.currentDay));return this.formatDate(this._get(inst,"dateFormat"),date,this._getFormatConfig(inst))}});
/*
 * Bind hover events for datepicker elements.
 * Done via delegate so the binding only occurs once in the lifetime of the parent div.
 * Global datepicker_instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker.
 */function datepicker_bindHover(dpDiv){var selector="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return dpDiv.delegate(selector,"mouseout",function(){$(this).removeClass("ui-state-hover");if(this.className.indexOf("ui-datepicker-prev")!==-1){$(this).removeClass("ui-datepicker-prev-hover")}if(this.className.indexOf("ui-datepicker-next")!==-1){$(this).removeClass("ui-datepicker-next-hover")}}).delegate(selector,"mouseover",datepicker_handleMouseover)}function datepicker_handleMouseover(){if(!$.datepicker._isDisabledDatepicker(datepicker_instActive.inline?datepicker_instActive.dpDiv.parent()[0]:datepicker_instActive.input[0])){$(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover");$(this).addClass("ui-state-hover");if(this.className.indexOf("ui-datepicker-prev")!==-1){$(this).addClass("ui-datepicker-prev-hover")}if(this.className.indexOf("ui-datepicker-next")!==-1){$(this).addClass("ui-datepicker-next-hover")}}}
/* jQuery extend now ignores nulls! */function datepicker_extendRemove(target,props){$.extend(target,props);for(var name in props){if(props[name]==null){target[name]=props[name]}}return target}
/* Invoke the datepicker functionality.
   @param  options  string - a command, optionally followed by additional parameters or
                    Object - settings for attaching new datepicker functionality
   @return  jQuery object */$.fn.datepicker=function(options){
/* Verify an empty collection wasn't passed - Fixes #6976 */
if(!this.length){return this}
/* Initialise the date picker. */if(!$.datepicker.initialized){$(document).mousedown($.datepicker._checkExternalClick);$.datepicker.initialized=true}
/* Append datepicker main container to body if not exist. */if($("#"+$.datepicker._mainDivId).length===0){$("body").append($.datepicker.dpDiv)}var otherArgs=Array.prototype.slice.call(arguments,1);if(typeof options==="string"&&(options==="isDisabled"||options==="getDate"||options==="widget")){return $.datepicker["_"+options+"Datepicker"].apply($.datepicker,[this[0]].concat(otherArgs))}if(options==="option"&&arguments.length===2&&typeof arguments[1]==="string"){return $.datepicker["_"+options+"Datepicker"].apply($.datepicker,[this[0]].concat(otherArgs))}return this.each(function(){typeof options==="string"?$.datepicker["_"+options+"Datepicker"].apply($.datepicker,[this].concat(otherArgs)):$.datepicker._attachDatepicker(this,options)})};$.datepicker=new Datepicker;// singleton instance
$.datepicker.initialized=false;$.datepicker.uuid=(new Date).getTime();$.datepicker.version="1.11.4";var datepicker=$.datepicker;
/*!
 * jQuery UI Draggable 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/draggable/
 */$.widget("ui.draggable",$.ui.mouse,{version:"1.11.4",widgetEventPrefix:"drag",options:{addClasses:true,appendTo:"parent",axis:false,connectToSortable:false,containment:false,cursor:"auto",cursorAt:false,grid:false,handle:false,helper:"original",iframeFix:false,opacity:false,refreshPositions:false,revert:false,revertDuration:500,scope:"default",scroll:true,scrollSensitivity:20,scrollSpeed:20,snap:false,snapMode:"both",snapTolerance:20,stack:false,zIndex:false,
// callbacks
drag:null,start:null,stop:null},_create:function(){if(this.options.helper==="original"){this._setPositionRelative()}if(this.options.addClasses){this.element.addClass("ui-draggable")}if(this.options.disabled){this.element.addClass("ui-draggable-disabled")}this._setHandleClassName();this._mouseInit()},_setOption:function(key,value){this._super(key,value);if(key==="handle"){this._removeHandleClassName();this._setHandleClassName()}},_destroy:function(){if((this.helper||this.element).is(".ui-draggable-dragging")){this.destroyOnClear=true;return}this.element.removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled");this._removeHandleClassName();this._mouseDestroy()},_mouseCapture:function(event){var o=this.options;this._blurActiveElement(event);
// among others, prevent a drag on a resizable-handle
if(this.helper||o.disabled||$(event.target).closest(".ui-resizable-handle").length>0){return false}
//Quit if we're not on a valid handle
this.handle=this._getHandle(event);if(!this.handle){return false}this._blockFrames(o.iframeFix===true?"iframe":o.iframeFix);return true},_blockFrames:function(selector){this.iframeBlocks=this.document.find(selector).map(function(){var iframe=$(this);return $("<div>").css("position","absolute").appendTo(iframe.parent()).outerWidth(iframe.outerWidth()).outerHeight(iframe.outerHeight()).offset(iframe.offset())[0]})},_unblockFrames:function(){if(this.iframeBlocks){this.iframeBlocks.remove();delete this.iframeBlocks}},_blurActiveElement:function(event){var document=this.document[0];
// Only need to blur if the event occurred on the draggable itself, see #10527
if(!this.handleElement.is(event.target)){return}
// support: IE9
// IE9 throws an "Unspecified error" accessing document.activeElement from an <iframe>
try{
// Support: IE9, IE10
// If the <body> is blurred, IE will switch windows, see #9520
if(document.activeElement&&document.activeElement.nodeName.toLowerCase()!=="body"){
// Blur any element that currently has focus, see #4261
$(document.activeElement).blur()}}catch(error){}},_mouseStart:function(event){var o=this.options;
//Create and append the visible helper
this.helper=this._createHelper(event);this.helper.addClass("ui-draggable-dragging");
//Cache the helper size
this._cacheHelperProportions();
//If ddmanager is used for droppables, set the global draggable
if($.ui.ddmanager){$.ui.ddmanager.current=this}
/*
		 * - Position generation -
		 * This block generates everything position related - it's the core of draggables.
		 */
//Cache the margins of the original element
this._cacheMargins();
//Store the helper's css position
this.cssPosition=this.helper.css("position");this.scrollParent=this.helper.scrollParent(true);this.offsetParent=this.helper.offsetParent();this.hasFixedAncestor=this.helper.parents().filter(function(){return $(this).css("position")==="fixed"}).length>0;
//The element's absolute position on the page minus margins
this.positionAbs=this.element.offset();this._refreshOffsets(event);
//Generate the original position
this.originalPosition=this.position=this._generatePosition(event,false);this.originalPageX=event.pageX;this.originalPageY=event.pageY;
//Adjust the mouse offset relative to the helper if "cursorAt" is supplied
o.cursorAt&&this._adjustOffsetFromHelper(o.cursorAt);
//Set a containment if given in the options
this._setContainment();
//Trigger event + callbacks
if(this._trigger("start",event)===false){this._clear();return false}
//Recache the helper size
this._cacheHelperProportions();
//Prepare the droppable offsets
if($.ui.ddmanager&&!o.dropBehaviour){$.ui.ddmanager.prepareOffsets(this,event)}
// Reset helper's right/bottom css if they're set and set explicit width/height instead
// as this prevents resizing of elements with right/bottom set (see #7772)
this._normalizeRightBottom();this._mouseDrag(event,true);//Execute the drag once - this causes the helper not to be visible before getting its correct position
//If the ddmanager is used for droppables, inform the manager that dragging has started (see #5003)
if($.ui.ddmanager){$.ui.ddmanager.dragStart(this,event)}return true},_refreshOffsets:function(event){this.offset={top:this.positionAbs.top-this.margins.top,left:this.positionAbs.left-this.margins.left,scroll:false,parent:this._getParentOffset(),relative:this._getRelativeOffset()};this.offset.click={left:event.pageX-this.offset.left,top:event.pageY-this.offset.top}},_mouseDrag:function(event,noPropagation){
// reset any necessary cached properties (see #5009)
if(this.hasFixedAncestor){this.offset.parent=this._getParentOffset()}
//Compute the helpers position
this.position=this._generatePosition(event,true);this.positionAbs=this._convertPositionTo("absolute");
//Call plugins and callbacks and use the resulting position if something is returned
if(!noPropagation){var ui=this._uiHash();if(this._trigger("drag",event,ui)===false){this._mouseUp({});return false}this.position=ui.position}this.helper[0].style.left=this.position.left+"px";this.helper[0].style.top=this.position.top+"px";if($.ui.ddmanager){$.ui.ddmanager.drag(this,event)}return false},_mouseStop:function(event){
//If we are using droppables, inform the manager about the drop
var that=this,dropped=false;if($.ui.ddmanager&&!this.options.dropBehaviour){dropped=$.ui.ddmanager.drop(this,event)}
//if a drop comes from outside (a sortable)
if(this.dropped){dropped=this.dropped;this.dropped=false}if(this.options.revert==="invalid"&&!dropped||this.options.revert==="valid"&&dropped||this.options.revert===true||$.isFunction(this.options.revert)&&this.options.revert.call(this.element,dropped)){$(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){if(that._trigger("stop",event)!==false){that._clear()}})}else{if(this._trigger("stop",event)!==false){this._clear()}}return false},_mouseUp:function(event){this._unblockFrames();
//If the ddmanager is used for droppables, inform the manager that dragging has stopped (see #5003)
if($.ui.ddmanager){$.ui.ddmanager.dragStop(this,event)}
// Only need to focus if the event occurred on the draggable itself, see #10527
if(this.handleElement.is(event.target)){
// The interaction is over; whether or not the click resulted in a drag, focus the element
this.element.focus()}return $.ui.mouse.prototype._mouseUp.call(this,event)},cancel:function(){if(this.helper.is(".ui-draggable-dragging")){this._mouseUp({})}else{this._clear()}return this},_getHandle:function(event){return this.options.handle?!!$(event.target).closest(this.element.find(this.options.handle)).length:true},_setHandleClassName:function(){this.handleElement=this.options.handle?this.element.find(this.options.handle):this.element;this.handleElement.addClass("ui-draggable-handle")},_removeHandleClassName:function(){this.handleElement.removeClass("ui-draggable-handle")},_createHelper:function(event){var o=this.options,helperIsFunction=$.isFunction(o.helper),helper=helperIsFunction?$(o.helper.apply(this.element[0],[event])):o.helper==="clone"?this.element.clone().removeAttr("id"):this.element;if(!helper.parents("body").length){helper.appendTo(o.appendTo==="parent"?this.element[0].parentNode:o.appendTo)}
// http://bugs.jqueryui.com/ticket/9446
// a helper function can return the original element
// which wouldn't have been set to relative in _create
if(helperIsFunction&&helper[0]===this.element[0]){this._setPositionRelative()}if(helper[0]!==this.element[0]&&!/(fixed|absolute)/.test(helper.css("position"))){helper.css("position","absolute")}return helper},_setPositionRelative:function(){if(!/^(?:r|a|f)/.test(this.element.css("position"))){this.element[0].style.position="relative"}},_adjustOffsetFromHelper:function(obj){if(typeof obj==="string"){obj=obj.split(" ")}if($.isArray(obj)){obj={left:+obj[0],top:+obj[1]||0}}if("left"in obj){this.offset.click.left=obj.left+this.margins.left}if("right"in obj){this.offset.click.left=this.helperProportions.width-obj.right+this.margins.left}if("top"in obj){this.offset.click.top=obj.top+this.margins.top}if("bottom"in obj){this.offset.click.top=this.helperProportions.height-obj.bottom+this.margins.top}},_isRootNode:function(element){return/(html|body)/i.test(element.tagName)||element===this.document[0]},_getParentOffset:function(){
//Get the offsetParent and cache its position
var po=this.offsetParent.offset(),document=this.document[0];
// This is a special case where we need to modify a offset calculated on start, since the following happened:
// 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
// 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
//    the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
if(this.cssPosition==="absolute"&&this.scrollParent[0]!==document&&$.contains(this.scrollParent[0],this.offsetParent[0])){po.left+=this.scrollParent.scrollLeft();po.top+=this.scrollParent.scrollTop()}if(this._isRootNode(this.offsetParent[0])){po={top:0,left:0}}return{top:po.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:po.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition!=="relative"){return{top:0,left:0}}var p=this.element.position(),scrollIsRootNode=this._isRootNode(this.scrollParent[0]);return{top:p.top-(parseInt(this.helper.css("top"),10)||0)+(!scrollIsRootNode?this.scrollParent.scrollTop():0),left:p.left-(parseInt(this.helper.css("left"),10)||0)+(!scrollIsRootNode?this.scrollParent.scrollLeft():0)}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var isUserScrollable,c,ce,o=this.options,document=this.document[0];this.relativeContainer=null;if(!o.containment){this.containment=null;return}if(o.containment==="window"){this.containment=[$(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,$(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,$(window).scrollLeft()+$(window).width()-this.helperProportions.width-this.margins.left,$(window).scrollTop()+($(window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];return}if(o.containment==="document"){this.containment=[0,0,$(document).width()-this.helperProportions.width-this.margins.left,($(document).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];return}if(o.containment.constructor===Array){this.containment=o.containment;return}if(o.containment==="parent"){o.containment=this.helper[0].parentNode}c=$(o.containment);ce=c[0];if(!ce){return}isUserScrollable=/(scroll|auto)/.test(c.css("overflow"));this.containment=[(parseInt(c.css("borderLeftWidth"),10)||0)+(parseInt(c.css("paddingLeft"),10)||0),(parseInt(c.css("borderTopWidth"),10)||0)+(parseInt(c.css("paddingTop"),10)||0),(isUserScrollable?Math.max(ce.scrollWidth,ce.offsetWidth):ce.offsetWidth)-(parseInt(c.css("borderRightWidth"),10)||0)-(parseInt(c.css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(isUserScrollable?Math.max(ce.scrollHeight,ce.offsetHeight):ce.offsetHeight)-(parseInt(c.css("borderBottomWidth"),10)||0)-(parseInt(c.css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom];this.relativeContainer=c},_convertPositionTo:function(d,pos){if(!pos){pos=this.position}var mod=d==="absolute"?1:-1,scrollIsRootNode=this._isRootNode(this.scrollParent[0]);return{top:pos.top+// The absolute mouse position
this.offset.relative.top*mod+// Only for relative positioned nodes: Relative offset from element to offset parent
this.offset.parent.top*mod-// The offsetParent's offset without borders (offset + border)
(this.cssPosition==="fixed"?-this.offset.scroll.top:scrollIsRootNode?0:this.offset.scroll.top)*mod,left:pos.left+// The absolute mouse position
this.offset.relative.left*mod+// Only for relative positioned nodes: Relative offset from element to offset parent
this.offset.parent.left*mod-// The offsetParent's offset without borders (offset + border)
(this.cssPosition==="fixed"?-this.offset.scroll.left:scrollIsRootNode?0:this.offset.scroll.left)*mod}},_generatePosition:function(event,constrainPosition){var containment,co,top,left,o=this.options,scrollIsRootNode=this._isRootNode(this.scrollParent[0]),pageX=event.pageX,pageY=event.pageY;
// Cache the scroll
if(!scrollIsRootNode||!this.offset.scroll){this.offset.scroll={top:this.scrollParent.scrollTop(),left:this.scrollParent.scrollLeft()}}
/*
		 * - Position constraining -
		 * Constrain the position to a mix of grid, containment.
		 */
// If we are not dragging yet, we won't check for options
if(constrainPosition){if(this.containment){if(this.relativeContainer){co=this.relativeContainer.offset();containment=[this.containment[0]+co.left,this.containment[1]+co.top,this.containment[2]+co.left,this.containment[3]+co.top]}else{containment=this.containment}if(event.pageX-this.offset.click.left<containment[0]){pageX=containment[0]+this.offset.click.left}if(event.pageY-this.offset.click.top<containment[1]){pageY=containment[1]+this.offset.click.top}if(event.pageX-this.offset.click.left>containment[2]){pageX=containment[2]+this.offset.click.left}if(event.pageY-this.offset.click.top>containment[3]){pageY=containment[3]+this.offset.click.top}}if(o.grid){
//Check for grid elements set to 0 to prevent divide by 0 error causing invalid argument errors in IE (see ticket #6950)
top=o.grid[1]?this.originalPageY+Math.round((pageY-this.originalPageY)/o.grid[1])*o.grid[1]:this.originalPageY;pageY=containment?top-this.offset.click.top>=containment[1]||top-this.offset.click.top>containment[3]?top:top-this.offset.click.top>=containment[1]?top-o.grid[1]:top+o.grid[1]:top;left=o.grid[0]?this.originalPageX+Math.round((pageX-this.originalPageX)/o.grid[0])*o.grid[0]:this.originalPageX;pageX=containment?left-this.offset.click.left>=containment[0]||left-this.offset.click.left>containment[2]?left:left-this.offset.click.left>=containment[0]?left-o.grid[0]:left+o.grid[0]:left}if(o.axis==="y"){pageX=this.originalPageX}if(o.axis==="x"){pageY=this.originalPageY}}return{top:pageY-// The absolute mouse position
this.offset.click.top-// Click offset (relative to the element)
this.offset.relative.top-// Only for relative positioned nodes: Relative offset from element to offset parent
this.offset.parent.top+(// The offsetParent's offset without borders (offset + border)
this.cssPosition==="fixed"?-this.offset.scroll.top:scrollIsRootNode?0:this.offset.scroll.top),left:pageX-// The absolute mouse position
this.offset.click.left-// Click offset (relative to the element)
this.offset.relative.left-// Only for relative positioned nodes: Relative offset from element to offset parent
this.offset.parent.left+(// The offsetParent's offset without borders (offset + border)
this.cssPosition==="fixed"?-this.offset.scroll.left:scrollIsRootNode?0:this.offset.scroll.left)}},_clear:function(){this.helper.removeClass("ui-draggable-dragging");if(this.helper[0]!==this.element[0]&&!this.cancelHelperRemoval){this.helper.remove()}this.helper=null;this.cancelHelperRemoval=false;if(this.destroyOnClear){this.destroy()}},_normalizeRightBottom:function(){if(this.options.axis!=="y"&&this.helper.css("right")!=="auto"){this.helper.width(this.helper.width());this.helper.css("right","auto")}if(this.options.axis!=="x"&&this.helper.css("bottom")!=="auto"){this.helper.height(this.helper.height());this.helper.css("bottom","auto")}},
// From now on bulk stuff - mainly helpers
_trigger:function(type,event,ui){ui=ui||this._uiHash();$.ui.plugin.call(this,type,[event,ui,this],true);
// Absolute position and offset (see #6884 ) have to be recalculated after plugins
if(/^(drag|start|stop)/.test(type)){this.positionAbs=this._convertPositionTo("absolute");ui.offset=this.positionAbs}return $.Widget.prototype._trigger.call(this,type,event,ui)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}});$.ui.plugin.add("draggable","connectToSortable",{start:function(event,ui,draggable){var uiSortable=$.extend({},ui,{item:draggable.element});draggable.sortables=[];$(draggable.options.connectToSortable).each(function(){var sortable=$(this).sortable("instance");if(sortable&&!sortable.options.disabled){draggable.sortables.push(sortable);
// refreshPositions is called at drag start to refresh the containerCache
// which is used in drag. This ensures it's initialized and synchronized
// with any changes that might have happened on the page since initialization.
sortable.refreshPositions();sortable._trigger("activate",event,uiSortable)}})},stop:function(event,ui,draggable){var uiSortable=$.extend({},ui,{item:draggable.element});draggable.cancelHelperRemoval=false;$.each(draggable.sortables,function(){var sortable=this;if(sortable.isOver){sortable.isOver=0;
// Allow this sortable to handle removing the helper
draggable.cancelHelperRemoval=true;sortable.cancelHelperRemoval=false;
// Use _storedCSS To restore properties in the sortable,
// as this also handles revert (#9675) since the draggable
// may have modified them in unexpected ways (#8809)
sortable._storedCSS={position:sortable.placeholder.css("position"),top:sortable.placeholder.css("top"),left:sortable.placeholder.css("left")};sortable._mouseStop(event);
// Once drag has ended, the sortable should return to using
// its original helper, not the shared helper from draggable
sortable.options.helper=sortable.options._helper}else{
// Prevent this Sortable from removing the helper.
// However, don't set the draggable to remove the helper
// either as another connected Sortable may yet handle the removal.
sortable.cancelHelperRemoval=true;sortable._trigger("deactivate",event,uiSortable)}})},drag:function(event,ui,draggable){$.each(draggable.sortables,function(){var innermostIntersecting=false,sortable=this;
// Copy over variables that sortable's _intersectsWith uses
sortable.positionAbs=draggable.positionAbs;sortable.helperProportions=draggable.helperProportions;sortable.offset.click=draggable.offset.click;if(sortable._intersectsWith(sortable.containerCache)){innermostIntersecting=true;$.each(draggable.sortables,function(){
// Copy over variables that sortable's _intersectsWith uses
this.positionAbs=draggable.positionAbs;this.helperProportions=draggable.helperProportions;this.offset.click=draggable.offset.click;if(this!==sortable&&this._intersectsWith(this.containerCache)&&$.contains(sortable.element[0],this.element[0])){innermostIntersecting=false}return innermostIntersecting})}if(innermostIntersecting){
// If it intersects, we use a little isOver variable and set it once,
// so that the move-in stuff gets fired only once.
if(!sortable.isOver){sortable.isOver=1;
// Store draggable's parent in case we need to reappend to it later.
draggable._parent=ui.helper.parent();sortable.currentItem=ui.helper.appendTo(sortable.element).data("ui-sortable-item",true);
// Store helper option to later restore it
sortable.options._helper=sortable.options.helper;sortable.options.helper=function(){return ui.helper[0]};
// Fire the start events of the sortable with our passed browser event,
// and our own helper (so it doesn't create a new one)
event.target=sortable.currentItem[0];sortable._mouseCapture(event,true);sortable._mouseStart(event,true,true);
// Because the browser event is way off the new appended portlet,
// modify necessary variables to reflect the changes
sortable.offset.click.top=draggable.offset.click.top;sortable.offset.click.left=draggable.offset.click.left;sortable.offset.parent.left-=draggable.offset.parent.left-sortable.offset.parent.left;sortable.offset.parent.top-=draggable.offset.parent.top-sortable.offset.parent.top;draggable._trigger("toSortable",event);
// Inform draggable that the helper is in a valid drop zone,
// used solely in the revert option to handle "valid/invalid".
draggable.dropped=sortable.element;
// Need to refreshPositions of all sortables in the case that
// adding to one sortable changes the location of the other sortables (#9675)
$.each(draggable.sortables,function(){this.refreshPositions()});
// hack so receive/update callbacks work (mostly)
draggable.currentItem=draggable.element;sortable.fromOutside=draggable}if(sortable.currentItem){sortable._mouseDrag(event);
// Copy the sortable's position because the draggable's can potentially reflect
// a relative position, while sortable is always absolute, which the dragged
// element has now become. (#8809)
ui.position=sortable.position}}else{
// If it doesn't intersect with the sortable, and it intersected before,
// we fake the drag stop of the sortable, but make sure it doesn't remove
// the helper by using cancelHelperRemoval.
if(sortable.isOver){sortable.isOver=0;sortable.cancelHelperRemoval=true;
// Calling sortable's mouseStop would trigger a revert,
// so revert must be temporarily false until after mouseStop is called.
sortable.options._revert=sortable.options.revert;sortable.options.revert=false;sortable._trigger("out",event,sortable._uiHash(sortable));sortable._mouseStop(event,true);
// restore sortable behaviors that were modfied
// when the draggable entered the sortable area (#9481)
sortable.options.revert=sortable.options._revert;sortable.options.helper=sortable.options._helper;if(sortable.placeholder){sortable.placeholder.remove()}
// Restore and recalculate the draggable's offset considering the sortable
// may have modified them in unexpected ways. (#8809, #10669)
ui.helper.appendTo(draggable._parent);draggable._refreshOffsets(event);ui.position=draggable._generatePosition(event,true);draggable._trigger("fromSortable",event);
// Inform draggable that the helper is no longer in a valid drop zone
draggable.dropped=false;
// Need to refreshPositions of all sortables just in case removing
// from one sortable changes the location of other sortables (#9675)
$.each(draggable.sortables,function(){this.refreshPositions()})}}})}});$.ui.plugin.add("draggable","cursor",{start:function(event,ui,instance){var t=$("body"),o=instance.options;if(t.css("cursor")){o._cursor=t.css("cursor")}t.css("cursor",o.cursor)},stop:function(event,ui,instance){var o=instance.options;if(o._cursor){$("body").css("cursor",o._cursor)}}});$.ui.plugin.add("draggable","opacity",{start:function(event,ui,instance){var t=$(ui.helper),o=instance.options;if(t.css("opacity")){o._opacity=t.css("opacity")}t.css("opacity",o.opacity)},stop:function(event,ui,instance){var o=instance.options;if(o._opacity){$(ui.helper).css("opacity",o._opacity)}}});$.ui.plugin.add("draggable","scroll",{start:function(event,ui,i){if(!i.scrollParentNotHidden){i.scrollParentNotHidden=i.helper.scrollParent(false)}if(i.scrollParentNotHidden[0]!==i.document[0]&&i.scrollParentNotHidden[0].tagName!=="HTML"){i.overflowOffset=i.scrollParentNotHidden.offset()}},drag:function(event,ui,i){var o=i.options,scrolled=false,scrollParent=i.scrollParentNotHidden[0],document=i.document[0];if(scrollParent!==document&&scrollParent.tagName!=="HTML"){if(!o.axis||o.axis!=="x"){if(i.overflowOffset.top+scrollParent.offsetHeight-event.pageY<o.scrollSensitivity){scrollParent.scrollTop=scrolled=scrollParent.scrollTop+o.scrollSpeed}else if(event.pageY-i.overflowOffset.top<o.scrollSensitivity){scrollParent.scrollTop=scrolled=scrollParent.scrollTop-o.scrollSpeed}}if(!o.axis||o.axis!=="y"){if(i.overflowOffset.left+scrollParent.offsetWidth-event.pageX<o.scrollSensitivity){scrollParent.scrollLeft=scrolled=scrollParent.scrollLeft+o.scrollSpeed}else if(event.pageX-i.overflowOffset.left<o.scrollSensitivity){scrollParent.scrollLeft=scrolled=scrollParent.scrollLeft-o.scrollSpeed}}}else{if(!o.axis||o.axis!=="x"){if(event.pageY-$(document).scrollTop()<o.scrollSensitivity){scrolled=$(document).scrollTop($(document).scrollTop()-o.scrollSpeed)}else if($(window).height()-(event.pageY-$(document).scrollTop())<o.scrollSensitivity){scrolled=$(document).scrollTop($(document).scrollTop()+o.scrollSpeed)}}if(!o.axis||o.axis!=="y"){if(event.pageX-$(document).scrollLeft()<o.scrollSensitivity){scrolled=$(document).scrollLeft($(document).scrollLeft()-o.scrollSpeed)}else if($(window).width()-(event.pageX-$(document).scrollLeft())<o.scrollSensitivity){scrolled=$(document).scrollLeft($(document).scrollLeft()+o.scrollSpeed)}}}if(scrolled!==false&&$.ui.ddmanager&&!o.dropBehaviour){$.ui.ddmanager.prepareOffsets(i,event)}}});$.ui.plugin.add("draggable","snap",{start:function(event,ui,i){var o=i.options;i.snapElements=[];$(o.snap.constructor!==String?o.snap.items||":data(ui-draggable)":o.snap).each(function(){var $t=$(this),$o=$t.offset();if(this!==i.element[0]){i.snapElements.push({item:this,width:$t.outerWidth(),height:$t.outerHeight(),top:$o.top,left:$o.left})}})},drag:function(event,ui,inst){var ts,bs,ls,rs,l,r,t,b,i,first,o=inst.options,d=o.snapTolerance,x1=ui.offset.left,x2=x1+inst.helperProportions.width,y1=ui.offset.top,y2=y1+inst.helperProportions.height;for(i=inst.snapElements.length-1;i>=0;i--){l=inst.snapElements[i].left-inst.margins.left;r=l+inst.snapElements[i].width;t=inst.snapElements[i].top-inst.margins.top;b=t+inst.snapElements[i].height;if(x2<l-d||x1>r+d||y2<t-d||y1>b+d||!$.contains(inst.snapElements[i].item.ownerDocument,inst.snapElements[i].item)){if(inst.snapElements[i].snapping){inst.options.snap.release&&inst.options.snap.release.call(inst.element,event,$.extend(inst._uiHash(),{snapItem:inst.snapElements[i].item}))}inst.snapElements[i].snapping=false;continue}if(o.snapMode!=="inner"){ts=Math.abs(t-y2)<=d;bs=Math.abs(b-y1)<=d;ls=Math.abs(l-x2)<=d;rs=Math.abs(r-x1)<=d;if(ts){ui.position.top=inst._convertPositionTo("relative",{top:t-inst.helperProportions.height,left:0}).top}if(bs){ui.position.top=inst._convertPositionTo("relative",{top:b,left:0}).top}if(ls){ui.position.left=inst._convertPositionTo("relative",{top:0,left:l-inst.helperProportions.width}).left}if(rs){ui.position.left=inst._convertPositionTo("relative",{top:0,left:r}).left}}first=ts||bs||ls||rs;if(o.snapMode!=="outer"){ts=Math.abs(t-y1)<=d;bs=Math.abs(b-y2)<=d;ls=Math.abs(l-x1)<=d;rs=Math.abs(r-x2)<=d;if(ts){ui.position.top=inst._convertPositionTo("relative",{top:t,left:0}).top}if(bs){ui.position.top=inst._convertPositionTo("relative",{top:b-inst.helperProportions.height,left:0}).top}if(ls){ui.position.left=inst._convertPositionTo("relative",{top:0,left:l}).left}if(rs){ui.position.left=inst._convertPositionTo("relative",{top:0,left:r-inst.helperProportions.width}).left}}if(!inst.snapElements[i].snapping&&(ts||bs||ls||rs||first)){inst.options.snap.snap&&inst.options.snap.snap.call(inst.element,event,$.extend(inst._uiHash(),{snapItem:inst.snapElements[i].item}))}inst.snapElements[i].snapping=ts||bs||ls||rs||first}}});$.ui.plugin.add("draggable","stack",{start:function(event,ui,instance){var min,o=instance.options,group=$.makeArray($(o.stack)).sort(function(a,b){return(parseInt($(a).css("zIndex"),10)||0)-(parseInt($(b).css("zIndex"),10)||0)});if(!group.length){return}min=parseInt($(group[0]).css("zIndex"),10)||0;$(group).each(function(i){$(this).css("zIndex",min+i)});this.css("zIndex",min+group.length)}});$.ui.plugin.add("draggable","zIndex",{start:function(event,ui,instance){var t=$(ui.helper),o=instance.options;if(t.css("zIndex")){o._zIndex=t.css("zIndex")}t.css("zIndex",o.zIndex)},stop:function(event,ui,instance){var o=instance.options;if(o._zIndex){$(ui.helper).css("zIndex",o._zIndex)}}});var draggable=$.ui.draggable;
/*!
 * jQuery UI Menu 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/menu/
 */var menu=$.widget("ui.menu",{version:"1.11.4",defaultElement:"<ul>",delay:300,options:{icons:{submenu:"ui-icon-carat-1-e"},items:"> *",menus:"ul",position:{my:"left-1 top",at:"right top"},role:"menu",
// callbacks
blur:null,focus:null,select:null},_create:function(){this.activeMenu=this.element;
// Flag used to prevent firing of the click handler
// as the event bubbles up through nested menus
this.mouseHandled=false;this.element.uniqueId().addClass("ui-menu ui-widget ui-widget-content").toggleClass("ui-menu-icons",!!this.element.find(".ui-icon").length).attr({role:this.options.role,tabIndex:0});if(this.options.disabled){this.element.addClass("ui-state-disabled").attr("aria-disabled","true")}this._on({
// Prevent focus from sticking to links inside menu after clicking
// them (focus should always stay on UL during navigation).
"mousedown .ui-menu-item":function(event){event.preventDefault()},"click .ui-menu-item":function(event){var target=$(event.target);if(!this.mouseHandled&&target.not(".ui-state-disabled").length){this.select(event);
// Only set the mouseHandled flag if the event will bubble, see #9469.
if(!event.isPropagationStopped()){this.mouseHandled=true}
// Open submenu on click
if(target.has(".ui-menu").length){this.expand(event)}else if(!this.element.is(":focus")&&$(this.document[0].activeElement).closest(".ui-menu").length){
// Redirect focus to the menu
this.element.trigger("focus",[true]);
// If the active item is on the top level, let it stay active.
// Otherwise, blur the active item since it is no longer visible.
if(this.active&&this.active.parents(".ui-menu").length===1){clearTimeout(this.timer)}}}},"mouseenter .ui-menu-item":function(event){
// Ignore mouse events while typeahead is active, see #10458.
// Prevents focusing the wrong item when typeahead causes a scroll while the mouse
// is over an item in the menu
if(this.previousFilter){return}var target=$(event.currentTarget);
// Remove ui-state-active class from siblings of the newly focused menu item
// to avoid a jump caused by adjacent elements both having a class with a border
target.siblings(".ui-state-active").removeClass("ui-state-active");this.focus(event,target)},mouseleave:"collapseAll","mouseleave .ui-menu":"collapseAll",focus:function(event,keepActiveItem){
// If there's already an active item, keep it active
// If not, activate the first item
var item=this.active||this.element.find(this.options.items).eq(0);if(!keepActiveItem){this.focus(event,item)}},blur:function(event){this._delay(function(){if(!$.contains(this.element[0],this.document[0].activeElement)){this.collapseAll(event)}})},keydown:"_keydown"});this.refresh();
// Clicks outside of a menu collapse any open menus
this._on(this.document,{click:function(event){if(this._closeOnDocumentClick(event)){this.collapseAll(event)}
// Reset the mouseHandled flag
this.mouseHandled=false}})},_destroy:function(){
// Destroy (sub)menus
this.element.removeAttr("aria-activedescendant").find(".ui-menu").addBack().removeClass("ui-menu ui-widget ui-widget-content ui-menu-icons ui-front").removeAttr("role").removeAttr("tabIndex").removeAttr("aria-labelledby").removeAttr("aria-expanded").removeAttr("aria-hidden").removeAttr("aria-disabled").removeUniqueId().show();
// Destroy menu items
this.element.find(".ui-menu-item").removeClass("ui-menu-item").removeAttr("role").removeAttr("aria-disabled").removeUniqueId().removeClass("ui-state-hover").removeAttr("tabIndex").removeAttr("role").removeAttr("aria-haspopup").children().each(function(){var elem=$(this);if(elem.data("ui-menu-submenu-carat")){elem.remove()}});
// Destroy menu dividers
this.element.find(".ui-menu-divider").removeClass("ui-menu-divider ui-widget-content")},_keydown:function(event){var match,prev,character,skip,preventDefault=true;switch(event.keyCode){case $.ui.keyCode.PAGE_UP:this.previousPage(event);break;case $.ui.keyCode.PAGE_DOWN:this.nextPage(event);break;case $.ui.keyCode.HOME:this._move("first","first",event);break;case $.ui.keyCode.END:this._move("last","last",event);break;case $.ui.keyCode.UP:this.previous(event);break;case $.ui.keyCode.DOWN:this.next(event);break;case $.ui.keyCode.LEFT:this.collapse(event);break;case $.ui.keyCode.RIGHT:if(this.active&&!this.active.is(".ui-state-disabled")){this.expand(event)}break;case $.ui.keyCode.ENTER:case $.ui.keyCode.SPACE:this._activate(event);break;case $.ui.keyCode.ESCAPE:this.collapse(event);break;default:preventDefault=false;prev=this.previousFilter||"";character=String.fromCharCode(event.keyCode);skip=false;clearTimeout(this.filterTimer);if(character===prev){skip=true}else{character=prev+character}match=this._filterMenuItems(character);match=skip&&match.index(this.active.next())!==-1?this.active.nextAll(".ui-menu-item"):match;
// If no matches on the current filter, reset to the last character pressed
// to move down the menu to the first item that starts with that character
if(!match.length){character=String.fromCharCode(event.keyCode);match=this._filterMenuItems(character)}if(match.length){this.focus(event,match);this.previousFilter=character;this.filterTimer=this._delay(function(){delete this.previousFilter},1e3)}else{delete this.previousFilter}}if(preventDefault){event.preventDefault()}},_activate:function(event){if(!this.active.is(".ui-state-disabled")){if(this.active.is("[aria-haspopup='true']")){this.expand(event)}else{this.select(event)}}},refresh:function(){var menus,items,that=this,icon=this.options.icons.submenu,submenus=this.element.find(this.options.menus);this.element.toggleClass("ui-menu-icons",!!this.element.find(".ui-icon").length);
// Initialize nested menus
submenus.filter(":not(.ui-menu)").addClass("ui-menu ui-widget ui-widget-content ui-front").hide().attr({role:this.options.role,"aria-hidden":"true","aria-expanded":"false"}).each(function(){var menu=$(this),item=menu.parent(),submenuCarat=$("<span>").addClass("ui-menu-icon ui-icon "+icon).data("ui-menu-submenu-carat",true);item.attr("aria-haspopup","true").prepend(submenuCarat);menu.attr("aria-labelledby",item.attr("id"))});menus=submenus.add(this.element);items=menus.find(this.options.items);
// Initialize menu-items containing spaces and/or dashes only as dividers
items.not(".ui-menu-item").each(function(){var item=$(this);if(that._isDivider(item)){item.addClass("ui-widget-content ui-menu-divider")}});
// Don't refresh list items that are already adapted
items.not(".ui-menu-item, .ui-menu-divider").addClass("ui-menu-item").uniqueId().attr({tabIndex:-1,role:this._itemRole()});
// Add aria-disabled attribute to any disabled menu item
items.filter(".ui-state-disabled").attr("aria-disabled","true");
// If the active item has been removed, blur the menu
if(this.active&&!$.contains(this.element[0],this.active[0])){this.blur()}},_itemRole:function(){return{menu:"menuitem",listbox:"option"}[this.options.role]},_setOption:function(key,value){if(key==="icons"){this.element.find(".ui-menu-icon").removeClass(this.options.icons.submenu).addClass(value.submenu)}if(key==="disabled"){this.element.toggleClass("ui-state-disabled",!!value).attr("aria-disabled",value)}this._super(key,value)},focus:function(event,item){var nested,focused;this.blur(event,event&&event.type==="focus");this._scrollIntoView(item);this.active=item.first();focused=this.active.addClass("ui-state-focus").removeClass("ui-state-active");
// Only update aria-activedescendant if there's a role
// otherwise we assume focus is managed elsewhere
if(this.options.role){this.element.attr("aria-activedescendant",focused.attr("id"))}
// Highlight active parent menu item, if any
this.active.parent().closest(".ui-menu-item").addClass("ui-state-active");if(event&&event.type==="keydown"){this._close()}else{this.timer=this._delay(function(){this._close()},this.delay)}nested=item.children(".ui-menu");if(nested.length&&event&&/^mouse/.test(event.type)){this._startOpening(nested)}this.activeMenu=item.parent();this._trigger("focus",event,{item:item})},_scrollIntoView:function(item){var borderTop,paddingTop,offset,scroll,elementHeight,itemHeight;if(this._hasScroll()){borderTop=parseFloat($.css(this.activeMenu[0],"borderTopWidth"))||0;paddingTop=parseFloat($.css(this.activeMenu[0],"paddingTop"))||0;offset=item.offset().top-this.activeMenu.offset().top-borderTop-paddingTop;scroll=this.activeMenu.scrollTop();elementHeight=this.activeMenu.height();itemHeight=item.outerHeight();if(offset<0){this.activeMenu.scrollTop(scroll+offset)}else if(offset+itemHeight>elementHeight){this.activeMenu.scrollTop(scroll+offset-elementHeight+itemHeight)}}},blur:function(event,fromFocus){if(!fromFocus){clearTimeout(this.timer)}if(!this.active){return}this.active.removeClass("ui-state-focus");this.active=null;this._trigger("blur",event,{item:this.active})},_startOpening:function(submenu){clearTimeout(this.timer);
// Don't open if already open fixes a Firefox bug that caused a .5 pixel
// shift in the submenu position when mousing over the carat icon
if(submenu.attr("aria-hidden")!=="true"){return}this.timer=this._delay(function(){this._close();this._open(submenu)},this.delay)},_open:function(submenu){var position=$.extend({of:this.active},this.options.position);clearTimeout(this.timer);this.element.find(".ui-menu").not(submenu.parents(".ui-menu")).hide().attr("aria-hidden","true");submenu.show().removeAttr("aria-hidden").attr("aria-expanded","true").position(position)},collapseAll:function(event,all){clearTimeout(this.timer);this.timer=this._delay(function(){
// If we were passed an event, look for the submenu that contains the event
var currentMenu=all?this.element:$(event&&event.target).closest(this.element.find(".ui-menu"));
// If we found no valid submenu ancestor, use the main menu to close all sub menus anyway
if(!currentMenu.length){currentMenu=this.element}this._close(currentMenu);this.blur(event);this.activeMenu=currentMenu},this.delay)},
// With no arguments, closes the currently active menu - if nothing is active
// it closes all menus.  If passed an argument, it will search for menus BELOW
_close:function(startMenu){if(!startMenu){startMenu=this.active?this.active.parent():this.element}startMenu.find(".ui-menu").hide().attr("aria-hidden","true").attr("aria-expanded","false").end().find(".ui-state-active").not(".ui-state-focus").removeClass("ui-state-active")},_closeOnDocumentClick:function(event){return!$(event.target).closest(".ui-menu").length},_isDivider:function(item){
// Match hyphen, em dash, en dash
return!/[^\-\u2014\u2013\s]/.test(item.text())},collapse:function(event){var newItem=this.active&&this.active.parent().closest(".ui-menu-item",this.element);if(newItem&&newItem.length){this._close();this.focus(event,newItem)}},expand:function(event){var newItem=this.active&&this.active.children(".ui-menu ").find(this.options.items).first();if(newItem&&newItem.length){this._open(newItem.parent());
// Delay so Firefox will not hide activedescendant change in expanding submenu from AT
this._delay(function(){this.focus(event,newItem)})}},next:function(event){this._move("next","first",event)},previous:function(event){this._move("prev","last",event)},isFirstItem:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},isLastItem:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},_move:function(direction,filter,event){var next;if(this.active){if(direction==="first"||direction==="last"){next=this.active[direction==="first"?"prevAll":"nextAll"](".ui-menu-item").eq(-1)}else{next=this.active[direction+"All"](".ui-menu-item").eq(0)}}if(!next||!next.length||!this.active){next=this.activeMenu.find(this.options.items)[filter]()}this.focus(event,next)},nextPage:function(event){var item,base,height;if(!this.active){this.next(event);return}if(this.isLastItem()){return}if(this._hasScroll()){base=this.active.offset().top;height=this.element.height();this.active.nextAll(".ui-menu-item").each(function(){item=$(this);return item.offset().top-base-height<0});this.focus(event,item)}else{this.focus(event,this.activeMenu.find(this.options.items)[!this.active?"first":"last"]())}},previousPage:function(event){var item,base,height;if(!this.active){this.next(event);return}if(this.isFirstItem()){return}if(this._hasScroll()){base=this.active.offset().top;height=this.element.height();this.active.prevAll(".ui-menu-item").each(function(){item=$(this);return item.offset().top-base+height>0});this.focus(event,item)}else{this.focus(event,this.activeMenu.find(this.options.items).first())}},_hasScroll:function(){return this.element.outerHeight()<this.element.prop("scrollHeight")},select:function(event){
// TODO: It should never be possible to not have an active item at this
// point, but the tests don't trigger mouseenter before click.
this.active=this.active||$(event.target).closest(".ui-menu-item");var ui={item:this.active};if(!this.active.has(".ui-menu").length){this.collapseAll(event,true)}this._trigger("select",event,ui)},_filterMenuItems:function(character){var escapedCharacter=character.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&"),regex=new RegExp("^"+escapedCharacter,"i");return this.activeMenu.find(this.options.items).filter(".ui-menu-item").filter(function(){return regex.test($.trim($(this).text()))})}});
/*!
 * jQuery UI Droppable 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/droppable/
 */$.widget("ui.droppable",{version:"1.11.4",widgetEventPrefix:"drop",options:{accept:"*",activeClass:false,addClasses:true,greedy:false,hoverClass:false,scope:"default",tolerance:"intersect",
// callbacks
activate:null,deactivate:null,drop:null,out:null,over:null},_create:function(){var proportions,o=this.options,accept=o.accept;this.isover=false;this.isout=true;this.accept=$.isFunction(accept)?accept:function(d){return d.is(accept)};this.proportions=function(){if(arguments.length){
// Store the droppable's proportions
proportions=arguments[0]}else{
// Retrieve or derive the droppable's proportions
return proportions?proportions:proportions={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight}}};this._addToManager(o.scope);o.addClasses&&this.element.addClass("ui-droppable")},_addToManager:function(scope){
// Add the reference and positions to the manager
$.ui.ddmanager.droppables[scope]=$.ui.ddmanager.droppables[scope]||[];$.ui.ddmanager.droppables[scope].push(this)},_splice:function(drop){var i=0;for(;i<drop.length;i++){if(drop[i]===this){drop.splice(i,1)}}},_destroy:function(){var drop=$.ui.ddmanager.droppables[this.options.scope];this._splice(drop);this.element.removeClass("ui-droppable ui-droppable-disabled")},_setOption:function(key,value){if(key==="accept"){this.accept=$.isFunction(value)?value:function(d){return d.is(value)}}else if(key==="scope"){var drop=$.ui.ddmanager.droppables[this.options.scope];this._splice(drop);this._addToManager(value)}this._super(key,value)},_activate:function(event){var draggable=$.ui.ddmanager.current;if(this.options.activeClass){this.element.addClass(this.options.activeClass)}if(draggable){this._trigger("activate",event,this.ui(draggable))}},_deactivate:function(event){var draggable=$.ui.ddmanager.current;if(this.options.activeClass){this.element.removeClass(this.options.activeClass)}if(draggable){this._trigger("deactivate",event,this.ui(draggable))}},_over:function(event){var draggable=$.ui.ddmanager.current;
// Bail if draggable and droppable are same element
if(!draggable||(draggable.currentItem||draggable.element)[0]===this.element[0]){return}if(this.accept.call(this.element[0],draggable.currentItem||draggable.element)){if(this.options.hoverClass){this.element.addClass(this.options.hoverClass)}this._trigger("over",event,this.ui(draggable))}},_out:function(event){var draggable=$.ui.ddmanager.current;
// Bail if draggable and droppable are same element
if(!draggable||(draggable.currentItem||draggable.element)[0]===this.element[0]){return}if(this.accept.call(this.element[0],draggable.currentItem||draggable.element)){if(this.options.hoverClass){this.element.removeClass(this.options.hoverClass)}this._trigger("out",event,this.ui(draggable))}},_drop:function(event,custom){var draggable=custom||$.ui.ddmanager.current,childrenIntersection=false;
// Bail if draggable and droppable are same element
if(!draggable||(draggable.currentItem||draggable.element)[0]===this.element[0]){return false}this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function(){var inst=$(this).droppable("instance");if(inst.options.greedy&&!inst.options.disabled&&inst.options.scope===draggable.options.scope&&inst.accept.call(inst.element[0],draggable.currentItem||draggable.element)&&$.ui.intersect(draggable,$.extend(inst,{offset:inst.element.offset()}),inst.options.tolerance,event)){childrenIntersection=true;return false}});if(childrenIntersection){return false}if(this.accept.call(this.element[0],draggable.currentItem||draggable.element)){if(this.options.activeClass){this.element.removeClass(this.options.activeClass)}if(this.options.hoverClass){this.element.removeClass(this.options.hoverClass)}this._trigger("drop",event,this.ui(draggable));return this.element}return false},ui:function(c){return{draggable:c.currentItem||c.element,helper:c.helper,position:c.position,offset:c.positionAbs}}});$.ui.intersect=function(){function isOverAxis(x,reference,size){return x>=reference&&x<reference+size}return function(draggable,droppable,toleranceMode,event){if(!droppable.offset){return false}var x1=(draggable.positionAbs||draggable.position.absolute).left+draggable.margins.left,y1=(draggable.positionAbs||draggable.position.absolute).top+draggable.margins.top,x2=x1+draggable.helperProportions.width,y2=y1+draggable.helperProportions.height,l=droppable.offset.left,t=droppable.offset.top,r=l+droppable.proportions().width,b=t+droppable.proportions().height;switch(toleranceMode){case"fit":return l<=x1&&x2<=r&&t<=y1&&y2<=b;case"intersect":return l<x1+draggable.helperProportions.width/2&&// Right Half
x2-draggable.helperProportions.width/2<r&&// Left Half
t<y1+draggable.helperProportions.height/2&&// Bottom Half
y2-draggable.helperProportions.height/2<b;// Top Half
case"pointer":return isOverAxis(event.pageY,t,droppable.proportions().height)&&isOverAxis(event.pageX,l,droppable.proportions().width);case"touch":return(y1>=t&&y1<=b||// Top edge touching
y2>=t&&y2<=b||// Bottom edge touching
y1<t&&y2>b)&&(x1>=l&&x1<=r||// Left edge touching
x2>=l&&x2<=r||// Right edge touching
x1<l&&x2>r);default:return false}}}();
/*
	This manager tracks offsets of draggables and droppables
*/$.ui.ddmanager={current:null,droppables:{default:[]},prepareOffsets:function(t,event){var i,j,m=$.ui.ddmanager.droppables[t.options.scope]||[],type=event?event.type:null,// workaround for #2317
list=(t.currentItem||t.element).find(":data(ui-droppable)").addBack();droppablesLoop:for(i=0;i<m.length;i++){
// No disabled and non-accepted
if(m[i].options.disabled||t&&!m[i].accept.call(m[i].element[0],t.currentItem||t.element)){continue}
// Filter out elements in the current dragged item
for(j=0;j<list.length;j++){if(list[j]===m[i].element[0]){m[i].proportions().height=0;continue droppablesLoop}}m[i].visible=m[i].element.css("display")!=="none";if(!m[i].visible){continue}
// Activate the droppable if used directly from draggables
if(type==="mousedown"){m[i]._activate.call(m[i],event)}m[i].offset=m[i].element.offset();m[i].proportions({width:m[i].element[0].offsetWidth,height:m[i].element[0].offsetHeight})}},drop:function(draggable,event){var dropped=false;
// Create a copy of the droppables in case the list changes during the drop (#9116)
$.each(($.ui.ddmanager.droppables[draggable.options.scope]||[]).slice(),function(){if(!this.options){return}if(!this.options.disabled&&this.visible&&$.ui.intersect(draggable,this,this.options.tolerance,event)){dropped=this._drop.call(this,event)||dropped}if(!this.options.disabled&&this.visible&&this.accept.call(this.element[0],draggable.currentItem||draggable.element)){this.isout=true;this.isover=false;this._deactivate.call(this,event)}});return dropped},dragStart:function(draggable,event){
// Listen for scrolling so that if the dragging causes scrolling the position of the droppables can be recalculated (see #5003)
draggable.element.parentsUntil("body").bind("scroll.droppable",function(){if(!draggable.options.refreshPositions){$.ui.ddmanager.prepareOffsets(draggable,event)}})},drag:function(draggable,event){
// If you have a highly dynamic page, you might try this option. It renders positions every time you move the mouse.
if(draggable.options.refreshPositions){$.ui.ddmanager.prepareOffsets(draggable,event)}
// Run through all droppables and check their positions based on specific tolerance options
$.each($.ui.ddmanager.droppables[draggable.options.scope]||[],function(){if(this.options.disabled||this.greedyChild||!this.visible){return}var parentInstance,scope,parent,intersects=$.ui.intersect(draggable,this,this.options.tolerance,event),c=!intersects&&this.isover?"isout":intersects&&!this.isover?"isover":null;if(!c){return}if(this.options.greedy){
// find droppable parents with same scope
scope=this.options.scope;parent=this.element.parents(":data(ui-droppable)").filter(function(){return $(this).droppable("instance").options.scope===scope});if(parent.length){parentInstance=$(parent[0]).droppable("instance");parentInstance.greedyChild=c==="isover"}}
// we just moved into a greedy child
if(parentInstance&&c==="isover"){parentInstance.isover=false;parentInstance.isout=true;parentInstance._out.call(parentInstance,event)}this[c]=true;this[c==="isout"?"isover":"isout"]=false;this[c==="isover"?"_over":"_out"].call(this,event);
// we just moved out of a greedy child
if(parentInstance&&c==="isout"){parentInstance.isout=false;parentInstance.isover=true;parentInstance._over.call(parentInstance,event)}})},dragStop:function(draggable,event){draggable.element.parentsUntil("body").unbind("scroll.droppable");
// Call prepareOffsets one final time since IE does not fire return scroll events when overflow was caused by drag (see #5003)
if(!draggable.options.refreshPositions){$.ui.ddmanager.prepareOffsets(draggable,event)}}};var droppable=$.ui.droppable;
/*!
 * jQuery UI Selectmenu 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/selectmenu
 */var selectmenu=$.widget("ui.selectmenu",{version:"1.11.4",defaultElement:"<select>",options:{appendTo:null,disabled:null,icons:{button:"ui-icon-triangle-1-s"},position:{my:"left top",at:"left bottom",collision:"none"},width:null,
// callbacks
change:null,close:null,focus:null,open:null,select:null},_create:function(){var selectmenuId=this.element.uniqueId().attr("id");this.ids={element:selectmenuId,button:selectmenuId+"-button",menu:selectmenuId+"-menu"};this._drawButton();this._drawMenu();if(this.options.disabled){this.disable()}},_drawButton:function(){var that=this;
// Associate existing label with the new button
this.label=$("label[for='"+this.ids.element+"']").attr("for",this.ids.button);this._on(this.label,{click:function(event){this.button.focus();event.preventDefault()}});
// Hide original select element
this.element.hide();
// Create button
this.button=$("<span>",{class:"ui-selectmenu-button ui-widget ui-state-default ui-corner-all",tabindex:this.options.disabled?-1:0,id:this.ids.button,role:"combobox","aria-expanded":"false","aria-autocomplete":"list","aria-owns":this.ids.menu,"aria-haspopup":"true"}).insertAfter(this.element);$("<span>",{class:"ui-icon "+this.options.icons.button}).prependTo(this.button);this.buttonText=$("<span>",{class:"ui-selectmenu-text"}).appendTo(this.button);this._setText(this.buttonText,this.element.find("option:selected").text());this._resizeButton();this._on(this.button,this._buttonEvents);this.button.one("focusin",function(){
// Delay rendering the menu items until the button receives focus.
// The menu may have already been rendered via a programmatic open.
if(!that.menuItems){that._refreshMenu()}});this._hoverable(this.button);this._focusable(this.button)},_drawMenu:function(){var that=this;
// Create menu
this.menu=$("<ul>",{"aria-hidden":"true","aria-labelledby":this.ids.button,id:this.ids.menu});
// Wrap menu
this.menuWrap=$("<div>",{class:"ui-selectmenu-menu ui-front"}).append(this.menu).appendTo(this._appendTo());
// Initialize menu widget
this.menuInstance=this.menu.menu({role:"listbox",select:function(event,ui){event.preventDefault();
// support: IE8
// If the item was selected via a click, the text selection
// will be destroyed in IE
that._setSelection();that._select(ui.item.data("ui-selectmenu-item"),event)},focus:function(event,ui){var item=ui.item.data("ui-selectmenu-item");
// Prevent inital focus from firing and check if its a newly focused item
if(that.focusIndex!=null&&item.index!==that.focusIndex){that._trigger("focus",event,{item:item});if(!that.isOpen){that._select(item,event)}}that.focusIndex=item.index;that.button.attr("aria-activedescendant",that.menuItems.eq(item.index).attr("id"))}}).menu("instance");
// Adjust menu styles to dropdown
this.menu.addClass("ui-corner-bottom").removeClass("ui-corner-all");
// Don't close the menu on mouseleave
this.menuInstance._off(this.menu,"mouseleave");
// Cancel the menu's collapseAll on document click
this.menuInstance._closeOnDocumentClick=function(){return false};
// Selects often contain empty items, but never contain dividers
this.menuInstance._isDivider=function(){return false}},refresh:function(){this._refreshMenu();this._setText(this.buttonText,this._getSelectedItem().text());if(!this.options.width){this._resizeButton()}},_refreshMenu:function(){this.menu.empty();var item,options=this.element.find("option");if(!options.length){return}this._parseOptions(options);this._renderMenu(this.menu,this.items);this.menuInstance.refresh();this.menuItems=this.menu.find("li").not(".ui-selectmenu-optgroup");item=this._getSelectedItem();
// Update the menu to have the correct item focused
this.menuInstance.focus(null,item);this._setAria(item.data("ui-selectmenu-item"));
// Set disabled state
this._setOption("disabled",this.element.prop("disabled"))},open:function(event){if(this.options.disabled){return}
// If this is the first time the menu is being opened, render the items
if(!this.menuItems){this._refreshMenu()}else{
// Menu clears focus on close, reset focus to selected item
this.menu.find(".ui-state-focus").removeClass("ui-state-focus");this.menuInstance.focus(null,this._getSelectedItem())}this.isOpen=true;this._toggleAttr();this._resizeMenu();this._position();this._on(this.document,this._documentClick);this._trigger("open",event)},_position:function(){this.menuWrap.position($.extend({of:this.button},this.options.position))},close:function(event){if(!this.isOpen){return}this.isOpen=false;this._toggleAttr();this.range=null;this._off(this.document);this._trigger("close",event)},widget:function(){return this.button},menuWidget:function(){return this.menu},_renderMenu:function(ul,items){var that=this,currentOptgroup="";$.each(items,function(index,item){if(item.optgroup!==currentOptgroup){$("<li>",{class:"ui-selectmenu-optgroup ui-menu-divider"+(item.element.parent("optgroup").prop("disabled")?" ui-state-disabled":""),text:item.optgroup}).appendTo(ul);currentOptgroup=item.optgroup}that._renderItemData(ul,item)})},_renderItemData:function(ul,item){return this._renderItem(ul,item).data("ui-selectmenu-item",item)},_renderItem:function(ul,item){var li=$("<li>");if(item.disabled){li.addClass("ui-state-disabled")}this._setText(li,item.label);return li.appendTo(ul)},_setText:function(element,value){if(value){element.text(value)}else{element.html("&#160;")}},_move:function(direction,event){var item,next,filter=".ui-menu-item";if(this.isOpen){item=this.menuItems.eq(this.focusIndex)}else{item=this.menuItems.eq(this.element[0].selectedIndex);filter+=":not(.ui-state-disabled)"}if(direction==="first"||direction==="last"){next=item[direction==="first"?"prevAll":"nextAll"](filter).eq(-1)}else{next=item[direction+"All"](filter).eq(0)}if(next.length){this.menuInstance.focus(event,next)}},_getSelectedItem:function(){return this.menuItems.eq(this.element[0].selectedIndex)},_toggle:function(event){this[this.isOpen?"close":"open"](event)},_setSelection:function(){var selection;if(!this.range){return}if(window.getSelection){selection=window.getSelection();selection.removeAllRanges();selection.addRange(this.range);
// support: IE8
}else{this.range.select()}
// support: IE
// Setting the text selection kills the button focus in IE, but
// restoring the focus doesn't kill the selection.
this.button.focus()},_documentClick:{mousedown:function(event){if(!this.isOpen){return}if(!$(event.target).closest(".ui-selectmenu-menu, #"+this.ids.button).length){this.close(event)}}},_buttonEvents:{
// Prevent text selection from being reset when interacting with the selectmenu (#10144)
mousedown:function(){var selection;if(window.getSelection){selection=window.getSelection();if(selection.rangeCount){this.range=selection.getRangeAt(0)}
// support: IE8
}else{this.range=document.selection.createRange()}},click:function(event){this._setSelection();this._toggle(event)},keydown:function(event){var preventDefault=true;switch(event.keyCode){case $.ui.keyCode.TAB:case $.ui.keyCode.ESCAPE:this.close(event);preventDefault=false;break;case $.ui.keyCode.ENTER:if(this.isOpen){this._selectFocusedItem(event)}break;case $.ui.keyCode.UP:if(event.altKey){this._toggle(event)}else{this._move("prev",event)}break;case $.ui.keyCode.DOWN:if(event.altKey){this._toggle(event)}else{this._move("next",event)}break;case $.ui.keyCode.SPACE:if(this.isOpen){this._selectFocusedItem(event)}else{this._toggle(event)}break;case $.ui.keyCode.LEFT:this._move("prev",event);break;case $.ui.keyCode.RIGHT:this._move("next",event);break;case $.ui.keyCode.HOME:case $.ui.keyCode.PAGE_UP:this._move("first",event);break;case $.ui.keyCode.END:case $.ui.keyCode.PAGE_DOWN:this._move("last",event);break;default:this.menu.trigger(event);preventDefault=false}if(preventDefault){event.preventDefault()}}},_selectFocusedItem:function(event){var item=this.menuItems.eq(this.focusIndex);if(!item.hasClass("ui-state-disabled")){this._select(item.data("ui-selectmenu-item"),event)}},_select:function(item,event){var oldIndex=this.element[0].selectedIndex;
// Change native select element
this.element[0].selectedIndex=item.index;this._setText(this.buttonText,item.label);this._setAria(item);this._trigger("select",event,{item:item});if(item.index!==oldIndex){this._trigger("change",event,{item:item})}this.close(event)},_setAria:function(item){var id=this.menuItems.eq(item.index).attr("id");this.button.attr({"aria-labelledby":id,"aria-activedescendant":id});this.menu.attr("aria-activedescendant",id)},_setOption:function(key,value){if(key==="icons"){this.button.find("span.ui-icon").removeClass(this.options.icons.button).addClass(value.button)}this._super(key,value);if(key==="appendTo"){this.menuWrap.appendTo(this._appendTo())}if(key==="disabled"){this.menuInstance.option("disabled",value);this.button.toggleClass("ui-state-disabled",value).attr("aria-disabled",value);this.element.prop("disabled",value);if(value){this.button.attr("tabindex",-1);this.close()}else{this.button.attr("tabindex",0)}}if(key==="width"){this._resizeButton()}},_appendTo:function(){var element=this.options.appendTo;if(element){element=element.jquery||element.nodeType?$(element):this.document.find(element).eq(0)}if(!element||!element[0]){element=this.element.closest(".ui-front")}if(!element.length){element=this.document[0].body}return element},_toggleAttr:function(){this.button.toggleClass("ui-corner-top",this.isOpen).toggleClass("ui-corner-all",!this.isOpen).attr("aria-expanded",this.isOpen);this.menuWrap.toggleClass("ui-selectmenu-open",this.isOpen);this.menu.attr("aria-hidden",!this.isOpen)},_resizeButton:function(){var width=this.options.width;if(!width){width=this.element.show().outerWidth();this.element.hide()}this.button.outerWidth(width)},_resizeMenu:function(){this.menu.outerWidth(Math.max(this.button.outerWidth(),
// support: IE10
// IE10 wraps long text (possibly a rounding bug)
// so we add 1px to avoid the wrapping
this.menu.width("").outerWidth()+1))},_getCreateOptions:function(){return{disabled:this.element.prop("disabled")}},_parseOptions:function(options){var data=[];options.each(function(index,item){var option=$(item),optgroup=option.parent("optgroup");data.push({element:option,index:index,value:option.val(),label:option.text(),optgroup:optgroup.attr("label")||"",disabled:optgroup.prop("disabled")||option.prop("disabled")})});this.items=data},_destroy:function(){this.menuWrap.remove();this.button.remove();this.element.show();this.element.removeUniqueId();this.label.attr("for",this.ids.element)}});
/*!
 * jQuery UI Sortable 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/sortable/
 */var sortable=$.widget("ui.sortable",$.ui.mouse,{version:"1.11.4",widgetEventPrefix:"sort",ready:false,options:{appendTo:"parent",axis:false,connectWith:false,containment:false,cursor:"auto",cursorAt:false,dropOnEmpty:true,forcePlaceholderSize:false,forceHelperSize:false,grid:false,handle:false,helper:"original",items:"> *",opacity:false,placeholder:false,revert:false,scroll:true,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3,
// callbacks
activate:null,beforeStop:null,change:null,deactivate:null,out:null,over:null,receive:null,remove:null,sort:null,start:null,stop:null,update:null},_isOverAxis:function(x,reference,size){return x>=reference&&x<reference+size},_isFloating:function(item){return/left|right/.test(item.css("float"))||/inline|table-cell/.test(item.css("display"))},_create:function(){this.containerCache={};this.element.addClass("ui-sortable");
//Get the items
this.refresh();
//Let's determine the parent's offset
this.offset=this.element.offset();
//Initialize mouse events for interaction
this._mouseInit();this._setHandleClassName();
//We're ready to go
this.ready=true},_setOption:function(key,value){this._super(key,value);if(key==="handle"){this._setHandleClassName()}},_setHandleClassName:function(){this.element.find(".ui-sortable-handle").removeClass("ui-sortable-handle");$.each(this.items,function(){(this.instance.options.handle?this.item.find(this.instance.options.handle):this.item).addClass("ui-sortable-handle")})},_destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled").find(".ui-sortable-handle").removeClass("ui-sortable-handle");this._mouseDestroy();for(var i=this.items.length-1;i>=0;i--){this.items[i].item.removeData(this.widgetName+"-item")}return this},_mouseCapture:function(event,overrideHandle){var currentItem=null,validHandle=false,that=this;if(this.reverting){return false}if(this.options.disabled||this.options.type==="static"){return false}
//We have to refresh the items data once first
this._refreshItems(event);
//Find out if the clicked node (or one of its parents) is a actual item in this.items
$(event.target).parents().each(function(){if($.data(this,that.widgetName+"-item")===that){currentItem=$(this);return false}});if($.data(event.target,that.widgetName+"-item")===that){currentItem=$(event.target)}if(!currentItem){return false}if(this.options.handle&&!overrideHandle){$(this.options.handle,currentItem).find("*").addBack().each(function(){if(this===event.target){validHandle=true}});if(!validHandle){return false}}this.currentItem=currentItem;this._removeCurrentsFromItems();return true},_mouseStart:function(event,overrideHandle,noActivation){var i,body,o=this.options;this.currentContainer=this;
//We only need to call refreshPositions, because the refreshItems call has been moved to mouseCapture
this.refreshPositions();
//Create and append the visible helper
this.helper=this._createHelper(event);
//Cache the helper size
this._cacheHelperProportions();
/*
		 * - Position generation -
		 * This block generates everything position related - it's the core of draggables.
		 */
//Cache the margins of the original element
this._cacheMargins();
//Get the next scrolling parent
this.scrollParent=this.helper.scrollParent();
//The element's absolute position on the page minus margins
this.offset=this.currentItem.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};$.extend(this.offset,{click:{//Where the click happened, relative to the element
left:event.pageX-this.offset.left,top:event.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});
// Only after we got the offset, we can change the helper's position to absolute
// TODO: Still need to figure out a way to make relative sorting possible
this.helper.css("position","absolute");this.cssPosition=this.helper.css("position");
//Generate the original position
this.originalPosition=this._generatePosition(event);this.originalPageX=event.pageX;this.originalPageY=event.pageY;
//Adjust the mouse offset relative to the helper if "cursorAt" is supplied
o.cursorAt&&this._adjustOffsetFromHelper(o.cursorAt);
//Cache the former DOM position
this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]};
//If the helper is not the original, hide the original so it's not playing any role during the drag, won't cause anything bad this way
if(this.helper[0]!==this.currentItem[0]){this.currentItem.hide()}
//Create the placeholder
this._createPlaceholder();
//Set a containment if given in the options
if(o.containment){this._setContainment()}if(o.cursor&&o.cursor!=="auto"){// cursor option
body=this.document.find("body");
// support: IE
this.storedCursor=body.css("cursor");body.css("cursor",o.cursor);this.storedStylesheet=$("<style>*{ cursor: "+o.cursor+" !important; }</style>").appendTo(body)}if(o.opacity){// opacity option
if(this.helper.css("opacity")){this._storedOpacity=this.helper.css("opacity")}this.helper.css("opacity",o.opacity)}if(o.zIndex){// zIndex option
if(this.helper.css("zIndex")){this._storedZIndex=this.helper.css("zIndex")}this.helper.css("zIndex",o.zIndex)}
//Prepare scrolling
if(this.scrollParent[0]!==this.document[0]&&this.scrollParent[0].tagName!=="HTML"){this.overflowOffset=this.scrollParent.offset()}
//Call callbacks
this._trigger("start",event,this._uiHash());
//Recache the helper size
if(!this._preserveHelperProportions){this._cacheHelperProportions()}
//Post "activate" events to possible containers
if(!noActivation){for(i=this.containers.length-1;i>=0;i--){this.containers[i]._trigger("activate",event,this._uiHash(this))}}
//Prepare possible droppables
if($.ui.ddmanager){$.ui.ddmanager.current=this}if($.ui.ddmanager&&!o.dropBehaviour){$.ui.ddmanager.prepareOffsets(this,event)}this.dragging=true;this.helper.addClass("ui-sortable-helper");this._mouseDrag(event);//Execute the drag once - this causes the helper not to be visible before getting its correct position
return true},_mouseDrag:function(event){var i,item,itemElement,intersection,o=this.options,scrolled=false;
//Compute the helpers position
this.position=this._generatePosition(event);this.positionAbs=this._convertPositionTo("absolute");if(!this.lastPositionAbs){this.lastPositionAbs=this.positionAbs}
//Do scrolling
if(this.options.scroll){if(this.scrollParent[0]!==this.document[0]&&this.scrollParent[0].tagName!=="HTML"){if(this.overflowOffset.top+this.scrollParent[0].offsetHeight-event.pageY<o.scrollSensitivity){this.scrollParent[0].scrollTop=scrolled=this.scrollParent[0].scrollTop+o.scrollSpeed}else if(event.pageY-this.overflowOffset.top<o.scrollSensitivity){this.scrollParent[0].scrollTop=scrolled=this.scrollParent[0].scrollTop-o.scrollSpeed}if(this.overflowOffset.left+this.scrollParent[0].offsetWidth-event.pageX<o.scrollSensitivity){this.scrollParent[0].scrollLeft=scrolled=this.scrollParent[0].scrollLeft+o.scrollSpeed}else if(event.pageX-this.overflowOffset.left<o.scrollSensitivity){this.scrollParent[0].scrollLeft=scrolled=this.scrollParent[0].scrollLeft-o.scrollSpeed}}else{if(event.pageY-this.document.scrollTop()<o.scrollSensitivity){scrolled=this.document.scrollTop(this.document.scrollTop()-o.scrollSpeed)}else if(this.window.height()-(event.pageY-this.document.scrollTop())<o.scrollSensitivity){scrolled=this.document.scrollTop(this.document.scrollTop()+o.scrollSpeed)}if(event.pageX-this.document.scrollLeft()<o.scrollSensitivity){scrolled=this.document.scrollLeft(this.document.scrollLeft()-o.scrollSpeed)}else if(this.window.width()-(event.pageX-this.document.scrollLeft())<o.scrollSensitivity){scrolled=this.document.scrollLeft(this.document.scrollLeft()+o.scrollSpeed)}}if(scrolled!==false&&$.ui.ddmanager&&!o.dropBehaviour){$.ui.ddmanager.prepareOffsets(this,event)}}
//Regenerate the absolute position used for position checks
this.positionAbs=this._convertPositionTo("absolute");
//Set the helper position
if(!this.options.axis||this.options.axis!=="y"){this.helper[0].style.left=this.position.left+"px"}if(!this.options.axis||this.options.axis!=="x"){this.helper[0].style.top=this.position.top+"px"}
//Rearrange
for(i=this.items.length-1;i>=0;i--){
//Cache variables and intersection, continue if no intersection
item=this.items[i];itemElement=item.item[0];intersection=this._intersectsWithPointer(item);if(!intersection){continue}
// Only put the placeholder inside the current Container, skip all
// items from other containers. This works because when moving
// an item from one container to another the
// currentContainer is switched before the placeholder is moved.
//
// Without this, moving items in "sub-sortables" can cause
// the placeholder to jitter between the outer and inner container.
if(item.instance!==this.currentContainer){continue}
// cannot intersect with itself
// no useless actions that have been done before
// no action if the item moved is the parent of the item checked
if(itemElement!==this.currentItem[0]&&this.placeholder[intersection===1?"next":"prev"]()[0]!==itemElement&&!$.contains(this.placeholder[0],itemElement)&&(this.options.type==="semi-dynamic"?!$.contains(this.element[0],itemElement):true)){this.direction=intersection===1?"down":"up";if(this.options.tolerance==="pointer"||this._intersectsWithSides(item)){this._rearrange(event,item)}else{break}this._trigger("change",event,this._uiHash());break}}
//Post events to containers
this._contactContainers(event);
//Interconnect with droppables
if($.ui.ddmanager){$.ui.ddmanager.drag(this,event)}
//Call callbacks
this._trigger("sort",event,this._uiHash());this.lastPositionAbs=this.positionAbs;return false},_mouseStop:function(event,noPropagation){if(!event){return}
//If we are using droppables, inform the manager about the drop
if($.ui.ddmanager&&!this.options.dropBehaviour){$.ui.ddmanager.drop(this,event)}if(this.options.revert){var that=this,cur=this.placeholder.offset(),axis=this.options.axis,animation={};if(!axis||axis==="x"){animation.left=cur.left-this.offset.parent.left-this.margins.left+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollLeft)}if(!axis||axis==="y"){animation.top=cur.top-this.offset.parent.top-this.margins.top+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollTop)}this.reverting=true;$(this.helper).animate(animation,parseInt(this.options.revert,10)||500,function(){that._clear(event)})}else{this._clear(event,noPropagation)}return false},cancel:function(){if(this.dragging){this._mouseUp({target:null});if(this.options.helper==="original"){this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else{this.currentItem.show()}
//Post deactivating events to containers
for(var i=this.containers.length-1;i>=0;i--){this.containers[i]._trigger("deactivate",null,this._uiHash(this));if(this.containers[i].containerCache.over){this.containers[i]._trigger("out",null,this._uiHash(this));this.containers[i].containerCache.over=0}}}if(this.placeholder){
//$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!
if(this.placeholder[0].parentNode){this.placeholder[0].parentNode.removeChild(this.placeholder[0])}if(this.options.helper!=="original"&&this.helper&&this.helper[0].parentNode){this.helper.remove()}$.extend(this,{helper:null,dragging:false,reverting:false,_noFinalSort:null});if(this.domPosition.prev){$(this.domPosition.prev).after(this.currentItem)}else{$(this.domPosition.parent).prepend(this.currentItem)}}return this},serialize:function(o){var items=this._getItemsAsjQuery(o&&o.connected),str=[];o=o||{};$(items).each(function(){var res=($(o.item||this).attr(o.attribute||"id")||"").match(o.expression||/(.+)[\-=_](.+)/);if(res){str.push((o.key||res[1]+"[]")+"="+(o.key&&o.expression?res[1]:res[2]))}});if(!str.length&&o.key){str.push(o.key+"=")}return str.join("&")},toArray:function(o){var items=this._getItemsAsjQuery(o&&o.connected),ret=[];o=o||{};items.each(function(){ret.push($(o.item||this).attr(o.attribute||"id")||"")});return ret},
/* Be careful with the following core functions */
_intersectsWith:function(item){var x1=this.positionAbs.left,x2=x1+this.helperProportions.width,y1=this.positionAbs.top,y2=y1+this.helperProportions.height,l=item.left,r=l+item.width,t=item.top,b=t+item.height,dyClick=this.offset.click.top,dxClick=this.offset.click.left,isOverElementHeight=this.options.axis==="x"||y1+dyClick>t&&y1+dyClick<b,isOverElementWidth=this.options.axis==="y"||x1+dxClick>l&&x1+dxClick<r,isOverElement=isOverElementHeight&&isOverElementWidth;if(this.options.tolerance==="pointer"||this.options.forcePointerForContainers||this.options.tolerance!=="pointer"&&this.helperProportions[this.floating?"width":"height"]>item[this.floating?"width":"height"]){return isOverElement}else{return l<x1+this.helperProportions.width/2&&// Right Half
x2-this.helperProportions.width/2<r&&// Left Half
t<y1+this.helperProportions.height/2&&// Bottom Half
y2-this.helperProportions.height/2<b;// Top Half
}},_intersectsWithPointer:function(item){var isOverElementHeight=this.options.axis==="x"||this._isOverAxis(this.positionAbs.top+this.offset.click.top,item.top,item.height),isOverElementWidth=this.options.axis==="y"||this._isOverAxis(this.positionAbs.left+this.offset.click.left,item.left,item.width),isOverElement=isOverElementHeight&&isOverElementWidth,verticalDirection=this._getDragVerticalDirection(),horizontalDirection=this._getDragHorizontalDirection();if(!isOverElement){return false}return this.floating?horizontalDirection&&horizontalDirection==="right"||verticalDirection==="down"?2:1:verticalDirection&&(verticalDirection==="down"?2:1)},_intersectsWithSides:function(item){var isOverBottomHalf=this._isOverAxis(this.positionAbs.top+this.offset.click.top,item.top+item.height/2,item.height),isOverRightHalf=this._isOverAxis(this.positionAbs.left+this.offset.click.left,item.left+item.width/2,item.width),verticalDirection=this._getDragVerticalDirection(),horizontalDirection=this._getDragHorizontalDirection();if(this.floating&&horizontalDirection){return horizontalDirection==="right"&&isOverRightHalf||horizontalDirection==="left"&&!isOverRightHalf}else{return verticalDirection&&(verticalDirection==="down"&&isOverBottomHalf||verticalDirection==="up"&&!isOverBottomHalf)}},_getDragVerticalDirection:function(){var delta=this.positionAbs.top-this.lastPositionAbs.top;return delta!==0&&(delta>0?"down":"up")},_getDragHorizontalDirection:function(){var delta=this.positionAbs.left-this.lastPositionAbs.left;return delta!==0&&(delta>0?"right":"left")},refresh:function(event){this._refreshItems(event);this._setHandleClassName();this.refreshPositions();return this},_connectWith:function(){var options=this.options;return options.connectWith.constructor===String?[options.connectWith]:options.connectWith},_getItemsAsjQuery:function(connected){var i,j,cur,inst,items=[],queries=[],connectWith=this._connectWith();if(connectWith&&connected){for(i=connectWith.length-1;i>=0;i--){cur=$(connectWith[i],this.document[0]);for(j=cur.length-1;j>=0;j--){inst=$.data(cur[j],this.widgetFullName);if(inst&&inst!==this&&!inst.options.disabled){queries.push([$.isFunction(inst.options.items)?inst.options.items.call(inst.element):$(inst.options.items,inst.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),inst])}}}}queries.push([$.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):$(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]);function addItems(){items.push(this)}for(i=queries.length-1;i>=0;i--){queries[i][0].each(addItems)}return $(items)},_removeCurrentsFromItems:function(){var list=this.currentItem.find(":data("+this.widgetName+"-item)");this.items=$.grep(this.items,function(item){for(var j=0;j<list.length;j++){if(list[j]===item.item[0]){return false}}return true})},_refreshItems:function(event){this.items=[];this.containers=[this];var i,j,cur,inst,targetData,_queries,item,queriesLength,items=this.items,queries=[[$.isFunction(this.options.items)?this.options.items.call(this.element[0],event,{item:this.currentItem}):$(this.options.items,this.element),this]],connectWith=this._connectWith();if(connectWith&&this.ready){//Shouldn't be run the first time through due to massive slow-down
for(i=connectWith.length-1;i>=0;i--){cur=$(connectWith[i],this.document[0]);for(j=cur.length-1;j>=0;j--){inst=$.data(cur[j],this.widgetFullName);if(inst&&inst!==this&&!inst.options.disabled){queries.push([$.isFunction(inst.options.items)?inst.options.items.call(inst.element[0],event,{item:this.currentItem}):$(inst.options.items,inst.element),inst]);this.containers.push(inst)}}}}for(i=queries.length-1;i>=0;i--){targetData=queries[i][1];_queries=queries[i][0];for(j=0,queriesLength=_queries.length;j<queriesLength;j++){item=$(_queries[j]);item.data(this.widgetName+"-item",targetData);// Data for target checking (mouse manager)
items.push({item:item,instance:targetData,width:0,height:0,left:0,top:0})}}},refreshPositions:function(fast){
// Determine whether items are being displayed horizontally
this.floating=this.items.length?this.options.axis==="x"||this._isFloating(this.items[0].item):false;
//This has to be redone because due to the item being moved out/into the offsetParent, the offsetParent's position will change
if(this.offsetParent&&this.helper){this.offset.parent=this._getParentOffset()}var i,item,t,p;for(i=this.items.length-1;i>=0;i--){item=this.items[i];
//We ignore calculating positions of all connected containers when we're not over them
if(item.instance!==this.currentContainer&&this.currentContainer&&item.item[0]!==this.currentItem[0]){continue}t=this.options.toleranceElement?$(this.options.toleranceElement,item.item):item.item;if(!fast){item.width=t.outerWidth();item.height=t.outerHeight()}p=t.offset();item.left=p.left;item.top=p.top}if(this.options.custom&&this.options.custom.refreshContainers){this.options.custom.refreshContainers.call(this)}else{for(i=this.containers.length-1;i>=0;i--){p=this.containers[i].element.offset();this.containers[i].containerCache.left=p.left;this.containers[i].containerCache.top=p.top;this.containers[i].containerCache.width=this.containers[i].element.outerWidth();this.containers[i].containerCache.height=this.containers[i].element.outerHeight()}}return this},_createPlaceholder:function(that){that=that||this;var className,o=that.options;if(!o.placeholder||o.placeholder.constructor===String){className=o.placeholder;o.placeholder={element:function(){var nodeName=that.currentItem[0].nodeName.toLowerCase(),element=$("<"+nodeName+">",that.document[0]).addClass(className||that.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper");if(nodeName==="tbody"){that._createTrPlaceholder(that.currentItem.find("tr").eq(0),$("<tr>",that.document[0]).appendTo(element))}else if(nodeName==="tr"){that._createTrPlaceholder(that.currentItem,element)}else if(nodeName==="img"){element.attr("src",that.currentItem.attr("src"))}if(!className){element.css("visibility","hidden")}return element},update:function(container,p){
// 1. If a className is set as 'placeholder option, we don't force sizes - the class is responsible for that
// 2. The option 'forcePlaceholderSize can be enabled to force it even if a class name is specified
if(className&&!o.forcePlaceholderSize){return}
//If the element doesn't have a actual height by itself (without styles coming from a stylesheet), it receives the inline height from the dragged item
if(!p.height()){p.height(that.currentItem.innerHeight()-parseInt(that.currentItem.css("paddingTop")||0,10)-parseInt(that.currentItem.css("paddingBottom")||0,10))}if(!p.width()){p.width(that.currentItem.innerWidth()-parseInt(that.currentItem.css("paddingLeft")||0,10)-parseInt(that.currentItem.css("paddingRight")||0,10))}}}}
//Create the placeholder
that.placeholder=$(o.placeholder.element.call(that.element,that.currentItem));
//Append it after the actual current item
that.currentItem.after(that.placeholder);
//Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317)
o.placeholder.update(that,that.placeholder)},_createTrPlaceholder:function(sourceTr,targetTr){var that=this;sourceTr.children().each(function(){$("<td>&#160;</td>",that.document[0]).attr("colspan",$(this).attr("colspan")||1).appendTo(targetTr)})},_contactContainers:function(event){var i,j,dist,itemWithLeastDistance,posProperty,sizeProperty,cur,nearBottom,floating,axis,innermostContainer=null,innermostIndex=null;
// get innermost container that intersects with item
for(i=this.containers.length-1;i>=0;i--){
// never consider a container that's located within the item itself
if($.contains(this.currentItem[0],this.containers[i].element[0])){continue}if(this._intersectsWith(this.containers[i].containerCache)){
// if we've already found a container and it's more "inner" than this, then continue
if(innermostContainer&&$.contains(this.containers[i].element[0],innermostContainer.element[0])){continue}innermostContainer=this.containers[i];innermostIndex=i}else{
// container doesn't intersect. trigger "out" event if necessary
if(this.containers[i].containerCache.over){this.containers[i]._trigger("out",event,this._uiHash(this));this.containers[i].containerCache.over=0}}}
// if no intersecting containers found, return
if(!innermostContainer){return}
// move the item into the container if it's not there already
if(this.containers.length===1){if(!this.containers[innermostIndex].containerCache.over){this.containers[innermostIndex]._trigger("over",event,this._uiHash(this));this.containers[innermostIndex].containerCache.over=1}}else{
//When entering a new container, we will find the item with the least distance and append our item near it
dist=1e4;itemWithLeastDistance=null;floating=innermostContainer.floating||this._isFloating(this.currentItem);posProperty=floating?"left":"top";sizeProperty=floating?"width":"height";axis=floating?"clientX":"clientY";for(j=this.items.length-1;j>=0;j--){if(!$.contains(this.containers[innermostIndex].element[0],this.items[j].item[0])){continue}if(this.items[j].item[0]===this.currentItem[0]){continue}cur=this.items[j].item.offset()[posProperty];nearBottom=false;if(event[axis]-cur>this.items[j][sizeProperty]/2){nearBottom=true}if(Math.abs(event[axis]-cur)<dist){dist=Math.abs(event[axis]-cur);itemWithLeastDistance=this.items[j];this.direction=nearBottom?"up":"down"}}
//Check if dropOnEmpty is enabled
if(!itemWithLeastDistance&&!this.options.dropOnEmpty){return}if(this.currentContainer===this.containers[innermostIndex]){if(!this.currentContainer.containerCache.over){this.containers[innermostIndex]._trigger("over",event,this._uiHash());this.currentContainer.containerCache.over=1}return}itemWithLeastDistance?this._rearrange(event,itemWithLeastDistance,null,true):this._rearrange(event,null,this.containers[innermostIndex].element,true);this._trigger("change",event,this._uiHash());this.containers[innermostIndex]._trigger("change",event,this._uiHash(this));this.currentContainer=this.containers[innermostIndex];
//Update the placeholder
this.options.placeholder.update(this.currentContainer,this.placeholder);this.containers[innermostIndex]._trigger("over",event,this._uiHash(this));this.containers[innermostIndex].containerCache.over=1}},_createHelper:function(event){var o=this.options,helper=$.isFunction(o.helper)?$(o.helper.apply(this.element[0],[event,this.currentItem])):o.helper==="clone"?this.currentItem.clone():this.currentItem;
//Add the helper to the DOM if that didn't happen already
if(!helper.parents("body").length){$(o.appendTo!=="parent"?o.appendTo:this.currentItem[0].parentNode)[0].appendChild(helper[0])}if(helper[0]===this.currentItem[0]){this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}}if(!helper[0].style.width||o.forceHelperSize){helper.width(this.currentItem.width())}if(!helper[0].style.height||o.forceHelperSize){helper.height(this.currentItem.height())}return helper},_adjustOffsetFromHelper:function(obj){if(typeof obj==="string"){obj=obj.split(" ")}if($.isArray(obj)){obj={left:+obj[0],top:+obj[1]||0}}if("left"in obj){this.offset.click.left=obj.left+this.margins.left}if("right"in obj){this.offset.click.left=this.helperProportions.width-obj.right+this.margins.left}if("top"in obj){this.offset.click.top=obj.top+this.margins.top}if("bottom"in obj){this.offset.click.top=this.helperProportions.height-obj.bottom+this.margins.top}},_getParentOffset:function(){
//Get the offsetParent and cache its position
this.offsetParent=this.helper.offsetParent();var po=this.offsetParent.offset();
// This is a special case where we need to modify a offset calculated on start, since the following happened:
// 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
// 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
//    the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
if(this.cssPosition==="absolute"&&this.scrollParent[0]!==this.document[0]&&$.contains(this.scrollParent[0],this.offsetParent[0])){po.left+=this.scrollParent.scrollLeft();po.top+=this.scrollParent.scrollTop()}
// This needs to be actually done for all browsers, since pageX/pageY includes this information
// with an ugly IE fix
if(this.offsetParent[0]===this.document[0].body||this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()==="html"&&$.ui.ie){po={top:0,left:0}}return{top:po.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:po.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition==="relative"){var p=this.currentItem.position();return{top:p.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:p.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}else{return{top:0,left:0}}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var ce,co,over,o=this.options;if(o.containment==="parent"){o.containment=this.helper[0].parentNode}if(o.containment==="document"||o.containment==="window"){this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,o.containment==="document"?this.document.width():this.window.width()-this.helperProportions.width-this.margins.left,(o.containment==="document"?this.document.width():this.window.height()||this.document[0].body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]}if(!/^(document|window|parent)$/.test(o.containment)){ce=$(o.containment)[0];co=$(o.containment).offset();over=$(ce).css("overflow")!=="hidden";this.containment=[co.left+(parseInt($(ce).css("borderLeftWidth"),10)||0)+(parseInt($(ce).css("paddingLeft"),10)||0)-this.margins.left,co.top+(parseInt($(ce).css("borderTopWidth"),10)||0)+(parseInt($(ce).css("paddingTop"),10)||0)-this.margins.top,co.left+(over?Math.max(ce.scrollWidth,ce.offsetWidth):ce.offsetWidth)-(parseInt($(ce).css("borderLeftWidth"),10)||0)-(parseInt($(ce).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,co.top+(over?Math.max(ce.scrollHeight,ce.offsetHeight):ce.offsetHeight)-(parseInt($(ce).css("borderTopWidth"),10)||0)-(parseInt($(ce).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top]}},_convertPositionTo:function(d,pos){if(!pos){pos=this.position}var mod=d==="absolute"?1:-1,scroll=this.cssPosition==="absolute"&&!(this.scrollParent[0]!==this.document[0]&&$.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,scrollIsRootNode=/(html|body)/i.test(scroll[0].tagName);return{top:pos.top+// The absolute mouse position
this.offset.relative.top*mod+// Only for relative positioned nodes: Relative offset from element to offset parent
this.offset.parent.top*mod-// The offsetParent's offset without borders (offset + border)
(this.cssPosition==="fixed"?-this.scrollParent.scrollTop():scrollIsRootNode?0:scroll.scrollTop())*mod,left:pos.left+// The absolute mouse position
this.offset.relative.left*mod+// Only for relative positioned nodes: Relative offset from element to offset parent
this.offset.parent.left*mod-// The offsetParent's offset without borders (offset + border)
(this.cssPosition==="fixed"?-this.scrollParent.scrollLeft():scrollIsRootNode?0:scroll.scrollLeft())*mod}},_generatePosition:function(event){var top,left,o=this.options,pageX=event.pageX,pageY=event.pageY,scroll=this.cssPosition==="absolute"&&!(this.scrollParent[0]!==this.document[0]&&$.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,scrollIsRootNode=/(html|body)/i.test(scroll[0].tagName);
// This is another very weird special case that only happens for relative elements:
// 1. If the css position is relative
// 2. and the scroll parent is the document or similar to the offset parent
// we have to refresh the relative offset during the scroll so there are no jumps
if(this.cssPosition==="relative"&&!(this.scrollParent[0]!==this.document[0]&&this.scrollParent[0]!==this.offsetParent[0])){this.offset.relative=this._getRelativeOffset()}
/*
		 * - Position constraining -
		 * Constrain the position to a mix of grid, containment.
		 */if(this.originalPosition){//If we are not dragging yet, we won't check for options
if(this.containment){if(event.pageX-this.offset.click.left<this.containment[0]){pageX=this.containment[0]+this.offset.click.left}if(event.pageY-this.offset.click.top<this.containment[1]){pageY=this.containment[1]+this.offset.click.top}if(event.pageX-this.offset.click.left>this.containment[2]){pageX=this.containment[2]+this.offset.click.left}if(event.pageY-this.offset.click.top>this.containment[3]){pageY=this.containment[3]+this.offset.click.top}}if(o.grid){top=this.originalPageY+Math.round((pageY-this.originalPageY)/o.grid[1])*o.grid[1];pageY=this.containment?top-this.offset.click.top>=this.containment[1]&&top-this.offset.click.top<=this.containment[3]?top:top-this.offset.click.top>=this.containment[1]?top-o.grid[1]:top+o.grid[1]:top;left=this.originalPageX+Math.round((pageX-this.originalPageX)/o.grid[0])*o.grid[0];pageX=this.containment?left-this.offset.click.left>=this.containment[0]&&left-this.offset.click.left<=this.containment[2]?left:left-this.offset.click.left>=this.containment[0]?left-o.grid[0]:left+o.grid[0]:left}}return{top:pageY-// The absolute mouse position
this.offset.click.top-// Click offset (relative to the element)
this.offset.relative.top-// Only for relative positioned nodes: Relative offset from element to offset parent
this.offset.parent.top+(// The offsetParent's offset without borders (offset + border)
this.cssPosition==="fixed"?-this.scrollParent.scrollTop():scrollIsRootNode?0:scroll.scrollTop()),left:pageX-// The absolute mouse position
this.offset.click.left-// Click offset (relative to the element)
this.offset.relative.left-// Only for relative positioned nodes: Relative offset from element to offset parent
this.offset.parent.left+(// The offsetParent's offset without borders (offset + border)
this.cssPosition==="fixed"?-this.scrollParent.scrollLeft():scrollIsRootNode?0:scroll.scrollLeft())}},_rearrange:function(event,i,a,hardRefresh){a?a[0].appendChild(this.placeholder[0]):i.item[0].parentNode.insertBefore(this.placeholder[0],this.direction==="down"?i.item[0]:i.item[0].nextSibling);
//Various things done here to improve the performance:
// 1. we create a setTimeout, that calls refreshPositions
// 2. on the instance, we have a counter variable, that get's higher after every append
// 3. on the local scope, we copy the counter variable, and check in the timeout, if it's still the same
// 4. this lets only the last addition to the timeout stack through
this.counter=this.counter?++this.counter:1;var counter=this.counter;this._delay(function(){if(counter===this.counter){this.refreshPositions(!hardRefresh);//Precompute after each DOM insertion, NOT on mousemove
}})},_clear:function(event,noPropagation){this.reverting=false;
// We delay all events that have to be triggered to after the point where the placeholder has been removed and
// everything else normalized again
var i,delayedTriggers=[];
// We first have to update the dom position of the actual currentItem
// Note: don't do it if the current item is already removed (by a user), or it gets reappended (see #4088)
if(!this._noFinalSort&&this.currentItem.parent().length){this.placeholder.before(this.currentItem)}this._noFinalSort=null;if(this.helper[0]===this.currentItem[0]){for(i in this._storedCSS){if(this._storedCSS[i]==="auto"||this._storedCSS[i]==="static"){this._storedCSS[i]=""}}this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else{this.currentItem.show()}if(this.fromOutside&&!noPropagation){delayedTriggers.push(function(event){this._trigger("receive",event,this._uiHash(this.fromOutside))})}if((this.fromOutside||this.domPosition.prev!==this.currentItem.prev().not(".ui-sortable-helper")[0]||this.domPosition.parent!==this.currentItem.parent()[0])&&!noPropagation){delayedTriggers.push(function(event){this._trigger("update",event,this._uiHash())});//Trigger update callback if the DOM position has changed
}
// Check if the items Container has Changed and trigger appropriate
// events.
if(this!==this.currentContainer){if(!noPropagation){delayedTriggers.push(function(event){this._trigger("remove",event,this._uiHash())});delayedTriggers.push(function(c){return function(event){c._trigger("receive",event,this._uiHash(this))}}.call(this,this.currentContainer));delayedTriggers.push(function(c){return function(event){c._trigger("update",event,this._uiHash(this))}}.call(this,this.currentContainer))}}
//Post events to containers
function delayEvent(type,instance,container){return function(event){container._trigger(type,event,instance._uiHash(instance))}}for(i=this.containers.length-1;i>=0;i--){if(!noPropagation){delayedTriggers.push(delayEvent("deactivate",this,this.containers[i]))}if(this.containers[i].containerCache.over){delayedTriggers.push(delayEvent("out",this,this.containers[i]));this.containers[i].containerCache.over=0}}
//Do what was originally in plugins
if(this.storedCursor){this.document.find("body").css("cursor",this.storedCursor);this.storedStylesheet.remove()}if(this._storedOpacity){this.helper.css("opacity",this._storedOpacity)}if(this._storedZIndex){this.helper.css("zIndex",this._storedZIndex==="auto"?"":this._storedZIndex)}this.dragging=false;if(!noPropagation){this._trigger("beforeStop",event,this._uiHash())}
//$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!
this.placeholder[0].parentNode.removeChild(this.placeholder[0]);if(!this.cancelHelperRemoval){if(this.helper[0]!==this.currentItem[0]){this.helper.remove()}this.helper=null}if(!noPropagation){for(i=0;i<delayedTriggers.length;i++){delayedTriggers[i].call(this,event)}//Trigger all delayed events
this._trigger("stop",event,this._uiHash())}this.fromOutside=false;return!this.cancelHelperRemoval},_trigger:function(){if($.Widget.prototype._trigger.apply(this,arguments)===false){this.cancel()}},_uiHash:function(_inst){var inst=_inst||this;return{helper:inst.helper,placeholder:inst.placeholder||$([]),position:inst.position,originalPosition:inst.originalPosition,offset:inst.positionAbs,item:inst.currentItem,sender:_inst?_inst.element:null}}})});
/*!
 * jQuery Validation Plugin v1.13.1
 *
 * http://jqueryvalidation.org/
 *
 * Copyright (c) 2014 Jörn Zaefferer
 * Released under the MIT license
 */
(function(factory){if(typeof define==="function"&&define.amd){define(["jquery"],factory)}else{factory(jQuery)}})(function($){$.extend($.fn,{
// http://jqueryvalidation.org/validate/
validate:function(options){
// if nothing is selected, return nothing; can't chain anyway
if(!this.length){if(options&&options.debug&&window.console){console.warn("Nothing selected, can't validate, returning nothing.")}return}
// check if a validator for this form was already created
var validator=$.data(this[0],"validator");if(validator){return validator}
// Add novalidate tag if HTML5.
this.attr("novalidate","novalidate");validator=new $.validator(options,this[0]);$.data(this[0],"validator",validator);if(validator.settings.onsubmit){this.validateDelegate(":submit","click",function(event){if(validator.settings.submitHandler){validator.submitButton=event.target}
// allow suppressing validation by adding a cancel class to the submit button
if($(event.target).hasClass("cancel")){validator.cancelSubmit=true}
// allow suppressing validation by adding the html5 formnovalidate attribute to the submit button
if($(event.target).attr("formnovalidate")!==undefined){validator.cancelSubmit=true}});
// validate the form on submit
this.submit(function(event){if(validator.settings.debug){
// prevent form submit to be able to see console output
event.preventDefault()}function handle(){var hidden,result;if(validator.settings.submitHandler){if(validator.submitButton){
// insert a hidden input as a replacement for the missing submit button
hidden=$("<input type='hidden'/>").attr("name",validator.submitButton.name).val($(validator.submitButton).val()).appendTo(validator.currentForm)}result=validator.settings.submitHandler.call(validator,validator.currentForm,event);if(validator.submitButton){
// and clean up afterwards; thanks to no-block-scope, hidden can be referenced
hidden.remove()}if(result!==undefined){return result}return false}return true}
// prevent submit for invalid forms or custom submit handlers
if(validator.cancelSubmit){validator.cancelSubmit=false;return handle()}if(validator.form()){if(validator.pendingRequest){validator.formSubmitted=true;return false}return handle()}else{validator.focusInvalid();return false}})}return validator},
// http://jqueryvalidation.org/valid/
valid:function(){var valid,validator;if($(this[0]).is("form")){valid=this.validate().form()}else{valid=true;validator=$(this[0].form).validate();this.each(function(){valid=validator.element(this)&&valid})}return valid},
// attributes: space separated list of attributes to retrieve and remove
removeAttrs:function(attributes){var result={},$element=this;$.each(attributes.split(/\s/),function(index,value){result[value]=$element.attr(value);$element.removeAttr(value)});return result},
// http://jqueryvalidation.org/rules/
rules:function(command,argument){var element=this[0],settings,staticRules,existingRules,data,param,filtered;if(command){settings=$.data(element.form,"validator").settings;staticRules=settings.rules;existingRules=$.validator.staticRules(element);switch(command){case"add":$.extend(existingRules,$.validator.normalizeRule(argument));
// remove messages from rules, but allow them to be set separately
delete existingRules.messages;staticRules[element.name]=existingRules;if(argument.messages){settings.messages[element.name]=$.extend(settings.messages[element.name],argument.messages)}break;case"remove":if(!argument){delete staticRules[element.name];return existingRules}filtered={};$.each(argument.split(/\s/),function(index,method){filtered[method]=existingRules[method];delete existingRules[method];if(method==="required"){$(element).removeAttr("aria-required")}});return filtered}}data=$.validator.normalizeRules($.extend({},$.validator.classRules(element),$.validator.attributeRules(element),$.validator.dataRules(element),$.validator.staticRules(element)),element);
// make sure required is at front
if(data.required){param=data.required;delete data.required;data=$.extend({required:param},data);$(element).attr("aria-required","true")}
// make sure remote is at back
if(data.remote){param=data.remote;delete data.remote;data=$.extend(data,{remote:param})}return data}});
// Custom selectors
$.extend($.expr[":"],{
// http://jqueryvalidation.org/blank-selector/
blank:function(a){return!$.trim(""+$(a).val())},
// http://jqueryvalidation.org/filled-selector/
filled:function(a){return!!$.trim(""+$(a).val())},
// http://jqueryvalidation.org/unchecked-selector/
unchecked:function(a){return!$(a).prop("checked")}});
// constructor for validator
$.validator=function(options,form){this.settings=$.extend(true,{},$.validator.defaults,options);this.currentForm=form;this.init()};
// http://jqueryvalidation.org/jQuery.validator.format/
$.validator.format=function(source,params){if(arguments.length===1){return function(){var args=$.makeArray(arguments);args.unshift(source);return $.validator.format.apply(this,args)}}if(arguments.length>2&&params.constructor!==Array){params=$.makeArray(arguments).slice(1)}if(params.constructor!==Array){params=[params]}$.each(params,function(i,n){source=source.replace(new RegExp("\\{"+i+"\\}","g"),function(){return n})});return source};$.extend($.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",validClass:"valid",errorElement:"label",focusCleanup:false,focusInvalid:true,errorContainer:$([]),errorLabelContainer:$([]),onsubmit:true,ignore:":hidden",ignoreTitle:false,onfocusin:function(element){this.lastActive=element;
// Hide error label and remove error class on focus if enabled
if(this.settings.focusCleanup){if(this.settings.unhighlight){this.settings.unhighlight.call(this,element,this.settings.errorClass,this.settings.validClass)}this.hideThese(this.errorsFor(element))}},onfocusout:function(element){if(!this.checkable(element)&&(element.name in this.submitted||!this.optional(element))){this.element(element)}},onkeyup:function(element,event){if(event.which===9&&this.elementValue(element)===""){return}else if(element.name in this.submitted||element===this.lastElement){this.element(element)}},onclick:function(element){
// click on selects, radiobuttons and checkboxes
if(element.name in this.submitted){this.element(element);
// or option elements, check parent select in that case
}else if(element.parentNode.name in this.submitted){this.element(element.parentNode)}},highlight:function(element,errorClass,validClass){if(element.type==="radio"){this.findByName(element.name).addClass(errorClass).removeClass(validClass)}else{$(element).addClass(errorClass).removeClass(validClass)}},unhighlight:function(element,errorClass,validClass){if(element.type==="radio"){this.findByName(element.name).removeClass(errorClass).addClass(validClass)}else{$(element).removeClass(errorClass).addClass(validClass)}}},
// http://jqueryvalidation.org/jQuery.validator.setDefaults/
setDefaults:function(settings){$.extend($.validator.defaults,settings)},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date ( ISO ).",number:"Please enter a valid number.",digits:"Please enter only digits.",creditcard:"Please enter a valid credit card number.",equalTo:"Please enter the same value again.",maxlength:$.validator.format("Please enter no more than {0} characters."),minlength:$.validator.format("Please enter at least {0} characters."),rangelength:$.validator.format("Please enter a value between {0} and {1} characters long."),range:$.validator.format("Please enter a value between {0} and {1}."),max:$.validator.format("Please enter a value less than or equal to {0}."),min:$.validator.format("Please enter a value greater than or equal to {0}.")},autoCreateRanges:false,prototype:{init:function(){this.labelContainer=$(this.settings.errorLabelContainer);this.errorContext=this.labelContainer.length&&this.labelContainer||$(this.currentForm);this.containers=$(this.settings.errorContainer).add(this.settings.errorLabelContainer);this.submitted={};this.valueCache={};this.pendingRequest=0;this.pending={};this.invalid={};this.reset();var groups=this.groups={},rules;$.each(this.settings.groups,function(key,value){if(typeof value==="string"){value=value.split(/\s/)}$.each(value,function(index,name){groups[name]=key})});rules=this.settings.rules;$.each(rules,function(key,value){rules[key]=$.validator.normalizeRule(value)});function delegate(event){var validator=$.data(this[0].form,"validator"),eventType="on"+event.type.replace(/^validate/,""),settings=validator.settings;if(settings[eventType]&&!this.is(settings.ignore)){settings[eventType].call(validator,this[0],event)}}$(this.currentForm).validateDelegate(":text, [type='password'], [type='file'], select, textarea, "+"[type='number'], [type='search'] ,[type='tel'], [type='url'], "+"[type='email'], [type='datetime'], [type='date'], [type='month'], "+"[type='week'], [type='time'], [type='datetime-local'], "+"[type='range'], [type='color'], [type='radio'], [type='checkbox']","focusin focusout keyup",delegate).validateDelegate("select, option, [type='radio'], [type='checkbox']","click",delegate);if(this.settings.invalidHandler){$(this.currentForm).bind("invalid-form.validate",this.settings.invalidHandler)}
// Add aria-required to any Static/Data/Class required fields before first validation
// Screen readers require this attribute to be present before the initial submission http://www.w3.org/TR/WCAG-TECHS/ARIA2.html
$(this.currentForm).find("[required], [data-rule-required], .required").attr("aria-required","true")},
// http://jqueryvalidation.org/Validator.form/
form:function(){this.checkForm();$.extend(this.submitted,this.errorMap);this.invalid=$.extend({},this.errorMap);if(!this.valid()){$(this.currentForm).triggerHandler("invalid-form",[this])}this.showErrors();return this.valid()},checkForm:function(){this.prepareForm();for(var i=0,elements=this.currentElements=this.elements();elements[i];i++){this.check(elements[i])}return this.valid()},
// http://jqueryvalidation.org/Validator.element/
element:function(element){var cleanElement=this.clean(element),checkElement=this.validationTargetFor(cleanElement),result=true;this.lastElement=checkElement;if(checkElement===undefined){delete this.invalid[cleanElement.name]}else{this.prepareElement(checkElement);this.currentElements=$(checkElement);result=this.check(checkElement)!==false;if(result){delete this.invalid[checkElement.name]}else{this.invalid[checkElement.name]=true}}
// Add aria-invalid status for screen readers
$(element).attr("aria-invalid",!result);if(!this.numberOfInvalids()){
// Hide error containers on last error
this.toHide=this.toHide.add(this.containers)}this.showErrors();return result},
// http://jqueryvalidation.org/Validator.showErrors/
showErrors:function(errors){if(errors){
// add items to error list and map
$.extend(this.errorMap,errors);this.errorList=[];for(var name in errors){this.errorList.push({message:errors[name],element:this.findByName(name)[0]})}
// remove items from success list
this.successList=$.grep(this.successList,function(element){return!(element.name in errors)})}if(this.settings.showErrors){this.settings.showErrors.call(this,this.errorMap,this.errorList)}else{this.defaultShowErrors()}},
// http://jqueryvalidation.org/Validator.resetForm/
resetForm:function(){if($.fn.resetForm){$(this.currentForm).resetForm()}this.submitted={};this.lastElement=null;this.prepareForm();this.hideErrors();this.elements().removeClass(this.settings.errorClass).removeData("previousValue").removeAttr("aria-invalid")},numberOfInvalids:function(){return this.objectLength(this.invalid)},objectLength:function(obj){
/* jshint unused: false */
var count=0,i;for(i in obj){count++}return count},hideErrors:function(){this.hideThese(this.toHide)},hideThese:function(errors){errors.not(this.containers).text("");this.addWrapper(errors).hide()},valid:function(){return this.size()===0},size:function(){return this.errorList.length},focusInvalid:function(){if(this.settings.focusInvalid){try{$(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin")}catch(e){
// ignore IE throwing errors when focusing hidden elements
}}},findLastActive:function(){var lastActive=this.lastActive;return lastActive&&$.grep(this.errorList,function(n){return n.element.name===lastActive.name}).length===1&&lastActive},elements:function(){var validator=this,rulesCache={};
// select all valid inputs inside the form (no submit or reset buttons)
return $(this.currentForm).find("input, select, textarea").not(":submit, :reset, :image, [disabled], [readonly]").not(this.settings.ignore).filter(function(){if(!this.name&&validator.settings.debug&&window.console){console.error("%o has no name assigned",this)}
// select only the first element for each name, and only those with rules specified
if(this.name in rulesCache||!validator.objectLength($(this).rules())){return false}rulesCache[this.name]=true;return true})},clean:function(selector){return $(selector)[0]},errors:function(){var errorClass=this.settings.errorClass.split(" ").join(".");return $(this.settings.errorElement+"."+errorClass,this.errorContext)},reset:function(){this.successList=[];this.errorList=[];this.errorMap={};this.toShow=$([]);this.toHide=$([]);this.currentElements=$([])},prepareForm:function(){this.reset();this.toHide=this.errors().add(this.containers)},prepareElement:function(element){this.reset();this.toHide=this.errorsFor(element)},elementValue:function(element){var val,$element=$(element),type=element.type;if(type==="radio"||type==="checkbox"){return $("input[name='"+element.name+"']:checked").val()}else if(type==="number"&&typeof element.validity!=="undefined"){return element.validity.badInput?false:$element.val()}val=$element.val();if(typeof val==="string"){return val.replace(/\r/g,"")}return val},check:function(element){element=this.validationTargetFor(this.clean(element));var rules=$(element).rules(),rulesCount=$.map(rules,function(n,i){return i}).length,dependencyMismatch=false,val=this.elementValue(element),result,method,rule;for(method in rules){rule={method:method,parameters:rules[method]};try{result=$.validator.methods[method].call(this,val,element,rule.parameters);
// if a method indicates that the field is optional and therefore valid,
// don't mark it as valid when there are no other rules
if(result==="dependency-mismatch"&&rulesCount===1){dependencyMismatch=true;continue}dependencyMismatch=false;if(result==="pending"){this.toHide=this.toHide.not(this.errorsFor(element));return}if(!result){this.formatAndAdd(element,rule);return false}}catch(e){if(this.settings.debug&&window.console){console.log("Exception occurred when checking element "+element.id+", check the '"+rule.method+"' method.",e)}throw e}}if(dependencyMismatch){return}if(this.objectLength(rules)){this.successList.push(element)}return true},
// return the custom message for the given element and validation method
// specified in the element's HTML5 data attribute
// return the generic message if present and no method specific message is present
customDataMessage:function(element,method){return $(element).data("msg"+method.charAt(0).toUpperCase()+method.substring(1).toLowerCase())||$(element).data("msg")},
// return the custom message for the given element name and validation method
customMessage:function(name,method){var m=this.settings.messages[name];return m&&(m.constructor===String?m:m[method])},
// return the first defined argument, allowing empty strings
findDefined:function(){for(var i=0;i<arguments.length;i++){if(arguments[i]!==undefined){return arguments[i]}}return undefined},defaultMessage:function(element,method){return this.findDefined(this.customMessage(element.name,method),this.customDataMessage(element,method),
// title is never undefined, so handle empty string as undefined
!this.settings.ignoreTitle&&element.title||undefined,$.validator.messages[method],"<strong>Warning: No message defined for "+element.name+"</strong>")},formatAndAdd:function(element,rule){var message=this.defaultMessage(element,rule.method),theregex=/\$?\{(\d+)\}/g;if(typeof message==="function"){message=message.call(this,rule.parameters,element)}else if(theregex.test(message)){message=$.validator.format(message.replace(theregex,"{$1}"),rule.parameters)}this.errorList.push({message:message,element:element,method:rule.method});this.errorMap[element.name]=message;this.submitted[element.name]=message},addWrapper:function(toToggle){if(this.settings.wrapper){toToggle=toToggle.add(toToggle.parent(this.settings.wrapper))}return toToggle},defaultShowErrors:function(){var i,elements,error;for(i=0;this.errorList[i];i++){error=this.errorList[i];if(this.settings.highlight){this.settings.highlight.call(this,error.element,this.settings.errorClass,this.settings.validClass)}this.showLabel(error.element,error.message)}if(this.errorList.length){this.toShow=this.toShow.add(this.containers)}if(this.settings.success){for(i=0;this.successList[i];i++){this.showLabel(this.successList[i])}}if(this.settings.unhighlight){for(i=0,elements=this.validElements();elements[i];i++){this.settings.unhighlight.call(this,elements[i],this.settings.errorClass,this.settings.validClass)}}this.toHide=this.toHide.not(this.toShow);this.hideErrors();this.addWrapper(this.toShow).show()},validElements:function(){return this.currentElements.not(this.invalidElements())},invalidElements:function(){return $(this.errorList).map(function(){return this.element})},showLabel:function(element,message){var place,group,errorID,error=this.errorsFor(element),elementID=this.idOrName(element),describedBy=$(element).attr("aria-describedby");if(error.length){
// refresh error/success class
error.removeClass(this.settings.validClass).addClass(this.settings.errorClass);
// replace message on existing label
error.html(message)}else{
// create error element
error=$("<"+this.settings.errorElement+">").attr("id",elementID+"-error").addClass(this.settings.errorClass).html(message||"");
// Maintain reference to the element to be placed into the DOM
place=error;if(this.settings.wrapper){
// make sure the element is visible, even in IE
// actually showing the wrapped element is handled elsewhere
place=error.hide().show().wrap("<"+this.settings.wrapper+"/>").parent()}if(this.labelContainer.length){this.labelContainer.append(place)}else if(this.settings.errorPlacement){this.settings.errorPlacement(place,$(element))}else{place.insertAfter(element)}
// Link error back to the element
if(error.is("label")){
// If the error is a label, then associate using 'for'
error.attr("for",elementID)}else if(error.parents("label[for='"+elementID+"']").length===0){
// If the element is not a child of an associated label, then it's necessary
// to explicitly apply aria-describedby
errorID=error.attr("id").replace(/(:|\.|\[|\])/g,"\\$1");
// Respect existing non-error aria-describedby
if(!describedBy){describedBy=errorID}else if(!describedBy.match(new RegExp("\\b"+errorID+"\\b"))){
// Add to end of list if not already present
describedBy+=" "+errorID}$(element).attr("aria-describedby",describedBy);
// If this element is grouped, then assign to all elements in the same group
group=this.groups[element.name];if(group){$.each(this.groups,function(name,testgroup){if(testgroup===group){$("[name='"+name+"']",this.currentForm).attr("aria-describedby",error.attr("id"))}})}}}if(!message&&this.settings.success){error.text("");if(typeof this.settings.success==="string"){error.addClass(this.settings.success)}else{this.settings.success(error,element)}}this.toShow=this.toShow.add(error)},errorsFor:function(element){var name=this.idOrName(element),describer=$(element).attr("aria-describedby"),selector="label[for='"+name+"'], label[for='"+name+"'] *";
// aria-describedby should directly reference the error element
if(describer){selector=selector+", #"+describer.replace(/\s+/g,", #")}return this.errors().filter(selector)},idOrName:function(element){return this.groups[element.name]||(this.checkable(element)?element.name:element.id||element.name)},validationTargetFor:function(element){
// If radio/checkbox, validate first element in group instead
if(this.checkable(element)){element=this.findByName(element.name)}
// Always apply ignore filter
return $(element).not(this.settings.ignore)[0]},checkable:function(element){return/radio|checkbox/i.test(element.type)},findByName:function(name){return $(this.currentForm).find("[name='"+name+"']")},getLength:function(value,element){switch(element.nodeName.toLowerCase()){case"select":return $("option:selected",element).length;case"input":if(this.checkable(element)){return this.findByName(element.name).filter(":checked").length}}return value.length},depend:function(param,element){return this.dependTypes[typeof param]?this.dependTypes[typeof param](param,element):true},dependTypes:{boolean:function(param){return param},string:function(param,element){return!!$(param,element.form).length},function:function(param,element){return param(element)}},optional:function(element){var val=this.elementValue(element);return!$.validator.methods.required.call(this,val,element)&&"dependency-mismatch"},startRequest:function(element){if(!this.pending[element.name]){this.pendingRequest++;this.pending[element.name]=true}},stopRequest:function(element,valid){this.pendingRequest--;
// sometimes synchronization fails, make sure pendingRequest is never < 0
if(this.pendingRequest<0){this.pendingRequest=0}delete this.pending[element.name];if(valid&&this.pendingRequest===0&&this.formSubmitted&&this.form()){$(this.currentForm).submit();this.formSubmitted=false}else if(!valid&&this.pendingRequest===0&&this.formSubmitted){$(this.currentForm).triggerHandler("invalid-form",[this]);this.formSubmitted=false}},previousValue:function(element){return $.data(element,"previousValue")||$.data(element,"previousValue",{old:null,valid:true,message:this.defaultMessage(element,"remote")})}},classRuleSettings:{required:{required:true},email:{email:true},url:{url:true},date:{date:true},dateISO:{dateISO:true},number:{number:true},digits:{digits:true},creditcard:{creditcard:true}},addClassRules:function(className,rules){if(className.constructor===String){this.classRuleSettings[className]=rules}else{$.extend(this.classRuleSettings,className)}},classRules:function(element){var rules={},classes=$(element).attr("class");if(classes){$.each(classes.split(" "),function(){if(this in $.validator.classRuleSettings){$.extend(rules,$.validator.classRuleSettings[this])}})}return rules},attributeRules:function(element){var rules={},$element=$(element),type=element.getAttribute("type"),method,value;for(method in $.validator.methods){
// support for <input required> in both html5 and older browsers
if(method==="required"){value=element.getAttribute(method);
// Some browsers return an empty string for the required attribute
// and non-HTML5 browsers might have required="" markup
if(value===""){value=true}
// force non-HTML5 browsers to return bool
value=!!value}else{value=$element.attr(method)}
// convert the value to a number for number inputs, and for text for backwards compability
// allows type="date" and others to be compared as strings
if(/min|max/.test(method)&&(type===null||/number|range|text/.test(type))){value=Number(value)}if(value||value===0){rules[method]=value}else if(type===method&&type!=="range"){
// exception: the jquery validate 'range' method
// does not test for the html5 'range' type
rules[method]=true}}
// maxlength may be returned as -1, 2147483647 ( IE ) and 524288 ( safari ) for text inputs
if(rules.maxlength&&/-1|2147483647|524288/.test(rules.maxlength)){delete rules.maxlength}return rules},dataRules:function(element){var method,value,rules={},$element=$(element);for(method in $.validator.methods){value=$element.data("rule"+method.charAt(0).toUpperCase()+method.substring(1).toLowerCase());if(value!==undefined){rules[method]=value}}return rules},staticRules:function(element){var rules={},validator=$.data(element.form,"validator");if(validator.settings.rules){rules=$.validator.normalizeRule(validator.settings.rules[element.name])||{}}return rules},normalizeRules:function(rules,element){
// handle dependency check
$.each(rules,function(prop,val){
// ignore rule when param is explicitly false, eg. required:false
if(val===false){delete rules[prop];return}if(val.param||val.depends){var keepRule=true;switch(typeof val.depends){case"string":keepRule=!!$(val.depends,element.form).length;break;case"function":keepRule=val.depends.call(element,element);break}if(keepRule){rules[prop]=val.param!==undefined?val.param:true}else{delete rules[prop]}}});
// evaluate parameters
$.each(rules,function(rule,parameter){rules[rule]=$.isFunction(parameter)?parameter(element):parameter});
// clean number parameters
$.each(["minlength","maxlength"],function(){if(rules[this]){rules[this]=Number(rules[this])}});$.each(["rangelength","range"],function(){var parts;if(rules[this]){if($.isArray(rules[this])){rules[this]=[Number(rules[this][0]),Number(rules[this][1])]}else if(typeof rules[this]==="string"){parts=rules[this].replace(/[\[\]]/g,"").split(/[\s,]+/);rules[this]=[Number(parts[0]),Number(parts[1])]}}});if($.validator.autoCreateRanges){
// auto-create ranges
if(rules.min!=null&&rules.max!=null){rules.range=[rules.min,rules.max];delete rules.min;delete rules.max}if(rules.minlength!=null&&rules.maxlength!=null){rules.rangelength=[rules.minlength,rules.maxlength];delete rules.minlength;delete rules.maxlength}}return rules},
// Converts a simple string to a {string: true} rule, e.g., "required" to {required:true}
normalizeRule:function(data){if(typeof data==="string"){var transformed={};$.each(data.split(/\s/),function(){transformed[this]=true});data=transformed}return data},
// http://jqueryvalidation.org/jQuery.validator.addMethod/
addMethod:function(name,method,message){$.validator.methods[name]=method;$.validator.messages[name]=message!==undefined?message:$.validator.messages[name];if(method.length<3){$.validator.addClassRules(name,$.validator.normalizeRule(name))}},methods:{
// http://jqueryvalidation.org/required-method/
required:function(value,element,param){
// check if dependency is met
if(!this.depend(param,element)){return"dependency-mismatch"}if(element.nodeName.toLowerCase()==="select"){
// could be an array for select-multiple or a string, both are fine this way
var val=$(element).val();return val&&val.length>0}if(this.checkable(element)){return this.getLength(value,element)>0}return $.trim(value).length>0},
// http://jqueryvalidation.org/email-method/
email:function(value,element){
// From http://www.whatwg.org/specs/web-apps/current-work/multipage/states-of-the-type-attribute.html#e-mail-state-%28type=email%29
// Retrieved 2014-01-14
// If you have a problem with this implementation, report a bug against the above spec
// Or use custom methods to implement your own email validation
return this.optional(element)||/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test(value)},
// http://jqueryvalidation.org/url-method/
url:function(value,element){
// contributed by Scott Gonzalez: http://projects.scottsplayground.com/iri/
return this.optional(element)||/^(https?|s?ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(value)},
// http://jqueryvalidation.org/date-method/
date:function(value,element){return this.optional(element)||!/Invalid|NaN/.test(new Date(value).toString())},
// http://jqueryvalidation.org/dateISO-method/
dateISO:function(value,element){return this.optional(element)||/^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/.test(value)},
// http://jqueryvalidation.org/number-method/
number:function(value,element){return this.optional(element)||/^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(value)},
// http://jqueryvalidation.org/digits-method/
digits:function(value,element){return this.optional(element)||/^\d+$/.test(value)},
// http://jqueryvalidation.org/creditcard-method/
// based on http://en.wikipedia.org/wiki/Luhn/
creditcard:function(value,element){if(this.optional(element)){return"dependency-mismatch"}
// accept only spaces, digits and dashes
if(/[^0-9 \-]+/.test(value)){return false}var nCheck=0,nDigit=0,bEven=false,n,cDigit;value=value.replace(/\D/g,"");
// Basing min and max length on
// http://developer.ean.com/general_info/Valid_Credit_Card_Types
if(value.length<13||value.length>19){return false}for(n=value.length-1;n>=0;n--){cDigit=value.charAt(n);nDigit=parseInt(cDigit,10);if(bEven){if((nDigit*=2)>9){nDigit-=9}}nCheck+=nDigit;bEven=!bEven}return nCheck%10===0},
// http://jqueryvalidation.org/minlength-method/
minlength:function(value,element,param){var length=$.isArray(value)?value.length:this.getLength(value,element);return this.optional(element)||length>=param},
// http://jqueryvalidation.org/maxlength-method/
maxlength:function(value,element,param){var length=$.isArray(value)?value.length:this.getLength(value,element);return this.optional(element)||length<=param},
// http://jqueryvalidation.org/rangelength-method/
rangelength:function(value,element,param){var length=$.isArray(value)?value.length:this.getLength(value,element);return this.optional(element)||length>=param[0]&&length<=param[1]},
// http://jqueryvalidation.org/min-method/
min:function(value,element,param){return this.optional(element)||value>=param},
// http://jqueryvalidation.org/max-method/
max:function(value,element,param){return this.optional(element)||value<=param},
// http://jqueryvalidation.org/range-method/
range:function(value,element,param){return this.optional(element)||value>=param[0]&&value<=param[1]},
// http://jqueryvalidation.org/equalTo-method/
equalTo:function(value,element,param){
// bind to the blur event of the target in order to revalidate whenever the target field is updated
// TODO find a way to bind the event just once, avoiding the unbind-rebind overhead
var target=$(param);if(this.settings.onfocusout){target.unbind(".validate-equalTo").bind("blur.validate-equalTo",function(){$(element).valid()})}return value===target.val()},
// http://jqueryvalidation.org/remote-method/
remote:function(value,element,param){if(this.optional(element)){return"dependency-mismatch"}var previous=this.previousValue(element),validator,data;if(!this.settings.messages[element.name]){this.settings.messages[element.name]={}}previous.originalMessage=this.settings.messages[element.name].remote;this.settings.messages[element.name].remote=previous.message;param=typeof param==="string"&&{url:param}||param;if(previous.old===value){return previous.valid}previous.old=value;validator=this;this.startRequest(element);data={};data[element.name]=value;$.ajax($.extend(true,{url:param,mode:"abort",port:"validate"+element.name,dataType:"json",data:data,context:validator.currentForm,success:function(response){var valid=response===true||response==="true",errors,message,submitted;validator.settings.messages[element.name].remote=previous.originalMessage;if(valid){submitted=validator.formSubmitted;validator.prepareElement(element);validator.formSubmitted=submitted;validator.successList.push(element);delete validator.invalid[element.name];validator.showErrors()}else{errors={};message=response||validator.defaultMessage(element,"remote");errors[element.name]=previous.message=$.isFunction(message)?message(value):message;validator.invalid[element.name]=true;validator.showErrors(errors)}previous.valid=valid;validator.stopRequest(element,valid)}},param));return"pending"}}});$.format=function deprecated(){throw"$.format has been deprecated. Please use $.validator.format instead."};
// ajax mode: abort
// usage: $.ajax({ mode: "abort"[, port: "uniqueport"]});
// if mode:"abort" is used, the previous request on that port (port can be undefined) is aborted via XMLHttpRequest.abort()
var pendingRequests={},ajax;
// Use a prefilter if available (1.5+)
if($.ajaxPrefilter){$.ajaxPrefilter(function(settings,_,xhr){var port=settings.port;if(settings.mode==="abort"){if(pendingRequests[port]){pendingRequests[port].abort()}pendingRequests[port]=xhr}})}else{
// Proxy ajax
ajax=$.ajax;$.ajax=function(settings){var mode=("mode"in settings?settings:$.ajaxSettings).mode,port=("port"in settings?settings:$.ajaxSettings).port;if(mode==="abort"){if(pendingRequests[port]){pendingRequests[port].abort()}pendingRequests[port]=ajax.apply(this,arguments);return pendingRequests[port]}return ajax.apply(this,arguments)}}
// provides delegate(type: String, delegate: Selector, handler: Callback) plugin for easier event delegation
// handler is only called when $(event.target).is(delegate), in the scope of the jquery-object for event.target
$.extend($.fn,{validateDelegate:function(delegate,type,handler){return this.bind(type,function(event){var target=$(event.target);if(target.is(delegate)){return handler.apply(target,arguments)}})}})});(function(root,factory){if(typeof define==="function"&&define.amd){define(factory)}else if(typeof exports==="object"){module.exports=factory(require,exports,module)}else{root.ouibounce=factory()}})(this,function(require,exports,module){return function ouibounce(el,custom_config){"use strict";var config=custom_config||{},aggressive=config.aggressive||false,sensitivity=setDefault(config.sensitivity,20),timer=setDefault(config.timer,1e3),delay=setDefault(config.delay,0),callback=config.callback||function(){},cookieExpire=setDefaultCookieExpire(config.cookieExpire)||"",cookieDomain=config.cookieDomain?";domain="+config.cookieDomain:"",cookieName=config.cookieName?config.cookieName:"viewedOuibounceModal",sitewide=config.sitewide===true?";path=/":"",_delayTimer=null,_html=document.documentElement;function setDefault(_property,_default){return typeof _property==="undefined"?_default:_property}function setDefaultCookieExpire(days){
// transform days to milliseconds
var ms=days*24*60*60*1e3;var date=new Date;date.setTime(date.getTime()+ms);return"; expires="+date.toUTCString()}setTimeout(attachOuiBounce,timer);function attachOuiBounce(){if(isDisabled()){return}_html.addEventListener("mouseleave",handleMouseleave);_html.addEventListener("mouseenter",handleMouseenter);_html.addEventListener("keydown",handleKeydown)}function handleMouseleave(e){if(e.clientY>sensitivity){return}_delayTimer=setTimeout(fire,delay)}function handleMouseenter(){if(_delayTimer){clearTimeout(_delayTimer);_delayTimer=null}}var disableKeydown=false;function handleKeydown(e){if(disableKeydown){return}else if(!e.metaKey||e.keyCode!==76){return}disableKeydown=true;_delayTimer=setTimeout(fire,delay)}function checkCookieValue(cookieName,value){return parseCookies()[cookieName]===value}function parseCookies(){
// cookies are separated by '; '
var cookies=document.cookie.split("; ");var ret={};for(var i=cookies.length-1;i>=0;i--){var el=cookies[i].split("=");ret[el[0]]=el[1]}return ret}function isDisabled(){return checkCookieValue(cookieName,"true")&&!aggressive}
// You can use ouibounce without passing an element
// https://github.com/carlsednaoui/ouibounce/issues/30
function fire(){if(isDisabled()){return}if(el){el.style.display="block"}callback();disable()}function disable(custom_options){var options=custom_options||{};
// you can pass a specific cookie expiration when using the OuiBounce API
// ex: _ouiBounce.disable({ cookieExpire: 5 });
if(typeof options.cookieExpire!=="undefined"){cookieExpire=setDefaultCookieExpire(options.cookieExpire)}
// you can pass use sitewide cookies too
// ex: _ouiBounce.disable({ cookieExpire: 5, sitewide: true });
if(options.sitewide===true){sitewide=";path=/"}
// you can pass a domain string when the cookie should be read subdomain-wise
// ex: _ouiBounce.disable({ cookieDomain: '.example.com' });
if(typeof options.cookieDomain!=="undefined"){cookieDomain=";domain="+options.cookieDomain}if(typeof options.cookieName!=="undefined"){cookieName=options.cookieName}document.cookie=cookieName+"=true"+cookieExpire+cookieDomain+sitewide;
// remove listeners
_html.removeEventListener("mouseleave",handleMouseleave);_html.removeEventListener("mouseenter",handleMouseenter);_html.removeEventListener("keydown",handleKeydown)}return{fire:fire,disable:disable,isDisabled:isDisabled}}
/*exported ouibounce */});
/*
     _ _      _       _
 ___| (_) ___| | __  (_)___
/ __| | |/ __| |/ /  | / __|
\__ \ | | (__|   < _ | \__ \
|___/_|_|\___|_|\_(_)/ |___/
                   |__/

 Version: 1.9.0
  Author: Ken Wheeler
 Website: http://kenwheeler.github.io
    Docs: http://kenwheeler.github.io/slick
    Repo: http://github.com/kenwheeler/slick
  Issues: http://github.com/kenwheeler/slick/issues

 */
/* global window, document, define, jQuery, setInterval, clearInterval */(function(factory){"use strict";if(typeof define==="function"&&define.amd){define(["jquery"],factory)}else if(typeof exports!=="undefined"){module.exports=factory(require("jquery"))}else{factory(jQuery)}})(function($){"use strict";var Slick=window.Slick||{};Slick=function(){var instanceUid=0;function Slick(element,settings){var _=this,dataSettings;_.defaults={accessibility:true,adaptiveHeight:false,appendArrows:$(element),appendDots:$(element),arrows:true,asNavFor:null,prevArrow:'<button type="button" data-role="none" class="button button--flat slick-prev" aria-label="previous"><span class="icon-left-open-big"></span></button>',nextArrow:'<button type="button" data-role="none" class="button button--flat slick-next" aria-label="next"><span class="icon-right-open-big"></span></button>',autoplay:false,autoplaySpeed:3e3,centerMode:false,centerPadding:"50px",cssEase:"ease",customPaging:function(slider,i){return $('<button type="button" />').text(i+1)},dots:false,dotsClass:"slick-dots",draggable:true,easing:"linear",edgeFriction:.35,fade:false,focusOnSelect:false,focusOnChange:false,infinite:true,initialSlide:0,lazyLoad:"ondemand",mobileFirst:false,pauseOnHover:true,pauseOnFocus:true,pauseOnDotsHover:false,respondTo:"window",responsive:null,rows:1,rtl:false,slide:"",slidesPerRow:1,slidesToShow:1,slidesToScroll:1,speed:500,swipe:true,swipeToSlide:false,touchMove:true,touchThreshold:5,useCSS:true,useTransform:true,variableWidth:false,vertical:false,verticalSwiping:false,waitForAnimate:true,zIndex:1e3};_.initials={animating:false,dragging:false,autoPlayTimer:null,currentDirection:0,currentLeft:null,currentSlide:0,direction:1,$dots:null,listWidth:null,listHeight:null,loadIndex:0,$nextArrow:null,$prevArrow:null,scrolling:false,slideCount:null,slideWidth:null,$slideTrack:null,$slides:null,sliding:false,slideOffset:0,swipeLeft:null,swiping:false,$list:null,touchObject:{},transformsEnabled:false,unslicked:false};$.extend(_,_.initials);_.activeBreakpoint=null;_.animType=null;_.animProp=null;_.breakpoints=[];_.breakpointSettings=[];_.cssTransitions=false;_.focussed=false;_.interrupted=false;_.hidden="hidden";_.paused=true;_.positionProp=null;_.respondTo=null;_.rowCount=1;_.shouldClick=true;_.$slider=$(element);_.$slidesCache=null;_.transformType=null;_.transitionType=null;_.visibilityChange="visibilitychange";_.windowWidth=0;_.windowTimer=null;dataSettings=$(element).data("slick")||{};_.options=$.extend({},_.defaults,settings,dataSettings);_.currentSlide=_.options.initialSlide;_.originalSettings=_.options;if(typeof document.mozHidden!=="undefined"){_.hidden="mozHidden";_.visibilityChange="mozvisibilitychange"}else if(typeof document.webkitHidden!=="undefined"){_.hidden="webkitHidden";_.visibilityChange="webkitvisibilitychange"}_.autoPlay=$.proxy(_.autoPlay,_);_.autoPlayClear=$.proxy(_.autoPlayClear,_);_.autoPlayIterator=$.proxy(_.autoPlayIterator,_);_.changeSlide=$.proxy(_.changeSlide,_);_.clickHandler=$.proxy(_.clickHandler,_);_.selectHandler=$.proxy(_.selectHandler,_);_.setPosition=$.proxy(_.setPosition,_);_.swipeHandler=$.proxy(_.swipeHandler,_);_.dragHandler=$.proxy(_.dragHandler,_);_.keyHandler=$.proxy(_.keyHandler,_);_.instanceUid=instanceUid++;
// A simple way to check for HTML strings
// Strict HTML recognition (must start with <)
// Extracted from jQuery v1.11 source
_.htmlExpr=/^(?:\s*(<[\w\W]+>)[^>]*)$/;_.registerBreakpoints();_.init(true)}return Slick}();Slick.prototype.activateADA=function(){var _=this;_.$slideTrack.find(".slick-active").attr({"aria-hidden":"false"}).find("a, input, button, select").attr({tabindex:"0"})};Slick.prototype.addSlide=Slick.prototype.slickAdd=function(markup,index,addBefore){var _=this;if(typeof index==="boolean"){addBefore=index;index=null}else if(index<0||index>=_.slideCount){return false}_.unload();if(typeof index==="number"){if(index===0&&_.$slides.length===0){$(markup).appendTo(_.$slideTrack)}else if(addBefore){$(markup).insertBefore(_.$slides.eq(index))}else{$(markup).insertAfter(_.$slides.eq(index))}}else{if(addBefore===true){$(markup).prependTo(_.$slideTrack)}else{$(markup).appendTo(_.$slideTrack)}}_.$slides=_.$slideTrack.children(this.options.slide);_.$slideTrack.children(this.options.slide).detach();_.$slideTrack.append(_.$slides);_.$slides.each(function(index,element){$(element).attr("data-slick-index",index)});_.$slidesCache=_.$slides;_.reinit()};Slick.prototype.animateHeight=function(){var _=this;if(_.options.slidesToShow===1&&_.options.adaptiveHeight===true&&_.options.vertical===false){var targetHeight=_.$slides.eq(_.currentSlide).outerHeight(true);_.$list.animate({height:targetHeight},_.options.speed)}};Slick.prototype.animateSlide=function(targetLeft,callback){var animProps={},_=this;_.animateHeight();if(_.options.rtl===true&&_.options.vertical===false){targetLeft=-targetLeft}if(_.transformsEnabled===false){if(_.options.vertical===false){_.$slideTrack.animate({left:targetLeft},_.options.speed,_.options.easing,callback)}else{_.$slideTrack.animate({top:targetLeft},_.options.speed,_.options.easing,callback)}}else{if(_.cssTransitions===false){if(_.options.rtl===true){_.currentLeft=-_.currentLeft}$({animStart:_.currentLeft}).animate({animStart:targetLeft},{duration:_.options.speed,easing:_.options.easing,step:function(now){now=Math.ceil(now);if(_.options.vertical===false){animProps[_.animType]="translate("+now+"px, 0px)";_.$slideTrack.css(animProps)}else{animProps[_.animType]="translate(0px,"+now+"px)";_.$slideTrack.css(animProps)}},complete:function(){if(callback){callback.call()}}})}else{_.applyTransition();targetLeft=Math.ceil(targetLeft);if(_.options.vertical===false){animProps[_.animType]="translate3d("+targetLeft+"px, 0px, 0px)"}else{animProps[_.animType]="translate3d(0px,"+targetLeft+"px, 0px)"}_.$slideTrack.css(animProps);if(callback){setTimeout(function(){_.disableTransition();callback.call()},_.options.speed)}}}};Slick.prototype.getNavTarget=function(){var _=this,asNavFor=_.options.asNavFor;if(asNavFor&&asNavFor!==null){asNavFor=$(asNavFor).not(_.$slider)}return asNavFor};Slick.prototype.asNavFor=function(index){var _=this,asNavFor=_.getNavTarget();if(asNavFor!==null&&typeof asNavFor==="object"){asNavFor.each(function(){var target=$(this).slick("getSlick");if(!target.unslicked){target.slideHandler(index,true)}})}};Slick.prototype.applyTransition=function(slide){var _=this,transition={};if(_.options.fade===false){transition[_.transitionType]=_.transformType+" "+_.options.speed+"ms "+_.options.cssEase}else{transition[_.transitionType]="opacity "+_.options.speed+"ms "+_.options.cssEase}if(_.options.fade===false){_.$slideTrack.css(transition)}else{_.$slides.eq(slide).css(transition)}};Slick.prototype.autoPlay=function(){var _=this;_.autoPlayClear();if(_.slideCount>_.options.slidesToShow){_.autoPlayTimer=setInterval(_.autoPlayIterator,_.options.autoplaySpeed)}};Slick.prototype.autoPlayClear=function(){var _=this;if(_.autoPlayTimer){clearInterval(_.autoPlayTimer)}};Slick.prototype.autoPlayIterator=function(){var _=this,slideTo=_.currentSlide+_.options.slidesToScroll;if(!_.paused&&!_.interrupted&&!_.focussed){if(_.options.infinite===false){if(_.direction===1&&_.currentSlide+1===_.slideCount-1){_.direction=0}else if(_.direction===0){slideTo=_.currentSlide-_.options.slidesToScroll;if(_.currentSlide-1===0){_.direction=1}}}_.slideHandler(slideTo)}};Slick.prototype.buildArrows=function(){var _=this;if(_.options.arrows===true){_.$prevArrow=$(_.options.prevArrow).addClass("slick-arrow");_.$nextArrow=$(_.options.nextArrow).addClass("slick-arrow");if(_.slideCount>_.options.slidesToShow){_.$prevArrow.removeClass("slick-hidden").removeAttr("aria-hidden tabindex");_.$nextArrow.removeClass("slick-hidden").removeAttr("aria-hidden tabindex");if(_.htmlExpr.test(_.options.prevArrow)){_.$prevArrow.prependTo(_.options.appendArrows)}if(_.htmlExpr.test(_.options.nextArrow)){_.$nextArrow.appendTo(_.options.appendArrows)}if(_.options.infinite!==true){_.$prevArrow.addClass("slick-disabled").attr("aria-disabled","true")}}else{_.$prevArrow.add(_.$nextArrow).addClass("slick-hidden").attr({"aria-disabled":"true",tabindex:"-1"})}}};Slick.prototype.buildDots=function(){var _=this,i,dot;if(_.options.dots===true&&_.slideCount>_.options.slidesToShow){_.$slider.addClass("slick-dotted");dot=$("<ul />").addClass(_.options.dotsClass);for(i=0;i<=_.getDotCount();i+=1){dot.append($("<li />").append(_.options.customPaging.call(this,_,i)))}_.$dots=dot.appendTo(_.options.appendDots);_.$dots.find("li").first().addClass("slick-active")}};Slick.prototype.buildOut=function(){var _=this;_.$slides=_.$slider.children(_.options.slide+":not(.slick-cloned)").addClass("slick-slide");_.slideCount=_.$slides.length;_.$slides.each(function(index,element){$(element).attr("data-slick-index",index).data("originalStyling",$(element).attr("style")||"")});_.$slider.addClass("slick-slider");_.$slideTrack=_.slideCount===0?$('<div class="slick-track"/>').appendTo(_.$slider):_.$slides.wrapAll('<div class="slick-track"/>').parent();_.$list=_.$slideTrack.wrap('<div class="slick-list"/>').parent();_.$slideTrack.css("opacity",0);if(_.options.centerMode===true||_.options.swipeToSlide===true){_.options.slidesToScroll=1}$("img[data-lazy]",_.$slider).not("[src]").addClass("slick-loading");_.setupInfinite();_.buildArrows();_.buildDots();_.updateDots();_.setSlideClasses(typeof _.currentSlide==="number"?_.currentSlide:0);if(_.options.draggable===true){_.$list.addClass("draggable")}};Slick.prototype.buildRows=function(){var _=this,a,b,c,newSlides,numOfSlides,originalSlides,slidesPerSection;newSlides=document.createDocumentFragment();originalSlides=_.$slider.children();if(_.options.rows>0){slidesPerSection=_.options.slidesPerRow*_.options.rows;numOfSlides=Math.ceil(originalSlides.length/slidesPerSection);for(a=0;a<numOfSlides;a++){var slide=document.createElement("div");for(b=0;b<_.options.rows;b++){var row=document.createElement("div");for(c=0;c<_.options.slidesPerRow;c++){var target=a*slidesPerSection+(b*_.options.slidesPerRow+c);if(originalSlides.get(target)){row.appendChild(originalSlides.get(target))}}slide.appendChild(row)}newSlides.appendChild(slide)}_.$slider.empty().append(newSlides);_.$slider.children().children().children().css({width:100/_.options.slidesPerRow+"%",display:"inline-block"})}};Slick.prototype.checkResponsive=function(initial,forceUpdate){var _=this,breakpoint,targetBreakpoint,respondToWidth,triggerBreakpoint=false;var sliderWidth=_.$slider.width();var windowWidth=window.innerWidth||$(window).width();if(_.respondTo==="window"){respondToWidth=windowWidth}else if(_.respondTo==="slider"){respondToWidth=sliderWidth}else if(_.respondTo==="min"){respondToWidth=Math.min(windowWidth,sliderWidth)}if(_.options.responsive&&_.options.responsive.length&&_.options.responsive!==null){targetBreakpoint=null;for(breakpoint in _.breakpoints){if(_.breakpoints.hasOwnProperty(breakpoint)){if(_.originalSettings.mobileFirst===false){if(respondToWidth<_.breakpoints[breakpoint]){targetBreakpoint=_.breakpoints[breakpoint]}}else{if(respondToWidth>_.breakpoints[breakpoint]){targetBreakpoint=_.breakpoints[breakpoint]}}}}if(targetBreakpoint!==null){if(_.activeBreakpoint!==null){if(targetBreakpoint!==_.activeBreakpoint||forceUpdate){_.activeBreakpoint=targetBreakpoint;if(_.breakpointSettings[targetBreakpoint]==="unslick"){_.unslick(targetBreakpoint)}else{_.options=$.extend({},_.originalSettings,_.breakpointSettings[targetBreakpoint]);if(initial===true){_.currentSlide=_.options.initialSlide}_.refresh(initial)}triggerBreakpoint=targetBreakpoint}}else{_.activeBreakpoint=targetBreakpoint;if(_.breakpointSettings[targetBreakpoint]==="unslick"){_.unslick(targetBreakpoint)}else{_.options=$.extend({},_.originalSettings,_.breakpointSettings[targetBreakpoint]);if(initial===true){_.currentSlide=_.options.initialSlide}_.refresh(initial)}triggerBreakpoint=targetBreakpoint}}else{if(_.activeBreakpoint!==null){_.activeBreakpoint=null;_.options=_.originalSettings;if(initial===true){_.currentSlide=_.options.initialSlide}_.refresh(initial);triggerBreakpoint=targetBreakpoint}}
// only trigger breakpoints during an actual break. not on initialize.
if(!initial&&triggerBreakpoint!==false){_.$slider.trigger("breakpoint",[_,triggerBreakpoint])}}};Slick.prototype.changeSlide=function(event,dontAnimate){var _=this,$target=$(event.currentTarget),indexOffset,slideOffset,unevenOffset;
// If target is a link, prevent default action.
if($target.is("a")){event.preventDefault()}
// If target is not the <li> element (ie: a child), find the <li>.
if(!$target.is("li")){$target=$target.closest("li")}unevenOffset=_.slideCount%_.options.slidesToScroll!==0;indexOffset=unevenOffset?0:(_.slideCount-_.currentSlide)%_.options.slidesToScroll;switch(event.data.message){case"previous":slideOffset=indexOffset===0?_.options.slidesToScroll:_.options.slidesToShow-indexOffset;if(_.slideCount>_.options.slidesToShow){_.slideHandler(_.currentSlide-slideOffset,false,dontAnimate)}break;case"next":slideOffset=indexOffset===0?_.options.slidesToScroll:indexOffset;if(_.slideCount>_.options.slidesToShow){_.slideHandler(_.currentSlide+slideOffset,false,dontAnimate)}break;case"index":var index=event.data.index===0?0:event.data.index||$target.index()*_.options.slidesToScroll;_.slideHandler(_.checkNavigable(index),false,dontAnimate);$target.children().trigger("focus");break;default:return}};Slick.prototype.checkNavigable=function(index){var _=this,navigables,prevNavigable;navigables=_.getNavigableIndexes();prevNavigable=0;if(index>navigables[navigables.length-1]){index=navigables[navigables.length-1]}else{for(var n in navigables){if(index<navigables[n]){index=prevNavigable;break}prevNavigable=navigables[n]}}return index};Slick.prototype.cleanUpEvents=function(){var _=this;if(_.options.dots&&_.$dots!==null){$("li",_.$dots).off("click.slick",_.changeSlide).off("mouseenter.slick",$.proxy(_.interrupt,_,true)).off("mouseleave.slick",$.proxy(_.interrupt,_,false));if(_.options.accessibility===true){_.$dots.off("keydown.slick",_.keyHandler)}}_.$slider.off("focus.slick blur.slick");if(_.options.arrows===true&&_.slideCount>_.options.slidesToShow){_.$prevArrow&&_.$prevArrow.off("click.slick",_.changeSlide);_.$nextArrow&&_.$nextArrow.off("click.slick",_.changeSlide);if(_.options.accessibility===true){_.$prevArrow&&_.$prevArrow.off("keydown.slick",_.keyHandler);_.$nextArrow&&_.$nextArrow.off("keydown.slick",_.keyHandler)}}_.$list.off("touchstart.slick mousedown.slick",_.swipeHandler);_.$list.off("touchmove.slick mousemove.slick",_.swipeHandler);_.$list.off("touchend.slick mouseup.slick",_.swipeHandler);_.$list.off("touchcancel.slick mouseleave.slick",_.swipeHandler);_.$list.off("click.slick",_.clickHandler);$(document).off(_.visibilityChange,_.visibility);_.cleanUpSlideEvents();if(_.options.accessibility===true){_.$list.off("keydown.slick",_.keyHandler)}if(_.options.focusOnSelect===true){$(_.$slideTrack).children().off("click.slick",_.selectHandler)}$(window).off("orientationchange.slick.slick-"+_.instanceUid,_.orientationChange);$(window).off("resize.slick.slick-"+_.instanceUid,_.resize);$("[draggable!=true]",_.$slideTrack).off("dragstart",_.preventDefault);$(window).off("load.slick.slick-"+_.instanceUid,_.setPosition)};Slick.prototype.cleanUpSlideEvents=function(){var _=this;_.$list.off("mouseenter.slick",$.proxy(_.interrupt,_,true));_.$list.off("mouseleave.slick",$.proxy(_.interrupt,_,false))};Slick.prototype.cleanUpRows=function(){var _=this,originalSlides;if(_.options.rows>0){originalSlides=_.$slides.children().children();originalSlides.removeAttr("style");_.$slider.empty().append(originalSlides)}};Slick.prototype.clickHandler=function(event){var _=this;if(_.shouldClick===false){event.stopImmediatePropagation();event.stopPropagation();event.preventDefault()}};Slick.prototype.destroy=function(refresh){var _=this;_.autoPlayClear();_.touchObject={};_.cleanUpEvents();$(".slick-cloned",_.$slider).detach();if(_.$dots){_.$dots.remove()}if(_.$prevArrow&&_.$prevArrow.length){_.$prevArrow.removeClass("slick-disabled slick-arrow slick-hidden").removeAttr("aria-hidden aria-disabled tabindex").css("display","");if(_.htmlExpr.test(_.options.prevArrow)){_.$prevArrow.remove()}}if(_.$nextArrow&&_.$nextArrow.length){_.$nextArrow.removeClass("slick-disabled slick-arrow slick-hidden").removeAttr("aria-hidden aria-disabled tabindex").css("display","");if(_.htmlExpr.test(_.options.nextArrow)){_.$nextArrow.remove()}}if(_.$slides){_.$slides.removeClass("slick-slide slick-active slick-center slick-visible slick-current").removeAttr("aria-hidden").removeAttr("data-slick-index").each(function(){$(this).attr("style",$(this).data("originalStyling"))});_.$slideTrack.children(this.options.slide).detach();_.$slideTrack.detach();_.$list.detach();_.$slider.append(_.$slides)}_.cleanUpRows();_.$slider.removeClass("slick-slider");_.$slider.removeClass("slick-initialized");_.$slider.removeClass("slick-dotted");_.unslicked=true;if(!refresh){_.$slider.trigger("destroy",[_])}};Slick.prototype.disableTransition=function(slide){var _=this,transition={};transition[_.transitionType]="";if(_.options.fade===false){_.$slideTrack.css(transition)}else{_.$slides.eq(slide).css(transition)}};Slick.prototype.fadeSlide=function(slideIndex,callback){var _=this;if(_.cssTransitions===false){_.$slides.eq(slideIndex).css({zIndex:_.options.zIndex});_.$slides.eq(slideIndex).animate({opacity:1},_.options.speed,_.options.easing,callback)}else{_.applyTransition(slideIndex);_.$slides.eq(slideIndex).css({opacity:1,zIndex:_.options.zIndex});if(callback){setTimeout(function(){_.disableTransition(slideIndex);callback.call()},_.options.speed)}}};Slick.prototype.fadeSlideOut=function(slideIndex){var _=this;if(_.cssTransitions===false){_.$slides.eq(slideIndex).animate({opacity:0,zIndex:_.options.zIndex-2},_.options.speed,_.options.easing)}else{_.applyTransition(slideIndex);_.$slides.eq(slideIndex).css({opacity:0,zIndex:_.options.zIndex-2})}};Slick.prototype.filterSlides=Slick.prototype.slickFilter=function(filter){var _=this;if(filter!==null){_.$slidesCache=_.$slides;_.unload();_.$slideTrack.children(this.options.slide).detach();_.$slidesCache.filter(filter).appendTo(_.$slideTrack);_.reinit()}};Slick.prototype.focusHandler=function(){var _=this;
// If any child element receives focus within the slider we need to pause the autoplay
_.$slider.off("focus.slick blur.slick").on("focus.slick","*",function(event){var $sf=$(this);setTimeout(function(){if(_.options.pauseOnFocus){if($sf.is(":focus")){_.focussed=true;_.autoPlay()}}},0)}).on("blur.slick","*",function(event){var $sf=$(this);
// When a blur occurs on any elements within the slider we become unfocused
if(_.options.pauseOnFocus){_.focussed=false;_.autoPlay()}})};Slick.prototype.getCurrent=Slick.prototype.slickCurrentSlide=function(){var _=this;return _.currentSlide};Slick.prototype.getDotCount=function(){var _=this;var breakPoint=0;var counter=0;var pagerQty=0;if(_.options.infinite===true){if(_.slideCount<=_.options.slidesToShow){++pagerQty}else{while(breakPoint<_.slideCount){++pagerQty;breakPoint=counter+_.options.slidesToScroll;counter+=_.options.slidesToScroll<=_.options.slidesToShow?_.options.slidesToScroll:_.options.slidesToShow}}}else if(_.options.centerMode===true){pagerQty=_.slideCount}else if(!_.options.asNavFor){pagerQty=1+Math.ceil((_.slideCount-_.options.slidesToShow)/_.options.slidesToScroll)}else{while(breakPoint<_.slideCount){++pagerQty;breakPoint=counter+_.options.slidesToScroll;counter+=_.options.slidesToScroll<=_.options.slidesToShow?_.options.slidesToScroll:_.options.slidesToShow}}return pagerQty-1};Slick.prototype.getLeft=function(slideIndex){var _=this,targetLeft,verticalHeight,verticalOffset=0,targetSlide,coef;_.slideOffset=0;verticalHeight=_.$slides.first().outerHeight(true);if(_.options.infinite===true){if(_.slideCount>_.options.slidesToShow){_.slideOffset=_.slideWidth*_.options.slidesToShow*-1;coef=-1;if(_.options.vertical===true&&_.options.centerMode===true){if(_.options.slidesToShow===2){coef=-1.5}else if(_.options.slidesToShow===1){coef=-2}}verticalOffset=verticalHeight*_.options.slidesToShow*coef}if(_.slideCount%_.options.slidesToScroll!==0){if(slideIndex+_.options.slidesToScroll>_.slideCount&&_.slideCount>_.options.slidesToShow){if(slideIndex>_.slideCount){_.slideOffset=(_.options.slidesToShow-(slideIndex-_.slideCount))*_.slideWidth*-1;verticalOffset=(_.options.slidesToShow-(slideIndex-_.slideCount))*verticalHeight*-1}else{_.slideOffset=_.slideCount%_.options.slidesToScroll*_.slideWidth*-1;verticalOffset=_.slideCount%_.options.slidesToScroll*verticalHeight*-1}}}}else{if(slideIndex+_.options.slidesToShow>_.slideCount){_.slideOffset=(slideIndex+_.options.slidesToShow-_.slideCount)*_.slideWidth;verticalOffset=(slideIndex+_.options.slidesToShow-_.slideCount)*verticalHeight}}if(_.slideCount<=_.options.slidesToShow){_.slideOffset=0;verticalOffset=0}if(_.options.centerMode===true&&_.slideCount<=_.options.slidesToShow){_.slideOffset=_.slideWidth*Math.floor(_.options.slidesToShow)/2-_.slideWidth*_.slideCount/2}else if(_.options.centerMode===true&&_.options.infinite===true){_.slideOffset+=_.slideWidth*Math.floor(_.options.slidesToShow/2)-_.slideWidth}else if(_.options.centerMode===true){_.slideOffset=0;_.slideOffset+=_.slideWidth*Math.floor(_.options.slidesToShow/2)}if(_.options.vertical===false){targetLeft=slideIndex*_.slideWidth*-1+_.slideOffset}else{targetLeft=slideIndex*verticalHeight*-1+verticalOffset}if(_.options.variableWidth===true){if(_.slideCount<=_.options.slidesToShow||_.options.infinite===false){targetSlide=_.$slideTrack.children(".slick-slide").eq(slideIndex)}else{targetSlide=_.$slideTrack.children(".slick-slide").eq(slideIndex+_.options.slidesToShow)}if(_.options.rtl===true){if(targetSlide[0]){targetLeft=(_.$slideTrack.width()-targetSlide[0].offsetLeft-targetSlide.width())*-1}else{targetLeft=0}}else{targetLeft=targetSlide[0]?targetSlide[0].offsetLeft*-1:0}if(_.options.centerMode===true){if(_.slideCount<=_.options.slidesToShow||_.options.infinite===false){targetSlide=_.$slideTrack.children(".slick-slide").eq(slideIndex)}else{targetSlide=_.$slideTrack.children(".slick-slide").eq(slideIndex+_.options.slidesToShow+1)}if(_.options.rtl===true){if(targetSlide[0]){targetLeft=(_.$slideTrack.width()-targetSlide[0].offsetLeft-targetSlide.width())*-1}else{targetLeft=0}}else{targetLeft=targetSlide[0]?targetSlide[0].offsetLeft*-1:0}targetLeft+=(_.$list.width()-targetSlide.outerWidth())/2}}return targetLeft};Slick.prototype.getOption=Slick.prototype.slickGetOption=function(option){var _=this;return _.options[option]};Slick.prototype.getNavigableIndexes=function(){var _=this,breakPoint=0,counter=0,indexes=[],max;if(_.options.infinite===false){max=_.slideCount}else{breakPoint=_.options.slidesToScroll*-1;counter=_.options.slidesToScroll*-1;max=_.slideCount*2}while(breakPoint<max){indexes.push(breakPoint);breakPoint=counter+_.options.slidesToScroll;counter+=_.options.slidesToScroll<=_.options.slidesToShow?_.options.slidesToScroll:_.options.slidesToShow}return indexes};Slick.prototype.getSlick=function(){return this};Slick.prototype.getSlideCount=function(){var _=this,slidesTraversed,swipedSlide,swipeTarget,centerOffset;centerOffset=_.options.centerMode===true?Math.floor(_.$list.width()/2):0;swipeTarget=_.swipeLeft*-1+centerOffset;if(_.options.swipeToSlide===true){_.$slideTrack.find(".slick-slide").each(function(index,slide){var slideOuterWidth,slideOffset,slideRightBoundary;slideOuterWidth=$(slide).outerWidth();slideOffset=slide.offsetLeft;if(_.options.centerMode!==true){slideOffset+=slideOuterWidth/2}slideRightBoundary=slideOffset+slideOuterWidth;if(swipeTarget<slideRightBoundary){swipedSlide=slide;return false}});slidesTraversed=Math.abs($(swipedSlide).attr("data-slick-index")-_.currentSlide)||1;return slidesTraversed}else{return _.options.slidesToScroll}};Slick.prototype.goTo=Slick.prototype.slickGoTo=function(slide,dontAnimate){var _=this;_.changeSlide({data:{message:"index",index:parseInt(slide)}},dontAnimate)};Slick.prototype.init=function(creation){var _=this;if(!$(_.$slider).hasClass("slick-initialized")){$(_.$slider).addClass("slick-initialized");_.buildRows();_.buildOut();_.setProps();_.startLoad();_.loadSlider();_.initializeEvents();_.updateArrows();_.updateDots();_.checkResponsive(true);_.focusHandler()}if(creation){_.$slider.trigger("init",[_])}if(_.options.accessibility===true){_.initADA()}if(_.options.autoplay){_.paused=false;_.autoPlay()}};Slick.prototype.initADA=function(){var _=this,numDotGroups=Math.ceil(_.slideCount/_.options.slidesToShow),tabControlIndexes=_.getNavigableIndexes().filter(function(val){return val>=0&&val<_.slideCount});_.$slides.add(_.$slideTrack.find(".slick-cloned")).attr({"aria-hidden":"true",tabindex:"-1"}).find("a, input, button, select").attr({tabindex:"-1"});if(_.$dots!==null){_.$slides.not(_.$slideTrack.find(".slick-cloned")).each(function(i){var slideControlIndex=tabControlIndexes.indexOf(i);$(this).attr({role:"tabpanel",id:"slick-slide"+_.instanceUid+i,tabindex:-1});if(slideControlIndex!==-1){var ariaButtonControl="slick-slide-control"+_.instanceUid+slideControlIndex;if($("#"+ariaButtonControl).length){$(this).attr({"aria-describedby":ariaButtonControl})}}});_.$dots.attr("role","tablist").find("li").each(function(i){var mappedSlideIndex=tabControlIndexes[i];$(this).attr({role:"presentation"});$(this).find("button").first().attr({role:"tab",id:"slick-slide-control"+_.instanceUid+i,"aria-controls":"slick-slide"+_.instanceUid+mappedSlideIndex,"aria-label":i+1+" of "+numDotGroups,"aria-selected":null,tabindex:"-1"})}).eq(_.currentSlide).find("button").attr({"aria-selected":"true",tabindex:"0"}).end()}for(var i=_.currentSlide,max=i+_.options.slidesToShow;i<max;i++){if(_.options.focusOnChange){_.$slides.eq(i).attr({tabindex:"0"})}else{_.$slides.eq(i).removeAttr("tabindex")}}_.activateADA()};Slick.prototype.initArrowEvents=function(){var _=this;if(_.options.arrows===true&&_.slideCount>_.options.slidesToShow){_.$prevArrow.off("click.slick").on("click.slick",{message:"previous"},_.changeSlide);_.$nextArrow.off("click.slick").on("click.slick",{message:"next"},_.changeSlide);if(_.options.accessibility===true){_.$prevArrow.on("keydown.slick",_.keyHandler);_.$nextArrow.on("keydown.slick",_.keyHandler)}}};Slick.prototype.initDotEvents=function(){var _=this;if(_.options.dots===true&&_.slideCount>_.options.slidesToShow){$("li",_.$dots).on("click.slick",{message:"index"},_.changeSlide);if(_.options.accessibility===true){_.$dots.on("keydown.slick",_.keyHandler)}}if(_.options.dots===true&&_.options.pauseOnDotsHover===true&&_.slideCount>_.options.slidesToShow){$("li",_.$dots).on("mouseenter.slick",$.proxy(_.interrupt,_,true)).on("mouseleave.slick",$.proxy(_.interrupt,_,false))}};Slick.prototype.initSlideEvents=function(){var _=this;if(_.options.pauseOnHover){_.$list.on("mouseenter.slick",$.proxy(_.interrupt,_,true));_.$list.on("mouseleave.slick",$.proxy(_.interrupt,_,false))}};Slick.prototype.initializeEvents=function(){var _=this;_.initArrowEvents();_.initDotEvents();_.initSlideEvents();_.$list.on("touchstart.slick mousedown.slick",{action:"start"},_.swipeHandler);_.$list.on("touchmove.slick mousemove.slick",{action:"move"},_.swipeHandler);_.$list.on("touchend.slick mouseup.slick",{action:"end"},_.swipeHandler);_.$list.on("touchcancel.slick mouseleave.slick",{action:"end"},_.swipeHandler);_.$list.on("click.slick",_.clickHandler);$(document).on(_.visibilityChange,$.proxy(_.visibility,_));if(_.options.accessibility===true){_.$list.on("keydown.slick",_.keyHandler)}if(_.options.focusOnSelect===true){$(_.$slideTrack).children().on("click.slick",_.selectHandler)}$(window).on("orientationchange.slick.slick-"+_.instanceUid,$.proxy(_.orientationChange,_));$(window).on("resize.slick.slick-"+_.instanceUid,$.proxy(_.resize,_));$("[draggable!=true]",_.$slideTrack).on("dragstart",_.preventDefault);$(window).on("load.slick.slick-"+_.instanceUid,_.setPosition);$(_.setPosition)};Slick.prototype.initUI=function(){var _=this;if(_.options.arrows===true&&_.slideCount>_.options.slidesToShow){_.$prevArrow.show();_.$nextArrow.show()}if(_.options.dots===true&&_.slideCount>_.options.slidesToShow){_.$dots.show()}};Slick.prototype.keyHandler=function(event){var _=this;
//Dont slide if the cursor is inside the form fields and arrow keys are pressed
if(!event.target.tagName.match("TEXTAREA|INPUT|SELECT")){if(event.keyCode===37&&_.options.accessibility===true){_.changeSlide({data:{message:_.options.rtl===true?"next":"previous"}})}else if(event.keyCode===39&&_.options.accessibility===true){_.changeSlide({data:{message:_.options.rtl===true?"previous":"next"}})}}};Slick.prototype.lazyLoad=function(){var _=this,loadRange,cloneRange,rangeStart,rangeEnd;function loadImages(imagesScope){$("img[data-lazy]",imagesScope).each(function(){var image=$(this),imageSource=$(this).attr("data-lazy"),imageSrcSet=$(this).attr("data-srcset"),imageSizes=$(this).attr("data-sizes")||_.$slider.attr("data-sizes"),imageToLoad=document.createElement("img");imageToLoad.onload=function(){image.animate({opacity:0},100,function(){if(imageSrcSet){image.attr("srcset",imageSrcSet);if(imageSizes){image.attr("sizes",imageSizes)}}image.attr("src",imageSource).animate({opacity:1},200,function(){image.removeAttr("data-lazy data-srcset data-sizes").removeClass("slick-loading")});_.$slider.trigger("lazyLoaded",[_,image,imageSource])})};imageToLoad.onerror=function(){image.removeAttr("data-lazy").removeClass("slick-loading").addClass("slick-lazyload-error");_.$slider.trigger("lazyLoadError",[_,image,imageSource])};imageToLoad.src=imageSource})}if(_.options.centerMode===true){if(_.options.infinite===true){rangeStart=_.currentSlide+(_.options.slidesToShow/2+1);rangeEnd=rangeStart+_.options.slidesToShow+2}else{rangeStart=Math.max(0,_.currentSlide-(_.options.slidesToShow/2+1));rangeEnd=2+(_.options.slidesToShow/2+1)+_.currentSlide}}else{rangeStart=_.options.infinite?_.options.slidesToShow+_.currentSlide:_.currentSlide;rangeEnd=Math.ceil(rangeStart+_.options.slidesToShow);if(_.options.fade===true){if(rangeStart>0)rangeStart--;if(rangeEnd<=_.slideCount)rangeEnd++}}loadRange=_.$slider.find(".slick-slide").slice(rangeStart,rangeEnd);if(_.options.lazyLoad==="anticipated"){var prevSlide=rangeStart-1,nextSlide=rangeEnd,$slides=_.$slider.find(".slick-slide");for(var i=0;i<_.options.slidesToScroll;i++){if(prevSlide<0)prevSlide=_.slideCount-1;loadRange=loadRange.add($slides.eq(prevSlide));loadRange=loadRange.add($slides.eq(nextSlide));prevSlide--;nextSlide++}}loadImages(loadRange);if(_.slideCount<=_.options.slidesToShow){cloneRange=_.$slider.find(".slick-slide");loadImages(cloneRange)}else if(_.currentSlide>=_.slideCount-_.options.slidesToShow){cloneRange=_.$slider.find(".slick-cloned").slice(0,_.options.slidesToShow);loadImages(cloneRange)}else if(_.currentSlide===0){cloneRange=_.$slider.find(".slick-cloned").slice(_.options.slidesToShow*-1);loadImages(cloneRange)}};Slick.prototype.loadSlider=function(){var _=this;_.setPosition();_.$slideTrack.css({opacity:1});_.$slider.removeClass("slick-loading");_.initUI();if(_.options.lazyLoad==="progressive"){_.progressiveLazyLoad()}};Slick.prototype.next=Slick.prototype.slickNext=function(){var _=this;_.changeSlide({data:{message:"next"}})};Slick.prototype.orientationChange=function(){var _=this;_.checkResponsive();_.setPosition()};Slick.prototype.pause=Slick.prototype.slickPause=function(){var _=this;_.autoPlayClear();_.paused=true};Slick.prototype.play=Slick.prototype.slickPlay=function(){var _=this;_.autoPlay();_.options.autoplay=true;_.paused=false;_.focussed=false;_.interrupted=false};Slick.prototype.postSlide=function(index){var _=this;if(!_.unslicked){_.$slider.trigger("afterChange",[_,index]);_.animating=false;if(_.slideCount>_.options.slidesToShow){_.setPosition()}_.swipeLeft=null;if(_.options.autoplay){_.autoPlay()}if(_.options.accessibility===true){_.initADA();if(_.options.focusOnChange){var $currentSlide=$(_.$slides.get(_.currentSlide));$currentSlide.attr("tabindex",0).focus()}}}};Slick.prototype.prev=Slick.prototype.slickPrev=function(){var _=this;_.changeSlide({data:{message:"previous"}})};Slick.prototype.preventDefault=function(event){event.preventDefault()};Slick.prototype.progressiveLazyLoad=function(tryCount){tryCount=tryCount||1;var _=this,$imgsToLoad=$("img[data-lazy]",_.$slider),image,imageSource,imageSrcSet,imageSizes,imageToLoad;if($imgsToLoad.length){image=$imgsToLoad.first();imageSource=image.attr("data-lazy");imageSrcSet=image.attr("data-srcset");imageSizes=image.attr("data-sizes")||_.$slider.attr("data-sizes");imageToLoad=document.createElement("img");imageToLoad.onload=function(){if(imageSrcSet){image.attr("srcset",imageSrcSet);if(imageSizes){image.attr("sizes",imageSizes)}}image.attr("src",imageSource).removeAttr("data-lazy data-srcset data-sizes").removeClass("slick-loading");if(_.options.adaptiveHeight===true){_.setPosition()}_.$slider.trigger("lazyLoaded",[_,image,imageSource]);_.progressiveLazyLoad()};imageToLoad.onerror=function(){if(tryCount<3){
/**
                     * try to load the image 3 times,
                     * leave a slight delay so we don't get
                     * servers blocking the request.
                     */
setTimeout(function(){_.progressiveLazyLoad(tryCount+1)},500)}else{image.removeAttr("data-lazy").removeClass("slick-loading").addClass("slick-lazyload-error");_.$slider.trigger("lazyLoadError",[_,image,imageSource]);_.progressiveLazyLoad()}};imageToLoad.src=imageSource}else{_.$slider.trigger("allImagesLoaded",[_])}};Slick.prototype.refresh=function(initializing){var _=this,currentSlide,lastVisibleIndex;lastVisibleIndex=_.slideCount-_.options.slidesToShow;
// in non-infinite sliders, we don't want to go past the
// last visible index.
if(!_.options.infinite&&_.currentSlide>lastVisibleIndex){_.currentSlide=lastVisibleIndex}
// if less slides than to show, go to start.
if(_.slideCount<=_.options.slidesToShow){_.currentSlide=0}currentSlide=_.currentSlide;_.destroy(true);$.extend(_,_.initials,{currentSlide:currentSlide});_.init();if(!initializing){_.changeSlide({data:{message:"index",index:currentSlide}},false)}};Slick.prototype.registerBreakpoints=function(){var _=this,breakpoint,currentBreakpoint,l,responsiveSettings=_.options.responsive||null;if($.type(responsiveSettings)==="array"&&responsiveSettings.length){_.respondTo=_.options.respondTo||"window";for(breakpoint in responsiveSettings){l=_.breakpoints.length-1;if(responsiveSettings.hasOwnProperty(breakpoint)){currentBreakpoint=responsiveSettings[breakpoint].breakpoint;
// loop through the breakpoints and cut out any existing
// ones with the same breakpoint number, we don't want dupes.
while(l>=0){if(_.breakpoints[l]&&_.breakpoints[l]===currentBreakpoint){_.breakpoints.splice(l,1)}l--}_.breakpoints.push(currentBreakpoint);_.breakpointSettings[currentBreakpoint]=responsiveSettings[breakpoint].settings}}_.breakpoints.sort(function(a,b){return _.options.mobileFirst?a-b:b-a})}};Slick.prototype.reinit=function(){var _=this;_.$slides=_.$slideTrack.children(_.options.slide).addClass("slick-slide");_.slideCount=_.$slides.length;if(_.currentSlide>=_.slideCount&&_.currentSlide!==0){_.currentSlide=_.currentSlide-_.options.slidesToScroll}if(_.slideCount<=_.options.slidesToShow){_.currentSlide=0}_.registerBreakpoints();_.setProps();_.setupInfinite();_.buildArrows();_.updateArrows();_.initArrowEvents();_.buildDots();_.updateDots();_.initDotEvents();_.cleanUpSlideEvents();_.initSlideEvents();_.checkResponsive(false,true);if(_.options.focusOnSelect===true){$(_.$slideTrack).children().on("click.slick",_.selectHandler)}_.setSlideClasses(typeof _.currentSlide==="number"?_.currentSlide:0);_.setPosition();_.focusHandler();_.paused=!_.options.autoplay;_.autoPlay();_.$slider.trigger("reInit",[_])};Slick.prototype.resize=function(){var _=this;if($(window).width()!==_.windowWidth){clearTimeout(_.windowDelay);_.windowDelay=window.setTimeout(function(){_.windowWidth=$(window).width();_.checkResponsive();if(!_.unslicked){_.setPosition()}},50)}};Slick.prototype.removeSlide=Slick.prototype.slickRemove=function(index,removeBefore,removeAll){var _=this;if(typeof index==="boolean"){removeBefore=index;index=removeBefore===true?0:_.slideCount-1}else{index=removeBefore===true?--index:index}if(_.slideCount<1||index<0||index>_.slideCount-1){return false}_.unload();if(removeAll===true){_.$slideTrack.children().remove()}else{_.$slideTrack.children(this.options.slide).eq(index).remove()}_.$slides=_.$slideTrack.children(this.options.slide);_.$slideTrack.children(this.options.slide).detach();_.$slideTrack.append(_.$slides);_.$slidesCache=_.$slides;_.reinit()};Slick.prototype.setCSS=function(position){var _=this,positionProps={},x,y;if(_.options.rtl===true){position=-position}x=_.positionProp=="left"?Math.ceil(position)+"px":"0px";y=_.positionProp=="top"?Math.ceil(position)+"px":"0px";positionProps[_.positionProp]=position;if(_.transformsEnabled===false){_.$slideTrack.css(positionProps)}else{positionProps={};if(_.cssTransitions===false){positionProps[_.animType]="translate("+x+", "+y+")";_.$slideTrack.css(positionProps)}else{positionProps[_.animType]="translate3d("+x+", "+y+", 0px)";_.$slideTrack.css(positionProps)}}};Slick.prototype.setDimensions=function(){var _=this;if(_.options.vertical===false){if(_.options.centerMode===true){_.$list.css({padding:"0px "+_.options.centerPadding})}}else{_.$list.height(_.$slides.first().outerHeight(true)*_.options.slidesToShow);if(_.options.centerMode===true){_.$list.css({padding:_.options.centerPadding+" 0px"})}}_.listWidth=_.$list.width();_.listHeight=_.$list.height();if(_.options.vertical===false&&_.options.variableWidth===false){_.slideWidth=Math.ceil(_.listWidth/_.options.slidesToShow);_.$slideTrack.width(Math.ceil(_.slideWidth*_.$slideTrack.children(".slick-slide").length))}else if(_.options.variableWidth===true){_.$slideTrack.width(5e3*_.slideCount)}else{_.slideWidth=Math.ceil(_.listWidth);_.$slideTrack.height(Math.ceil(_.$slides.first().outerHeight(true)*_.$slideTrack.children(".slick-slide").length))}var offset=_.$slides.first().outerWidth(true)-_.$slides.first().width();if(_.options.variableWidth===false)_.$slideTrack.children(".slick-slide").width(_.slideWidth-offset)};Slick.prototype.setFade=function(){var _=this,targetLeft;_.$slides.each(function(index,element){targetLeft=_.slideWidth*index*-1;if(_.options.rtl===true){$(element).css({position:"relative",right:targetLeft,top:0,zIndex:_.options.zIndex-2,opacity:0})}else{$(element).css({position:"relative",left:targetLeft,top:0,zIndex:_.options.zIndex-2,opacity:0})}});_.$slides.eq(_.currentSlide).css({zIndex:_.options.zIndex-1,opacity:1})};Slick.prototype.setHeight=function(){var _=this;if(_.options.slidesToShow===1&&_.options.adaptiveHeight===true&&_.options.vertical===false){var targetHeight=_.$slides.eq(_.currentSlide).outerHeight(true);_.$list.css("height",targetHeight)}};Slick.prototype.setOption=Slick.prototype.slickSetOption=function(){
/**
         * accepts arguments in format of:
         *
         *  - for changing a single option's value:
         *     .slick("setOption", option, value, refresh )
         *
         *  - for changing a set of responsive options:
         *     .slick("setOption", 'responsive', [{}, ...], refresh )
         *
         *  - for updating multiple values at once (not responsive)
         *     .slick("setOption", { 'option': value, ... }, refresh )
         */
var _=this,l,item,option,value,refresh=false,type;if($.type(arguments[0])==="object"){option=arguments[0];refresh=arguments[1];type="multiple"}else if($.type(arguments[0])==="string"){option=arguments[0];value=arguments[1];refresh=arguments[2];if(arguments[0]==="responsive"&&$.type(arguments[1])==="array"){type="responsive"}else if(typeof arguments[1]!=="undefined"){type="single"}}if(type==="single"){_.options[option]=value}else if(type==="multiple"){$.each(option,function(opt,val){_.options[opt]=val})}else if(type==="responsive"){for(item in value){if($.type(_.options.responsive)!=="array"){_.options.responsive=[value[item]]}else{l=_.options.responsive.length-1;
// loop through the responsive object and splice out duplicates.
while(l>=0){if(_.options.responsive[l].breakpoint===value[item].breakpoint){_.options.responsive.splice(l,1)}l--}_.options.responsive.push(value[item])}}}if(refresh){_.unload();_.reinit()}};Slick.prototype.setPosition=function(){var _=this;_.setDimensions();_.setHeight();if(_.options.fade===false){_.setCSS(_.getLeft(_.currentSlide))}else{_.setFade()}_.$slider.trigger("setPosition",[_])};Slick.prototype.setProps=function(){var _=this,bodyStyle=document.body.style;_.positionProp=_.options.vertical===true?"top":"left";if(_.positionProp==="top"){_.$slider.addClass("slick-vertical")}else{_.$slider.removeClass("slick-vertical")}if(bodyStyle.WebkitTransition!==undefined||bodyStyle.MozTransition!==undefined||bodyStyle.msTransition!==undefined){if(_.options.useCSS===true){_.cssTransitions=true}}if(_.options.fade){if(typeof _.options.zIndex==="number"){if(_.options.zIndex<3){_.options.zIndex=3}}else{_.options.zIndex=_.defaults.zIndex}}if(bodyStyle.OTransform!==undefined){_.animType="OTransform";_.transformType="-o-transform";_.transitionType="OTransition";if(bodyStyle.perspectiveProperty===undefined&&bodyStyle.webkitPerspective===undefined)_.animType=false}if(bodyStyle.MozTransform!==undefined){_.animType="MozTransform";_.transformType="-moz-transform";_.transitionType="MozTransition";if(bodyStyle.perspectiveProperty===undefined&&bodyStyle.MozPerspective===undefined)_.animType=false}if(bodyStyle.webkitTransform!==undefined){_.animType="webkitTransform";_.transformType="-webkit-transform";_.transitionType="webkitTransition";if(bodyStyle.perspectiveProperty===undefined&&bodyStyle.webkitPerspective===undefined)_.animType=false}if(bodyStyle.msTransform!==undefined){_.animType="msTransform";_.transformType="-ms-transform";_.transitionType="msTransition";if(bodyStyle.msTransform===undefined)_.animType=false}if(bodyStyle.transform!==undefined&&_.animType!==false){_.animType="transform";_.transformType="transform";_.transitionType="transition"}_.transformsEnabled=_.options.useTransform&&(_.animType!==null&&_.animType!==false)};Slick.prototype.setSlideClasses=function(index){var _=this,centerOffset,allSlides,indexOffset,remainder;allSlides=_.$slider.find(".slick-slide").removeClass("slick-active slick-center slick-current").attr("aria-hidden","true");_.$slides.eq(index).addClass("slick-current");if(_.options.centerMode===true){var evenCoef=_.options.slidesToShow%2===0?1:0;centerOffset=Math.floor(_.options.slidesToShow/2);if(_.options.infinite===true){if(index>=centerOffset&&index<=_.slideCount-1-centerOffset){_.$slides.slice(index-centerOffset+evenCoef,index+centerOffset+1).addClass("slick-active").attr("aria-hidden","false")}else{indexOffset=_.options.slidesToShow+index;allSlides.slice(indexOffset-centerOffset+1+evenCoef,indexOffset+centerOffset+2).addClass("slick-active").attr("aria-hidden","false")}if(index===0){allSlides.eq(allSlides.length-1-_.options.slidesToShow).addClass("slick-center")}else if(index===_.slideCount-1){allSlides.eq(_.options.slidesToShow).addClass("slick-center")}}_.$slides.eq(index).addClass("slick-center")}else{if(index>=0&&index<=_.slideCount-_.options.slidesToShow){_.$slides.slice(index,index+_.options.slidesToShow).addClass("slick-active").attr("aria-hidden","false")}else if(allSlides.length<=_.options.slidesToShow){allSlides.addClass("slick-active").attr("aria-hidden","false")}else{remainder=_.slideCount%_.options.slidesToShow;indexOffset=_.options.infinite===true?_.options.slidesToShow+index:index;if(_.options.slidesToShow==_.options.slidesToScroll&&_.slideCount-index<_.options.slidesToShow){allSlides.slice(indexOffset-(_.options.slidesToShow-remainder),indexOffset+remainder).addClass("slick-active").attr("aria-hidden","false")}else{allSlides.slice(indexOffset,indexOffset+_.options.slidesToShow).addClass("slick-active").attr("aria-hidden","false")}}}if(_.options.lazyLoad==="ondemand"||_.options.lazyLoad==="anticipated"){_.lazyLoad()}};Slick.prototype.setupInfinite=function(){var _=this,i,slideIndex,infiniteCount;if(_.options.fade===true){_.options.centerMode=false}if(_.options.infinite===true&&_.options.fade===false){slideIndex=null;if(_.slideCount>_.options.slidesToShow){if(_.options.centerMode===true){infiniteCount=_.options.slidesToShow+1}else{infiniteCount=_.options.slidesToShow}for(i=_.slideCount;i>_.slideCount-infiniteCount;i-=1){slideIndex=i-1;$(_.$slides[slideIndex]).clone(true).attr("id","").attr("data-slick-index",slideIndex-_.slideCount).prependTo(_.$slideTrack).addClass("slick-cloned")}for(i=0;i<infiniteCount+_.slideCount;i+=1){
// for (i = 0; i < infiniteCount; i += 1) {
slideIndex=i;$(_.$slides[slideIndex]).clone(true).attr("id","").attr("data-slick-index",slideIndex+_.slideCount).appendTo(_.$slideTrack).addClass("slick-cloned")}_.$slideTrack.find(".slick-cloned").find("[id]").each(function(){$(this).attr("id","")})}}};Slick.prototype.interrupt=function(toggle){var _=this;if(!toggle){_.autoPlay()}_.interrupted=toggle};Slick.prototype.selectHandler=function(event){var _=this;var targetElement=$(event.target).is(".slick-slide")?$(event.target):$(event.target).parents(".slick-slide");var index=parseInt(targetElement.attr("data-slick-index"));if(!index)index=0;if(_.slideCount<=_.options.slidesToShow){_.slideHandler(index,false,true);return}_.slideHandler(index)};Slick.prototype.slideHandler=function(index,sync,dontAnimate){var targetSlide,animSlide,oldSlide,slideLeft,targetLeft=null,_=this,navTarget;sync=sync||false;if(_.animating===true&&_.options.waitForAnimate===true){return}if(_.options.fade===true&&_.currentSlide===index){return}if(sync===false){_.asNavFor(index)}targetSlide=index;targetLeft=_.getLeft(targetSlide);slideLeft=_.getLeft(_.currentSlide);_.currentLeft=_.swipeLeft===null?slideLeft:_.swipeLeft;if(_.options.infinite===false&&_.options.centerMode===false&&(index<0||index>_.getDotCount()*_.options.slidesToScroll)){if(_.options.fade===false){targetSlide=_.currentSlide;if(dontAnimate!==true&&_.slideCount>_.options.slidesToShow){_.animateSlide(slideLeft,function(){_.postSlide(targetSlide)})}else{_.postSlide(targetSlide)}}return}else if(_.options.infinite===false&&_.options.centerMode===true&&(index<0||index>_.slideCount-_.options.slidesToScroll)){if(_.options.fade===false){targetSlide=_.currentSlide;if(dontAnimate!==true&&_.slideCount>_.options.slidesToShow){_.animateSlide(slideLeft,function(){_.postSlide(targetSlide)})}else{_.postSlide(targetSlide)}}return}if(_.options.autoplay){clearInterval(_.autoPlayTimer)}if(targetSlide<0){if(_.slideCount%_.options.slidesToScroll!==0){animSlide=_.slideCount-_.slideCount%_.options.slidesToScroll}else{animSlide=_.slideCount+targetSlide}}else if(targetSlide>=_.slideCount){if(_.slideCount%_.options.slidesToScroll!==0){animSlide=0}else{animSlide=targetSlide-_.slideCount}}else{animSlide=targetSlide}_.animating=true;_.$slider.trigger("beforeChange",[_,_.currentSlide,animSlide]);oldSlide=_.currentSlide;_.currentSlide=animSlide;_.setSlideClasses(_.currentSlide);if(_.options.asNavFor){navTarget=_.getNavTarget();navTarget=navTarget.slick("getSlick");if(navTarget.slideCount<=navTarget.options.slidesToShow){navTarget.setSlideClasses(_.currentSlide)}}_.updateDots();_.updateArrows();if(_.options.fade===true){if(dontAnimate!==true){_.fadeSlideOut(oldSlide);_.fadeSlide(animSlide,function(){_.postSlide(animSlide)})}else{_.postSlide(animSlide)}_.animateHeight();return}if(dontAnimate!==true&&_.slideCount>_.options.slidesToShow){_.animateSlide(targetLeft,function(){_.postSlide(animSlide)})}else{_.postSlide(animSlide)}};Slick.prototype.startLoad=function(){var _=this;if(_.options.arrows===true&&_.slideCount>_.options.slidesToShow){_.$prevArrow.hide();_.$nextArrow.hide()}if(_.options.dots===true&&_.slideCount>_.options.slidesToShow){_.$dots.hide()}_.$slider.addClass("slick-loading")};Slick.prototype.swipeDirection=function(){var xDist,yDist,r,swipeAngle,_=this;xDist=_.touchObject.startX-_.touchObject.curX;yDist=_.touchObject.startY-_.touchObject.curY;r=Math.atan2(yDist,xDist);swipeAngle=Math.round(r*180/Math.PI);if(swipeAngle<0){swipeAngle=360-Math.abs(swipeAngle)}if(swipeAngle<=45&&swipeAngle>=0){return _.options.rtl===false?"left":"right"}if(swipeAngle<=360&&swipeAngle>=315){return _.options.rtl===false?"left":"right"}if(swipeAngle>=135&&swipeAngle<=225){return _.options.rtl===false?"right":"left"}if(_.options.verticalSwiping===true){if(swipeAngle>=35&&swipeAngle<=135){return"down"}else{return"up"}}return"vertical"};Slick.prototype.swipeEnd=function(event){var _=this,slideCount,direction;_.dragging=false;_.swiping=false;if(_.scrolling){_.scrolling=false;return false}_.interrupted=false;_.shouldClick=_.touchObject.swipeLength>10?false:true;if(_.touchObject.curX===undefined){return false}if(_.touchObject.edgeHit===true){_.$slider.trigger("edge",[_,_.swipeDirection()])}if(_.touchObject.swipeLength>=_.touchObject.minSwipe){direction=_.swipeDirection();switch(direction){case"left":case"down":slideCount=_.options.swipeToSlide?_.checkNavigable(_.currentSlide+_.getSlideCount()):_.currentSlide+_.getSlideCount();_.currentDirection=0;break;case"right":case"up":slideCount=_.options.swipeToSlide?_.checkNavigable(_.currentSlide-_.getSlideCount()):_.currentSlide-_.getSlideCount();_.currentDirection=1;break;default:}if(direction!="vertical"){_.slideHandler(slideCount);_.touchObject={};_.$slider.trigger("swipe",[_,direction])}}else{if(_.touchObject.startX!==_.touchObject.curX){_.slideHandler(_.currentSlide);_.touchObject={}}}};Slick.prototype.swipeHandler=function(event){var _=this;if(_.options.swipe===false||"ontouchend"in document&&_.options.swipe===false){return}else if(_.options.draggable===false&&event.type.indexOf("mouse")!==-1){return}_.touchObject.fingerCount=event.originalEvent&&event.originalEvent.touches!==undefined?event.originalEvent.touches.length:1;_.touchObject.minSwipe=_.listWidth/_.options.touchThreshold;if(_.options.verticalSwiping===true){_.touchObject.minSwipe=_.listHeight/_.options.touchThreshold}switch(event.data.action){case"start":_.swipeStart(event);break;case"move":_.swipeMove(event);break;case"end":_.swipeEnd(event);break}};Slick.prototype.swipeMove=function(event){var _=this,edgeWasHit=false,curLeft,swipeDirection,swipeLength,positionOffset,touches,verticalSwipeLength;touches=event.originalEvent!==undefined?event.originalEvent.touches:null;if(!_.dragging||_.scrolling||touches&&touches.length!==1){return false}curLeft=_.getLeft(_.currentSlide);_.touchObject.curX=touches!==undefined?touches[0].pageX:event.clientX;_.touchObject.curY=touches!==undefined?touches[0].pageY:event.clientY;_.touchObject.swipeLength=Math.round(Math.sqrt(Math.pow(_.touchObject.curX-_.touchObject.startX,2)));verticalSwipeLength=Math.round(Math.sqrt(Math.pow(_.touchObject.curY-_.touchObject.startY,2)));if(!_.options.verticalSwiping&&!_.swiping&&verticalSwipeLength>4){_.scrolling=true;return false}if(_.options.verticalSwiping===true){_.touchObject.swipeLength=verticalSwipeLength}swipeDirection=_.swipeDirection();if(event.originalEvent!==undefined&&_.touchObject.swipeLength>4){_.swiping=true;event.preventDefault()}positionOffset=(_.options.rtl===false?1:-1)*(_.touchObject.curX>_.touchObject.startX?1:-1);if(_.options.verticalSwiping===true){positionOffset=_.touchObject.curY>_.touchObject.startY?1:-1}swipeLength=_.touchObject.swipeLength;_.touchObject.edgeHit=false;if(_.options.infinite===false){if(_.currentSlide===0&&swipeDirection==="right"||_.currentSlide>=_.getDotCount()&&swipeDirection==="left"){swipeLength=_.touchObject.swipeLength*_.options.edgeFriction;_.touchObject.edgeHit=true}}if(_.options.vertical===false){_.swipeLeft=curLeft+swipeLength*positionOffset}else{_.swipeLeft=curLeft+swipeLength*(_.$list.height()/_.listWidth)*positionOffset}if(_.options.verticalSwiping===true){_.swipeLeft=curLeft+swipeLength*positionOffset}if(_.options.fade===true||_.options.touchMove===false){return false}if(_.animating===true){_.swipeLeft=null;return false}_.setCSS(_.swipeLeft)};Slick.prototype.swipeStart=function(event){var _=this,touches;_.interrupted=true;if(_.touchObject.fingerCount!==1||_.slideCount<=_.options.slidesToShow){_.touchObject={};return false}if(event.originalEvent!==undefined&&event.originalEvent.touches!==undefined){touches=event.originalEvent.touches[0]}_.touchObject.startX=_.touchObject.curX=touches!==undefined?touches.pageX:event.clientX;_.touchObject.startY=_.touchObject.curY=touches!==undefined?touches.pageY:event.clientY;_.dragging=true};Slick.prototype.unfilterSlides=Slick.prototype.slickUnfilter=function(){var _=this;if(_.$slidesCache!==null){_.unload();_.$slideTrack.children(this.options.slide).detach();_.$slidesCache.appendTo(_.$slideTrack);_.reinit()}};Slick.prototype.unload=function(){var _=this;$(".slick-cloned",_.$slider).remove();if(_.$dots){_.$dots.remove()}if(_.$prevArrow&&_.htmlExpr.test(_.options.prevArrow)){_.$prevArrow.remove()}if(_.$nextArrow&&_.htmlExpr.test(_.options.nextArrow)){_.$nextArrow.remove()}_.$slides.removeClass("slick-slide slick-active slick-visible slick-current").attr("aria-hidden","true").css("width","")};Slick.prototype.unslick=function(fromBreakpoint){var _=this;_.$slider.trigger("unslick",[_,fromBreakpoint]);_.destroy()};Slick.prototype.updateArrows=function(){var _=this,centerOffset;centerOffset=Math.floor(_.options.slidesToShow/2);if(_.options.arrows===true&&_.slideCount>_.options.slidesToShow&&!_.options.infinite){_.$prevArrow.removeClass("slick-disabled").attr("aria-disabled","false");_.$nextArrow.removeClass("slick-disabled").attr("aria-disabled","false");if(_.currentSlide===0){_.$prevArrow.addClass("slick-disabled").attr("aria-disabled","true");_.$nextArrow.removeClass("slick-disabled").attr("aria-disabled","false")}else if(_.currentSlide>=_.slideCount-_.options.slidesToShow&&_.options.centerMode===false){_.$nextArrow.addClass("slick-disabled").attr("aria-disabled","true");_.$prevArrow.removeClass("slick-disabled").attr("aria-disabled","false")}else if(_.currentSlide>=_.slideCount-1&&_.options.centerMode===true){_.$nextArrow.addClass("slick-disabled").attr("aria-disabled","true");_.$prevArrow.removeClass("slick-disabled").attr("aria-disabled","false")}}};Slick.prototype.updateDots=function(){var _=this;if(_.$dots!==null){_.$dots.find("li").removeClass("slick-active").end();_.$dots.find("li").eq(Math.floor(_.currentSlide/_.options.slidesToScroll)).addClass("slick-active")}};Slick.prototype.visibility=function(){var _=this;if(_.options.autoplay){if(document[_.hidden]){_.interrupted=true}else{_.interrupted=false}}};$.fn.slick=function(){var _=this,opt=arguments[0],args=Array.prototype.slice.call(arguments,1),l=_.length,i,ret;for(i=0;i<l;i++){if(typeof opt=="object"||typeof opt=="undefined")_[i].slick=new Slick(_[i],opt);else ret=_[i].slick[opt].apply(_[i].slick,args);if(typeof ret!="undefined")return ret}return _}});jQuery.trumbowyg={langs:{en:{viewHTML:"View HTML",undo:"Undo",redo:"Redo",formatting:"Formatting",p:"Paragraph",blockquote:"Quote",code:"Code",header:"Header",headline:"Zwischenüberschrift",bold:"Fett",italic:"Italic",strikethrough:"Strikethrough",underline:"Underline",strong:"Strong",em:"Emphasis",del:"Deleted",superscript:"Superscript",subscript:"Subscript",unorderedList:"Unordered list",orderedList:"Ordered list",insertImage:"Insert Image",link:"Link",createLink:"Link einfügen",unlink:"Link entfernen",justifyLeft:"Align Left",justifyCenter:"Align Center",justifyRight:"Align Right",justifyFull:"Align Justify",horizontalRule:"Insert horizontal rule",removeformat:"Remove format",fullscreen:"Fullscreen",close:"Close",submit:"OK",reset:"Abbrechen",required:"Required",description:"Description",title:"Title",text:"Text",target:"Target",width:"Width"}},
// Plugins
plugins:{},
// SVG Path globally
svgPath:null,hideButtonTexts:null};
// Makes default options read-only
Object.defineProperty(jQuery.trumbowyg,"defaultOptions",{value:{lang:"en",fixedBtnPane:false,fixedFullWidth:false,autogrow:false,autogrowOnEnter:false,imageWidthModalEdit:false,prefix:"trumbowyg-",semantic:true,semanticKeepAttributes:false,resetCss:false,removeformatPasted:false,tabToIndent:false,tagsToRemove:[],tagsToKeep:["hr","img","embed","iframe","input"],btns:[["viewHTML"],["undo","redo"],// Only supported in Blink browsers
["formatting"],["strong","em","del"],["superscript","subscript"],["link"],["insertImage"],["justifyLeft","justifyCenter","justifyRight","justifyFull"],["unorderedList","orderedList"],["horizontalRule"],["removeformat"],["fullscreen"]],
// For custom button definitions
btnsDef:{},changeActiveDropdownIcon:false,inlineElementsSelector:"a,abbr,acronym,b,caption,cite,code,col,dfn,dir,dt,dd,em,font,hr,i,kbd,li,q,span,strikeout,strong,sub,sup,u",pasteHandlers:[],
// imgDblClickHandler: default is defined in constructor
plugins:{},urlProtocol:false,minimalLinks:false},writable:false,enumerable:true,configurable:false});(function(navigator,window,document,$){"use strict";var CONFIRM_EVENT="tbwconfirm",CANCEL_EVENT="tbwcancel";$.fn.trumbowyg=function(options,params){var trumbowygDataName="trumbowyg";if(options===Object(options)||!options){return this.each(function(){if(!$(this).data(trumbowygDataName)){$(this).data(trumbowygDataName,new Trumbowyg(this,options))}})}if(this.length===1){try{var t=$(this).data(trumbowygDataName);switch(options){
// Exec command
case"execCmd":return t.execCmd(params.cmd,params.param,params.forceCss);
// Modal box
case"openModal":return t.openModal(params.title,params.content);case"closeModal":return t.closeModal();case"openModalInsert":return t.openModalInsert(params.title,params.fields,params.callback);
// Range
case"saveRange":return t.saveRange();case"getRange":return t.range;case"getRangeText":return t.getRangeText();case"restoreRange":return t.restoreRange();
// Enable/disable
case"enable":return t.setDisabled(false);case"disable":return t.setDisabled(true);
// Toggle
case"toggle":return t.toggle();
// Destroy
case"destroy":return t.destroy();
// Empty
case"empty":return t.empty();
// HTML
case"html":return t.html(params)}}catch(c){}}return false};
// @param: editorElem is the DOM element
var Trumbowyg=function(editorElem,options){var t=this,trumbowygIconsId="trumbowyg-icons",$trumbowyg=$.trumbowyg;
// Get the document of the element. It use to makes the plugin
// compatible on iframes.
t.doc=editorElem.ownerDocument||document;
// jQuery object of the editor
t.$ta=$(editorElem);// $ta : Textarea
t.$c=$(editorElem);// $c : creator
options=options||{};
// Localization management
if(options.lang!=null||$trumbowyg.langs[options.lang]!=null){t.lang=$.extend(true,{},$trumbowyg.langs.en,$trumbowyg.langs[options.lang])}else{t.lang=$trumbowyg.langs.en}t.hideButtonTexts=$trumbowyg.hideButtonTexts!=null?$trumbowyg.hideButtonTexts:options.hideButtonTexts;
// SVG path
var svgPathOption=$trumbowyg.svgPath!=null?$trumbowyg.svgPath:options.svgPath;t.hasSvg=svgPathOption!==false;t.svgPath=!!t.doc.querySelector("base")?window.location.href.split("#")[0]:"";if($("#"+trumbowygIconsId,t.doc).length===0&&svgPathOption!==false){if(svgPathOption==null){
// Hack to get svgPathOption based on trumbowyg.js path
var scriptElements=document.getElementsByTagName("script");for(var i=0;i<scriptElements.length;i+=1){var source=scriptElements[i].src;var matches=source.match("trumbowyg(.min)?.js");if(matches!=null){svgPathOption=source.substring(0,source.indexOf(matches[0]))+"ui/icons.svg"}}if(svgPathOption==null){console.warn("You must define svgPath: https://goo.gl/CfTY9U");// jshint ignore:line
}}var div=t.doc.createElement("div");div.id=trumbowygIconsId;t.doc.body.insertBefore(div,t.doc.body.childNodes[0]);$.ajax({async:true,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",dataType:"xml",crossDomain:true,url:svgPathOption,data:null,beforeSend:null,complete:null,success:function(data){div.innerHTML=(new XMLSerializer).serializeToString(data.documentElement)}})}
/**
         * When the button is associated to a empty object
         * fn and title attributes are defined from the button key value
         *
         * For example
         *      foo: {}
         * is equivalent to :
         *      foo: {
         *          fn: 'foo',
         *          title: this.lang.foo
         *      }
         */var h=t.lang.header,// Header translation
isBlinkFunction=function(){return(window.chrome||window.Intl&&Intl.v8BreakIterator)&&"CSS"in window};t.btnsDef={viewHTML:{fn:"toggle",class:"trumbowyg-not-disable"},undo:{isSupported:isBlinkFunction,key:"Z"},redo:{isSupported:isBlinkFunction,key:"Y"},p:{fn:"formatBlock",text:"Fließtext",hasIcon:false,class:"textonly",title:"Fließtext"},blockquote:{fn:"formatBlock"},h1:{fn:"formatBlock",title:h+" 1"},h2:{fn:"formatBlock",title:h+" 2",text:t.lang.headline,hasIcon:false,class:"textonly",tag:"h2"},h3:{fn:"formatBlock",title:h+" 3"},h4:{fn:"formatBlock",title:h+" 4"},h5:{fn:"formatBlock",title:h+" 5"},h6:{fn:"formatBlock",title:h+" 6"},subscript:{tag:"sub"},superscript:{tag:"sup"},bold:{key:"B",tag:"b"},italic:{key:"I",tag:"i"},underline:{tag:"u"},strikethrough:{tag:"strike"},strong:{fn:"bold",key:"B",title:"Fett",text:"Fett",hasIcon:false,class:"textonly"},em:{fn:"italic",key:"I",text:"Kursiv",hasIcon:false,class:"textonly"},del:{fn:"strikethrough"},createLink:{key:"K",tag:"a"},unlink:{},insertImage:{},justifyLeft:{tag:"left",forceCss:true},justifyCenter:{tag:"center",forceCss:true},justifyRight:{tag:"right",forceCss:true},justifyFull:{tag:"justify",forceCss:true},unorderedList:{fn:"insertUnorderedList",tag:"ul",title:"Aufzählung",text:"Aufzählung",hasIcon:false,class:"textonly"},orderedList:{fn:"insertOrderedList",tag:"ol"},horizontalRule:{fn:"insertHorizontalRule"},removeformat:{},fullscreen:{class:"trumbowyg-not-disable"},close:{fn:"destroy",class:"trumbowyg-not-disable"},
// Dropdowns
formatting:{dropdown:["p","blockquote","h1","h2","h3","h4"],ico:"p"},link:{hasIcon:false,class:"hasdropdown",dropdown:["createLink","unlink"]}};
// Defaults Options
t.o=$.extend(true,{},$trumbowyg.defaultOptions,options);if(!t.o.hasOwnProperty("imgDblClickHandler")){t.o.imgDblClickHandler=t.getDefaultImgDblClickHandler()}t.urlPrefix=t.setupUrlPrefix();t.disabled=t.o.disabled||editorElem.nodeName==="TEXTAREA"&&editorElem.disabled;if(options.btns){t.o.btns=options.btns}else if(!t.o.semantic){t.o.btns[3]=["bold","italic","underline","strikethrough"]}$.each(t.o.btnsDef,function(btnName,btnDef){t.addBtnDef(btnName,btnDef)});
// put this here in the event it would be merged in with options
t.eventNamespace="trumbowyg-event";
// Keyboard shortcuts are load in this array
t.keys=[];
// Tag to button dynamically hydrated
t.tagToButton={};t.tagHandlers=[];
// Admit multiple paste handlers
t.pasteHandlers=[].concat(t.o.pasteHandlers);
// Check if browser is IE
t.isIE=navigator.userAgent.indexOf("MSIE")!==-1||navigator.appVersion.indexOf("Trident/")!==-1;
// Check if we are on macOs
t.isMac=navigator.platform.toUpperCase().indexOf("MAC")!==-1;t.init()};Trumbowyg.prototype={DEFAULT_SEMANTIC_MAP:{b:"strong",i:"em",s:"del",strike:"del",div:"p"},init:function(){var t=this;t.height=t.$ta.height();t.initPlugins();try{
// Disable image resize, try-catch for old IE
t.doc.execCommand("enableObjectResizing",false,false);t.doc.execCommand("defaultParagraphSeparator",false,"p")}catch(e){}t.buildEditor();t.buildBtnPane();t.fixedBtnPaneEvents();t.buildOverlay();setTimeout(function(){if(t.disabled){t.setDisabled(true)}t.$c.trigger("tbwinit")})},addBtnDef:function(btnName,btnDef){this.btnsDef[btnName]=$.extend(btnDef,this.btnsDef[btnName]||{})},setupUrlPrefix:function(){var protocol=this.o.urlProtocol;if(!protocol){return}if(typeof protocol!=="string"){return"https://"}return protocol.replace("://","")+"://"},buildEditor:function(){var t=this,prefix=t.o.prefix,html="";t.$box=$("<div/>",{class:prefix+"box "+prefix+"editor-visible "+prefix+t.o.lang+" trumbowyg"});
// $ta = Textarea
// $ed = Editor
t.isTextarea=t.$ta.is("textarea");if(t.isTextarea){html=t.$ta.val();t.$ed=$("<div/>");t.$box.insertAfter(t.$ta).append(t.$ed,t.$ta)}else{t.$ed=t.$ta;html=t.$ed.html();t.$ta=$("<textarea/>",{name:t.$ta.attr("id"),height:t.height}).val(html);t.$box.insertAfter(t.$ed).append(t.$ta,t.$ed);t.syncCode()}t.$ta.addClass(prefix+"textarea").attr("tabindex",-1);t.$ed.addClass(prefix+"editor").attr({contenteditable:true,dir:t.lang._dir||"ltr"}).html(html);if(t.o.tabindex){t.$ed.attr("tabindex",t.o.tabindex)}if(t.$c.is("[placeholder]")){t.$ed.attr("placeholder",t.$c.attr("placeholder"))}if(t.$c.is("[spellcheck]")){t.$ed.attr("spellcheck",t.$c.attr("spellcheck"))}if(t.o.resetCss){t.$ed.addClass(prefix+"reset-css")}if(!t.o.autogrow){t.$ta.add(t.$ed).css({height:t.height})}t.semanticCode();if(t.o.autogrowOnEnter){t.$ed.addClass(prefix+"autogrow-on-enter")}var ctrl=false,composition=false,debounceButtonPaneStatus,updateEventName="keyup";t.$ed.on("dblclick","img",t.o.imgDblClickHandler).on("keydown",function(e){if((e.ctrlKey||e.metaKey)&&!e.altKey){ctrl=true;var key=t.keys[String.fromCharCode(e.which).toUpperCase()];try{t.execCmd(key.fn,key.param);return false}catch(c){}}else{if(t.o.tabToIndent&&e.key==="Tab"){try{if(e.shiftKey){t.execCmd("outdent",true,null)}else{t.execCmd("indent",true,null)}return false}catch(c){}}}}).on("compositionstart compositionupdate",function(){composition=true}).on(updateEventName+" compositionend",function(e){if(e.type==="compositionend"){composition=false}else if(composition){return}var keyCode=e.which;if(keyCode>=37&&keyCode<=40){return}if((e.ctrlKey||e.metaKey)&&(keyCode===89||keyCode===90)){t.semanticCode(false,true);t.$c.trigger("tbwchange")}else if(!ctrl&&keyCode!==17){var compositionEndIE=t.isIE?e.type==="compositionend":true;t.semanticCode(false,compositionEndIE&&keyCode===13);t.$c.trigger("tbwchange")}else if(typeof e.which==="undefined"){t.semanticCode(false,false,true)}setTimeout(function(){ctrl=false},50)}).on("mouseup keydown keyup",function(e){if(!e.ctrlKey&&!e.metaKey||e.altKey){setTimeout(function(){// "hold on" to the ctrl key for 50ms
ctrl=false},50)}clearTimeout(debounceButtonPaneStatus);debounceButtonPaneStatus=setTimeout(function(){t.updateButtonPaneStatus()},50)}).on("focus blur",function(e){t.$c.trigger("tbw"+e.type);if(e.type==="blur"){t.clearButtonPaneStatus()}if(t.o.autogrowOnEnter){if(t.autogrowOnEnterDontClose){return}if(e.type==="focus"){t.autogrowOnEnterWasFocused=true;t.autogrowEditorOnEnter()}else if(!t.o.autogrow){t.$ed.css({height:t.$ed.css("min-height")});t.$c.trigger("tbwresize")}}}).on("cut drop",function(){setTimeout(function(){t.semanticCode(false,true);t.$c.trigger("tbwchange")},0)}).on("paste",function(e){if(t.o.removeformatPasted){e.preventDefault();if(window.getSelection&&window.getSelection().deleteFromDocument){window.getSelection().deleteFromDocument()}try{
// IE
var text=window.clipboardData.getData("Text");try{
// <= IE10
t.doc.selection.createRange().pasteHTML(text)}catch(c){
// IE 11
t.doc.getSelection().getRangeAt(0).insertNode(t.doc.createTextNode(text))}t.$c.trigger("tbwchange",e)}catch(d){
// Not IE
t.execCmd("insertText",(e.originalEvent||e).clipboardData.getData("text/plain").replace(new RegExp("\n\n","g"),"\n"))}}
// Call pasteHandlers
$.each(t.pasteHandlers,function(i,pasteHandler){pasteHandler(e)});setTimeout(function(){t.semanticCode(false,true);t.$c.trigger("tbwpaste",e);t.$c.trigger("tbwchange")},0)});t.$ta.on("keyup",function(){t.$c.trigger("tbwchange")}).on("paste",function(){setTimeout(function(){t.$c.trigger("tbwchange")},0)});t.$box.on("keydown",function(e){if(e.which===27&&$("."+prefix+"modal-box",t.$box).length===1){t.closeModal();return false}})},
//autogrow when entering logic
autogrowEditorOnEnter:function(){var t=this;t.$ed.removeClass("autogrow-on-enter");var oldHeight=t.$ed[0].clientHeight;t.$ed.height("auto");var totalHeight=t.$ed[0].scrollHeight;t.$ed.addClass("autogrow-on-enter");if(oldHeight!==totalHeight){t.$ed.height(oldHeight);setTimeout(function(){t.$ed.css({height:totalHeight});t.$c.trigger("tbwresize")},0)}},
// Build button pane, use o.btns option
buildBtnPane:function(){var t=this,prefix=t.o.prefix;var $btnPane=t.$btnPane=$("<div/>",{class:prefix+"button-pane"});$.each(t.o.btns,function(i,btnGrp){if(!$.isArray(btnGrp)){btnGrp=[btnGrp]}var $btnGroup=$("<div/>",{class:prefix+"button-group "+(btnGrp.indexOf("fullscreen")>=0?prefix+"right":"")});$.each(btnGrp,function(i,btn){try{// Prevent buildBtn error
if(t.isSupportedBtn(btn)){// It's a supported button
$btnGroup.append(t.buildBtn(btn))}}catch(c){}});if($btnGroup.html().trim().length>0){$btnPane.append($btnGroup)}});t.$box.prepend($btnPane)},
// Build a button and his action
buildBtn:function(btnName){// btnName is name of the button
var t=this,prefix=t.o.prefix,btn=t.btnsDef[btnName],isDropdown=btn.dropdown,hasIcon=btn.hasIcon!=null?btn.hasIcon:true,textDef=t.lang[btnName]||btnName,$btn=$("<button/>",{type:"button",class:prefix+btnName+"-button "+(btn.class||"")+(!hasIcon?" "+prefix+"textual-button":""),html:t.hasSvg&&hasIcon?'<svg><use xlink:href="'+t.svgPath+"#"+prefix+(btn.ico||btnName).replace(/([A-Z]+)/g,"-$1").toLowerCase()+'"/></svg>':t.hideButtonTexts?"":btn.text||btn.title||t.lang[btnName]||btnName,title:(btn.title||btn.text||textDef)+(btn.key?" ("+(t.isMac?"Cmd":"Ctrl")+" + "+btn.key+")":""),tabindex:-1,mousedown:function(){if(!isDropdown||$("."+btnName+"-"+prefix+"dropdown",t.$box).is(":hidden")){$("body",t.doc).trigger("mousedown")}if((t.$btnPane.hasClass(prefix+"disable")||t.$box.hasClass(prefix+"disabled"))&&!$(this).hasClass(prefix+"active")&&!$(this).hasClass(prefix+"not-disable")){return false}t.execCmd((isDropdown?"dropdown":false)||btn.fn||btnName,btn.param||btnName,btn.forceCss);return false}});if(isDropdown){$btn.addClass(prefix+"open-dropdown");var dropdownPrefix=prefix+"dropdown",dropdownOptions={// the dropdown
class:dropdownPrefix+"-"+btnName+" "+dropdownPrefix+" "+prefix+"fixed-top "+(btn.dropdownClass||"")};dropdownOptions["data-"+dropdownPrefix]=btnName;var $dropdown=$("<div/>",dropdownOptions);$.each(isDropdown,function(i,def){if(t.btnsDef[def]&&t.isSupportedBtn(def)){$dropdown.append(t.buildSubBtn(def))}});t.$box.append($dropdown.hide())}else if(btn.key){t.keys[btn.key]={fn:btn.fn||btnName,param:btn.param||btnName}}if(!isDropdown){t.tagToButton[(btn.tag||btnName).toLowerCase()]=btnName}return $btn},
// Build a button for dropdown menu
// @param n : name of the subbutton
buildSubBtn:function(btnName){var t=this,prefix=t.o.prefix,btn=t.btnsDef[btnName],hasIcon=btn.hasIcon!=null?btn.hasIcon:true;if(btn.key){t.keys[btn.key]={fn:btn.fn||btnName,param:btn.param||btnName}}t.tagToButton[(btn.tag||btnName).toLowerCase()]=btnName;return $("<button/>",{type:"button",class:prefix+btnName+"-dropdown-button "+(btn.class||"")+(btn.ico?" "+prefix+btn.ico+"-button":""),html:t.hasSvg&&hasIcon?'<svg><use xlink:href="'+t.svgPath+"#"+prefix+(btn.ico||btnName).replace(/([A-Z]+)/g,"-$1").toLowerCase()+'"/></svg>'+(btn.text||btn.title||t.lang[btnName]||btnName):btn.text||btn.title||t.lang[btnName]||btnName,title:btn.key?"("+(t.isMac?"Cmd":"Ctrl")+" + "+btn.key+")":null,style:btn.style||null,mousedown:function(){$("body",t.doc).trigger("mousedown");t.execCmd(btn.fn||btnName,btn.param||btnName,btn.forceCss);return false}})},
// Check if button is supported
isSupportedBtn:function(btnName){try{return this.btnsDef[btnName].isSupported()}catch(e){}return true},
// Build overlay for modal box
buildOverlay:function(){var t=this;t.$overlay=$("<div/>",{class:t.o.prefix+"overlay"}).appendTo(t.$box);return t.$overlay},showOverlay:function(){var t=this;$(window).trigger("scroll");t.$overlay.fadeIn(200);t.$box.addClass(t.o.prefix+"box-blur")},hideOverlay:function(){var t=this;t.$overlay.fadeOut(50);t.$box.removeClass(t.o.prefix+"box-blur")},
// Management of fixed button pane
fixedBtnPaneEvents:function(){var t=this,fixedFullWidth=t.o.fixedFullWidth,$box=t.$box;if(!t.o.fixedBtnPane){return}t.isFixed=false;$(window).on("scroll."+t.eventNamespace+" resize."+t.eventNamespace,function(){if(!$box){return}t.syncCode();var scrollTop=$(window).scrollTop(),offset=$box.offset().top+1,$buttonPane=t.$btnPane,buttonPaneOuterHeight=$buttonPane.outerHeight()-2;if(scrollTop-offset>0&&scrollTop-offset-t.height<0){if(!t.isFixed){t.isFixed=true;$buttonPane.css({position:"fixed",top:0,left:fixedFullWidth?0:"auto",zIndex:7});t.$box.css({paddingTop:$buttonPane.height()})}$buttonPane.css({width:fixedFullWidth?"100%":$box.width()-1});$("."+t.o.prefix+"fixed-top",$box).css({position:fixedFullWidth?"fixed":"absolute",top:fixedFullWidth?buttonPaneOuterHeight:buttonPaneOuterHeight+(scrollTop-offset),zIndex:15})}else if(t.isFixed){t.isFixed=false;$buttonPane.removeAttr("style");t.$box.css({paddingTop:0});$("."+t.o.prefix+"fixed-top",$box).css({position:"absolute",top:buttonPaneOuterHeight})}})},
// Disable editor
setDisabled:function(disable){var t=this,prefix=t.o.prefix;t.disabled=disable;if(disable){t.$ta.attr("disabled",true)}else{t.$ta.removeAttr("disabled")}t.$box.toggleClass(prefix+"disabled",disable);t.$ed.attr("contenteditable",!disable)},
// Destroy the editor
destroy:function(){var t=this,prefix=t.o.prefix;if(t.isTextarea){t.$box.after(t.$ta.css({height:""}).val(t.html()).removeClass(prefix+"textarea").show())}else{t.$box.after(t.$ed.css({height:""}).removeClass(prefix+"editor").removeAttr("contenteditable").removeAttr("dir").html(t.html()).show())}t.$ed.off("dblclick","img");t.destroyPlugins();t.$box.remove();t.$c.removeData("trumbowyg");$("body").removeClass(prefix+"body-fullscreen");t.$c.trigger("tbwclose");$(window).off("scroll."+t.eventNamespace+" resize."+t.eventNamespace)},
// Empty the editor
empty:function(){this.$ta.val("");this.syncCode(true)},
// Function call when click on viewHTML button
toggle:function(){var t=this,prefix=t.o.prefix;if(t.o.autogrowOnEnter){t.autogrowOnEnterDontClose=!t.$box.hasClass(prefix+"editor-hidden")}t.semanticCode(false,true);setTimeout(function(){t.doc.activeElement.blur();t.$box.toggleClass(prefix+"editor-hidden "+prefix+"editor-visible");t.$btnPane.toggleClass(prefix+"disable");$("."+prefix+"viewHTML-button",t.$btnPane).toggleClass(prefix+"active");if(t.$box.hasClass(prefix+"editor-visible")){t.$ta.attr("tabindex",-1)}else{t.$ta.removeAttr("tabindex")}if(t.o.autogrowOnEnter&&!t.autogrowOnEnterDontClose){t.autogrowEditorOnEnter()}},0)},
// Open dropdown when click on a button which open that
dropdown:function(name){var t=this,$body=$("body",t.doc),prefix=t.o.prefix,$dropdown=$("[data-"+prefix+"dropdown="+name+"]",t.$box),$btn=$("."+prefix+name+"-button",t.$btnPane),show=$dropdown.is(":hidden");$body.trigger("mousedown");if(show){var btnOffsetLeft=$btn.offset().left;$btn.addClass(prefix+"active");$dropdown.css({position:"absolute",top:$btn.offset().top-t.$btnPane.offset().top+$btn.outerHeight(),left:t.o.fixedFullWidth&&t.isFixed?btnOffsetLeft:btnOffsetLeft-t.$btnPane.offset().left}).show();$(window).trigger("scroll");$body.on("mousedown."+t.eventNamespace,function(e){if(!$dropdown.is(e.target)){$("."+prefix+"dropdown",t.$box).hide();$("."+prefix+"active",t.$btnPane).removeClass(prefix+"active");$body.off("mousedown."+t.eventNamespace)}})}},
// HTML Code management
html:function(html){var t=this;if(html!=null){t.$ta.val(html);t.syncCode(true);t.$c.trigger("tbwchange");return t}return t.$ta.val()},syncTextarea:function(){var t=this;t.$ta.val(t.$ed.text().trim().length>0||t.$ed.find(t.o.tagsToKeep.join(",")).length>0?t.$ed.html():"")},syncCode:function(force){var t=this;if(!force&&t.$ed.is(":visible")){t.syncTextarea()}else{
// wrap the content in a div it's easier to get the innerhtml
var html=$("<div>").html(t.$ta.val());
//scrub the html before loading into the doc
var safe=$("<div>").append(html);$(t.o.tagsToRemove.join(","),safe).remove();t.$ed.html(safe.contents().html())}if(t.o.autogrow){t.height=t.$ed.height();if(t.height!==t.$ta.css("height")){t.$ta.css({height:t.height});t.$c.trigger("tbwresize")}}if(t.o.autogrowOnEnter){
// t.autogrowEditorOnEnter();
t.$ed.height("auto");var totalheight=t.autogrowOnEnterWasFocused?t.$ed[0].scrollHeight:t.$ed.css("min-height");if(totalheight!==t.$ta.css("height")){t.$ed.css({height:totalheight});t.$c.trigger("tbwresize")}}},
// Analyse and update to semantic code
// @param force : force to sync code from textarea
// @param full  : wrap text nodes in <p>
// @param keepRange  : leave selection range as it is
semanticCode:function(force,full,keepRange){var t=this;t.saveRange();t.syncCode(force);if(t.o.semantic){t.semanticTag("b",t.o.semanticKeepAttributes);t.semanticTag("i",t.o.semanticKeepAttributes);t.semanticTag("s",t.o.semanticKeepAttributes);t.semanticTag("strike",t.o.semanticKeepAttributes);if(full){var inlineElementsSelector=t.o.inlineElementsSelector,blockElementsSelector=":not("+inlineElementsSelector+")";
// Wrap text nodes in span for easier processing
t.$ed.contents().filter(function(){return this.nodeType===3&&this.nodeValue.trim().length>0}).wrap("<span data-tbw/>");
// Wrap groups of inline elements in paragraphs (recursive)
var wrapInlinesInParagraphsFrom=function($from){if($from.length!==0){var $finalParagraph=$from.nextUntil(blockElementsSelector).addBack().wrapAll("<p/>").parent(),$nextElement=$finalParagraph.nextAll(inlineElementsSelector).first();$finalParagraph.next("br").remove();wrapInlinesInParagraphsFrom($nextElement)}};wrapInlinesInParagraphsFrom(t.$ed.children(inlineElementsSelector).first());t.semanticTag("div",true);
// Unwrap paragraphs content, containing nothing useful
t.$ed.find("p").filter(function(){
// Don't remove currently being edited element
if(t.range&&this===t.range.startContainer){return false}return $(this).text().trim().length===0&&$(this).children().not("br,span").length===0}).contents().unwrap();
// Get rid of temporary span's
$("[data-tbw]",t.$ed).contents().unwrap();
// Remove empty <p>
t.$ed.find("p:empty").remove()}if(!keepRange){t.restoreRange()}t.syncTextarea()}},semanticTag:function(oldTag,copyAttributes){var newTag;if(this.o.semantic!=null&&typeof this.o.semantic==="object"&&this.o.semantic.hasOwnProperty(oldTag)){newTag=this.o.semantic[oldTag]}else if(this.o.semantic===true&&this.DEFAULT_SEMANTIC_MAP.hasOwnProperty(oldTag)){newTag=this.DEFAULT_SEMANTIC_MAP[oldTag]}else{return}$(oldTag,this.$ed).each(function(){var $oldTag=$(this);if($oldTag.contents().length===0){return false}$oldTag.wrap("<"+newTag+"/>");if(copyAttributes){$.each($oldTag.prop("attributes"),function(){$oldTag.parent().attr(this.name,this.value)})}$oldTag.contents().unwrap()})},
// Function call when user click on "Insert Link"
createLink:function(){var t=this,documentSelection=t.doc.getSelection(),node=documentSelection.focusNode,text=(new XMLSerializer).serializeToString(documentSelection.getRangeAt(0).cloneContents()),url,title,target;while(["A","DIV"].indexOf(node.nodeName)<0){node=node.parentNode}if(node&&node.nodeName==="A"){var $a=$(node);text=$a.text();url=$a.attr("href");if(!t.o.minimalLinks){title=$a.attr("title");target=$a.attr("target")}var range=t.doc.createRange();range.selectNode(node);documentSelection.removeAllRanges();documentSelection.addRange(range)}t.saveRange();var options={url:{label:"URL",required:true,value:url},text:{label:t.lang.text,value:text}};if(!t.o.minimalLinks){Object.assign(options,{title:{label:t.lang.title,value:title},target:{label:t.lang.target,value:target}})}t.openModalInsert(t.lang.createLink,options,function(v){// v is value
var url=t.prependUrlPrefix(v.url);if(!url.length){return false}var link=$(['<a href="',url,'">',v.text||v.url,"</a>"].join(""));if(!t.o.minimalLinks){if(v.title.length>0){link.attr("title",v.title)}if(v.target.length>0){link.attr("target",v.target)}else{link.attr("target","_blank")}}t.range.deleteContents();t.range.insertNode(link[0]);t.syncCode();t.$c.trigger("tbwchange");return true})},prependUrlPrefix:function(url){var t=this;if(!t.urlPrefix){return url}var VALID_LINK_PREFIX=/^([a-z][-+.a-z0-9]*:|\/|#)/i;if(VALID_LINK_PREFIX.test(url)){return url}var SIMPLE_EMAIL_REGEX=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;if(SIMPLE_EMAIL_REGEX.test(url)){return"mailto:"+url}return t.urlPrefix+url},unlink:function(){var t=this,documentSelection=t.doc.getSelection(),node=documentSelection.focusNode;if(documentSelection.isCollapsed){while(["A","DIV"].indexOf(node.nodeName)<0){node=node.parentNode}if(node&&node.nodeName==="A"){var range=t.doc.createRange();range.selectNode(node);documentSelection.removeAllRanges();documentSelection.addRange(range)}}t.execCmd("unlink",undefined,undefined,true)},insertImage:function(){var t=this;t.saveRange();var options={url:{label:"URL",required:true},alt:{label:t.lang.description,value:t.getRangeText()}};if(t.o.imageWidthModalEdit){options.width={}}t.openModalInsert(t.lang.insertImage,options,function(v){// v are values
t.execCmd("insertImage",v.url,false,true);var $img=$('img[src="'+v.url+'"]:not([alt])',t.$box);$img.attr("alt",v.alt);if(t.o.imageWidthModalEdit){$img.attr({width:v.width})}t.syncCode();t.$c.trigger("tbwchange");return true})},fullscreen:function(){var t=this,prefix=t.o.prefix,fullscreenCssClass=prefix+"fullscreen",fullscreenPlaceholderClass=fullscreenCssClass+"-placeholder",isFullscreen,editorHeight=t.$box.outerHeight();t.$box.toggleClass(fullscreenCssClass);isFullscreen=t.$box.hasClass(fullscreenCssClass);if(isFullscreen){t.$box.before($("<div/>",{class:fullscreenPlaceholderClass}).css({height:editorHeight}))}else{$("."+fullscreenPlaceholderClass).remove()}$("body").toggleClass(prefix+"body-fullscreen",isFullscreen);$(window).trigger("scroll");t.$c.trigger("tbw"+(isFullscreen?"open":"close")+"fullscreen")},
/*
         * Call method of trumbowyg if exist
         * else try to call anonymous function
         * and finally native execCommand
         */
execCmd:function(cmd,param,forceCss,skipTrumbowyg){var t=this;skipTrumbowyg=!!skipTrumbowyg||"";console.log(param);if(cmd!=="dropdown"){t.$ed.focus()}try{t.doc.execCommand("styleWithCSS",false,forceCss||false)}catch(c){}try{t[cmd+skipTrumbowyg](param)}catch(c){try{cmd(param)}catch(e2){if(cmd==="insertHorizontalRule"){param=undefined}else if(cmd==="formatBlock"&&t.isIE){param="<"+param+">"}t.doc.execCommand(cmd,false,param);t.syncCode();t.semanticCode(false,true)}if(cmd!=="dropdown"){t.updateButtonPaneStatus();t.$c.trigger("tbwchange")}}},
// Open a modal box
openModal:function(title,content){var t=this,prefix=t.o.prefix;
// No open a modal box when exist other modal box
if($("."+prefix+"modal-box",t.$box).length>0){return false}if(t.o.autogrowOnEnter){t.autogrowOnEnterDontClose=true}t.saveRange();t.showOverlay();
// Disable all btnPane btns
t.$btnPane.addClass(prefix+"disable");
// Build out of ModalBox, it's the mask for animations
var $modal=$("<div/>",{class:prefix+"modal "+prefix+"fixed-top"}).css({top:t.$box.offset().top+t.$btnPane.height(),zIndex:99999}).appendTo($(t.doc.body));
// Click on overlay close modal by cancelling them
t.$overlay.one("click",function(){$modal.trigger(CANCEL_EVENT);return false});
// Build the form
var $form=$("<form/>",{action:"",html:content}).on("submit",function(){$modal.trigger(CONFIRM_EVENT);return false}).on("reset",function(){$modal.trigger(CANCEL_EVENT);return false}).on("submit reset",function(){if(t.o.autogrowOnEnter){t.autogrowOnEnterDontClose=false}});
// Build ModalBox and animate to show them
var $box=$("<div/>",{class:prefix+"modal-box",html:$form}).css({top:"-"+t.$btnPane.outerHeight(),opacity:0}).appendTo($modal).animate({top:0,opacity:1},100);
// Append title
$("<span/>",{text:title,class:prefix+"modal-title"}).prependTo($box);$modal.height($box.outerHeight()+10);
// Focus in modal box
$("input:first",$box).focus();
// Append Confirm and Cancel buttons
t.buildModalBtn("submit",$box);t.buildModalBtn("reset",$box);$(window).trigger("scroll");return $modal},
// @param n is name of modal
buildModalBtn:function(n,$modal){var t=this,prefix=t.o.prefix;return $("<button/>",{class:prefix+"modal-button "+prefix+"modal-"+n,type:n,text:t.lang[n]||n}).appendTo($("form",$modal))},
// close current modal box
closeModal:function(){var t=this,prefix=t.o.prefix;t.$btnPane.removeClass(prefix+"disable");t.$overlay.off();
// Find the modal box
var $modalBox=$("."+prefix+"modal-box",$(t.doc.body));$modalBox.animate({top:"-"+$modalBox.height()},100,function(){$modalBox.parent().remove();t.hideOverlay()});t.restoreRange()},
// Preformatted build and management modal
openModalInsert:function(title,fields,cmd){var t=this,prefix=t.o.prefix,lg=t.lang,html="";$.each(fields,function(fieldName,field){var l=field.label||fieldName,n=field.name||fieldName,a=field.attributes||{};var attr=Object.keys(a).map(function(prop){return prop+'="'+a[prop]+'"'}).join(" ");html+='<label><input type="'+(field.type||"text")+'" name="'+n+'"'+(field.type==="checkbox"&&field.value?' checked="checked"':' value="'+(field.value||"").replace(/"/g,"&quot;"))+'"'+attr+'><span class="'+prefix+'input-infos"><span>'+(lg[l]?lg[l]:l)+"</span></span></label>"});return t.openModal(title,html).on(CONFIRM_EVENT,function(){var $form=$("form",$(this)),valid=true,values={};$.each(fields,function(fieldName,field){var n=field.name||fieldName;var $field=$('input[name="'+n+'"]',$form),inputType=$field.attr("type");switch(inputType.toLowerCase()){case"checkbox":values[n]=$field.is(":checked");break;case"radio":values[n]=$field.filter(":checked").val();break;default:values[n]=$.trim($field.val());break}
// Validate value
if(field.required&&values[n]===""){valid=false;t.addErrorOnModalField($field,t.lang.required)}else if(field.pattern&&!field.pattern.test(values[n])){valid=false;t.addErrorOnModalField($field,field.patternError)}});if(valid){t.restoreRange();if(cmd(values,fields)){t.syncCode();t.$c.trigger("tbwchange");t.closeModal();$(this).off(CONFIRM_EVENT)}}}).one(CANCEL_EVENT,function(){$(this).off(CONFIRM_EVENT);t.closeModal()})},addErrorOnModalField:function($field,err){var prefix=this.o.prefix,spanErrorClass=prefix+"msg-error",$label=$field.parent();$field.on("change keyup",function(){$label.removeClass(prefix+"input-error");setTimeout(function(){$label.find("."+spanErrorClass).remove()},150)});$label.addClass(prefix+"input-error").find("input+span").append($("<span/>",{class:spanErrorClass,text:err}))},getDefaultImgDblClickHandler:function(){var t=this;return function(){var $img=$(this),src=$img.attr("src"),base64="(Base64)";if(src.indexOf("data:image")===0){src=base64}var options={url:{label:"URL",value:src,required:true},alt:{label:t.lang.description,value:$img.attr("alt")}};if(t.o.imageWidthModalEdit){options.width={value:$img.attr("width")?$img.attr("width"):""}}t.openModalInsert(t.lang.insertImage,options,function(v){if(v.url!==base64){$img.attr({src:v.url})}$img.attr({alt:v.alt});if(t.o.imageWidthModalEdit){if(parseInt(v.width)>0){$img.attr({width:v.width})}else{$img.removeAttr("width")}}return true});return false}},
// Range management
saveRange:function(){var t=this,documentSelection=t.doc.getSelection();t.range=null;if(!documentSelection||!documentSelection.rangeCount){return}var savedRange=t.range=documentSelection.getRangeAt(0),range=t.doc.createRange(),rangeStart;range.selectNodeContents(t.$ed[0]);range.setEnd(savedRange.startContainer,savedRange.startOffset);rangeStart=(range+"").length;t.metaRange={start:rangeStart,end:rangeStart+(savedRange+"").length}},restoreRange:function(){var t=this,metaRange=t.metaRange,savedRange=t.range,documentSelection=t.doc.getSelection(),range;if(!savedRange){return}if(metaRange&&metaRange.start!==metaRange.end){// Algorithm from http://jsfiddle.net/WeWy7/3/
var charIndex=0,nodeStack=[t.$ed[0]],node,foundStart=false,stop=false;range=t.doc.createRange();while(!stop&&(node=nodeStack.pop())){if(node.nodeType===3){var nextCharIndex=charIndex+node.length;if(!foundStart&&metaRange.start>=charIndex&&metaRange.start<=nextCharIndex){range.setStart(node,metaRange.start-charIndex);foundStart=true}if(foundStart&&metaRange.end>=charIndex&&metaRange.end<=nextCharIndex){range.setEnd(node,metaRange.end-charIndex);stop=true}charIndex=nextCharIndex}else{var cn=node.childNodes,i=cn.length;while(i>0){i-=1;nodeStack.push(cn[i])}}}}
// Fix IE11 Error 'Could not complete the operation due to error 800a025e'.
// https://stackoverflow.com/questions/16160996/could-not-complete-the-operation-due-to-error-800a025e
try{documentSelection.removeAllRanges()}catch(e){}documentSelection.addRange(range||savedRange)},getRangeText:function(){return this.range+""},clearButtonPaneStatus:function(){var t=this,prefix=t.o.prefix,activeClasses=prefix+"active-button "+prefix+"active",originalIconClass=prefix+"original-icon";
// Reset all buttons and dropdown state
$("."+prefix+"active-button",t.$btnPane).removeClass(activeClasses);$("."+originalIconClass,t.$btnPane).each(function(){$(this).find("svg use").attr("xlink:href",$(this).data(originalIconClass))})},updateButtonPaneStatus:function(){var t=this,prefix=t.o.prefix,activeClasses=prefix+"active-button "+prefix+"active",originalIconClass=prefix+"original-icon",tags=t.getTagsRecursive(t.doc.getSelection().focusNode);t.clearButtonPaneStatus();$.each(tags,function(i,tag){var btnName=t.tagToButton[tag.toLowerCase()],$btn=$("."+prefix+btnName+"-button",t.$btnPane);if($btn.length>0){$btn.addClass(activeClasses)}else{try{$btn=$("."+prefix+"dropdown ."+prefix+btnName+"-dropdown-button",t.$box);var $btnSvgUse=$btn.find("svg use"),dropdownBtnName=$btn.parent().data(prefix+"dropdown"),$dropdownBtn=$("."+prefix+dropdownBtnName+"-button",t.$box),$dropdownBtnSvgUse=$dropdownBtn.find("svg use");
// Highlight the dropdown button
$dropdownBtn.addClass(activeClasses);
// Switch dropdown icon to the active sub-icon one
if(t.o.changeActiveDropdownIcon&&$btnSvgUse.length>0){
// Save original icon
$dropdownBtn.addClass(originalIconClass).data(originalIconClass,$dropdownBtnSvgUse.attr("xlink:href"));
// Put the active sub-button's icon
$dropdownBtnSvgUse.attr("xlink:href",$btnSvgUse.attr("xlink:href"))}}catch(e){}}})},getTagsRecursive:function(element,tags){var t=this;tags=tags||(element&&element.tagName?[element.tagName]:[]);if(element&&element.parentNode){element=element.parentNode}else{return tags}var tag=element.tagName;if(tag==="DIV"){return tags}if(tag==="P"&&element.style.textAlign!==""){tags.push(element.style.textAlign)}$.each(t.tagHandlers,function(i,tagHandler){tags=tags.concat(tagHandler(element,t))});tags.push(tag);return t.getTagsRecursive(element,tags).filter(function(tag){return tag!=null})},
// Plugins
initPlugins:function(){var t=this;t.loadedPlugins=[];$.each($.trumbowyg.plugins,function(name,plugin){if(!plugin.shouldInit||plugin.shouldInit(t)){plugin.init(t);if(plugin.tagHandler){t.tagHandlers.push(plugin.tagHandler)}t.loadedPlugins.push(plugin)}})},destroyPlugins:function(){var t=this;$.each(this.loadedPlugins,function(i,plugin){if(plugin.destroy){plugin.destroy(t)}})}}})(navigator,window,document,jQuery);
// Common functions
var cms=cms||{};cms.makeEventListener=function(_class){_class.prototype.on=function(eventList,callback){if(typeof this.eventListeners==="undefined"){this.eventListeners={}}var events=eventList.split(",");for(var i=0;i<events.length;i++){var event=events[i].replace(/\s/,"");if(typeof this.eventListeners[event]==="undefined"){this.eventListeners[event]=[]}this.eventListeners[event].push(callback)}return this};_class.prototype.trigger=function(event,parameters){if(typeof this.eventListeners==="undefined"||typeof this.eventListeners[event]==="undefined"){return true}for(var i=0;i<this.eventListeners[event].length;i++){var result=this.eventListeners[event][i].call(this,parameters);if(typeof result!=="undefined"&&!result){return false}}return true}};function reloadOewa(path){
// window.iom is true if the oewa 2.0 version is used
// otherwise try old version
if(window.iom){iom.c(oewa_data,1)}return}function checkCookieEnabled(){if(navigator.cookieEnabled===false){jQuery("#cookie-disabled").show()}else{jQuery("#cookie-bar").show()}}function piGoogleAnalytics(eventCategorie,eventAction,eventLabel,eventValue){if(typeof Cookiebot!=="undefined"&&(typeof Cookiebot.consent.statistics==="undefined"||Cookiebot.consent.statistics)&&typeof ga!=="undefined"){ga("send","event",{eventCategory:eventCategorie,eventAction:eventAction,eventLabel:eventLabel,eventValue:eventValue})}}
/**
 * Check iban of ePaper order
 * @param string ibanNumber
 * @returns Boolean
 */function validIban(ibanNumber){var countryCode=ibanNumber.substr(0,2);var checksum=ibanNumber.substr(2,2);var bankData=ibanNumber.substr(4);if(isNaN(checksum)||isNaN(bankData)){return false}if(!ibanChecksumValidation(countryCode,checksum,bankData)||!ibanCompareChecksums(countryCode,checksum,bankData)){return false}return true}
/**
 * Validation of the iban checksum
 * @param string countryCode
 * @param string checksum
 * @param string bankData
 * @returns Boolean
 */function ibanChecksumValidation(countryCode,checksum,bankData){var testNumber;var validationResult;var countryCodeFirstLetter=parseInt(countryCode.substr(0,1),36).toString();var countryCodeSecondLetter=parseInt(countryCode.substr(1,1),36).toString();testNumber=bankData+""+countryCodeFirstLetter+""+countryCodeSecondLetter+""+checksum;validationResult=testNumber%97;if(validationResult!==1){return false}return true}
/**
 * Compare calculated checksum with checksum param to validat iban
 * @param string countryCode
 * @param string checksum
 * @param string bankData
 * @returns Boolean
 */function ibanCompareChecksums(countryCode,checksum,bankData){var testNumber;var divisionRest;var calculatedChecksum;var countryCodeFirstLetter=parseInt(countryCode.substr(0,1),36).toString();var countryCodeSecondLetter=parseInt(countryCode.substr(1,1),36).toString();testNumber=bankData+""+countryCodeFirstLetter+""+countryCodeSecondLetter+""+"00";divisionRest=testNumber%97;calculatedChecksum=98-divisionRest;if(calculatedChecksum!==checksum){return false}return true}function validEmail(email){var regEx=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return regEx.test(email)}function slugifyJS(value){value=value.replace(/Á|À|Â|Ã/g,"A");value=value.replace(/â|à|å|ã|á/g,"a");value=value.replace(/Ä/g,"AE");value=value.replace(/ä/g,"ae");value=value.replace(/Ç|Č/g,"C");value=value.replace(/ç|č/g,"c");value=value.replace(/É|Ê|È|Ë/g,"E");value=value.replace(/é|ê|è|ë/g,"e");value=value.replace(/Ó|Ô|Ò|Õ|Ø/g,"O");value=value.replace(/ó|ô|ò|õ|ø/g,"o");value=value.replace(/Ö|Œ/g,"OE");value=value.replace(/ñ/g,"n");value=value.replace(/Ñ/g,"N");value=value.replace(/ö|œ/g,"oe");value=value.replace(/Š/g,"S");value=value.replace(/š/g,"s");value=value.replace(/ß/g,"ss");value=value.replace(/ẞ/g,"SS");value=value.replace(/Ú|Û|Ù/g,"U");value=value.replace(/ú|û|ù/g,"u");value=value.replace(/Ü/g,"UE");value=value.replace(/ü/g,"ue");value=value.replace(/Ý|Ÿ/g,"Y");value=value.replace(/ý|ÿ/g,"y");value=value.replace(/Ž/g,"Z");value=value.replace(/ž/,"z");value=value.replace(/ /,"-");value=value.replace(/[.]/,"-");value=value.replace(/€/,"Euro");value=value.replace(/[$]/,"Dollar");value=value.replace(/¥/,"Yen");value=value.replace(/,/,"-");value=value.replace(/_/,"-");value=value.replace(/-/,"-");value=value.replace(/"/,"-");value=value.replace(/\'/,"-");value=value.replace(/[/]/,"-");
// remove non-supported characters
value=value.replace(/[^a-zA-Z0-9]+/g,"-");
// make sure the url is lower case
value=value.toLowerCase();return value}
/**
 * detect IE
 * returns version of IE or false, if browser is not Internet Explorer
 */function detectIE(){var ua=window.navigator.userAgent;var msie=ua.indexOf("MSIE ");if(msie>0){
// IE 10 or older => return version number
return parseInt(ua.substring(msie+5,ua.indexOf(".",msie)),10)}var trident=ua.indexOf("Trident/");if(trident>0){
// IE 11 => return version number
var rv=ua.indexOf("rv:");return parseInt(ua.substring(rv+3,ua.indexOf(".",rv)),10)}var edge=ua.indexOf("Edge/");if(edge>0){
// Edge (IE 12+) => return version number
return parseInt(ua.substring(edge+5,ua.indexOf(".",edge)),10)}
// other browser
return false}(function($){$.fn.shuffle=function(){var allElems=this.get(),getRandom=function(max){return Math.floor(Math.random()*max)},shuffled=$.map(allElems,function(){var random=getRandom(allElems.length),randEl=$(allElems[random]).clone(true)[0];allElems.splice(random,1);return randEl});this.each(function(i){$(this).replaceWith($(shuffled[i]))});return $(shuffled)}})(jQuery);var cms=cms||{};cms.Gallery=function(id){var Slideshow=function(){var Slideshow=function($node,$slides){cms.Slideshow.call(this,$node,$slides)};Slideshow.prototype=$.extend({},cms.Slideshow.prototype);Slideshow.prototype.sizeChanged=function(){cms.Slideshow.prototype.sizeChanged.call(this);
// for IE 8 and below we have to set the node-with with JS
// in modern browsers this is accomplished with CSS3 calc()
if($.browser.msie&&parseInt($.browser.version)<=8){
//this.$node.css('height', $(window).height()-286);
//this.$node.css('width', $(window).width()-339);
}
// ca: The next command is required for webkit-based browsers. A quirk in
// the rendering engine disregards the change of the image width under
// very special circumstances:
// - the image has no explicit width
// - the image has a defined height
// - the width of the slide depends on the width of a contained image
// Fortunately, this work-around seems to resolve that problem.
};cms.makeEventListener(Slideshow);return Slideshow}();var self=this;this.id=id;var $slidesNode=$("#slider-"+id);var $slides=$slidesNode.find(".slider-image");this.$adContainer=$(".content-ad#pos"+id);$(".gallery-text .gallery-container").remove();// remove all galleries from gallery-text nodes to assure html is not containing doubled gallery-ids
this.slideshow=new Slideshow($slidesNode,$slides);$("#nextslide-"+id).on("click",function(event){self.slideshow.next();event.preventDefault();return false});$("#prevslide-"+id).on("click",function(event){self.slideshow.prev();event.preventDefault();return false});$("#fullscreen-"+id).on("click",function(event){self.enableFullscreen();event.preventDefault();return false});$("#fb-share-link-"+id).on("click",function(event){event.preventDefault();self.shareSingleImageViaFB($(this));return false});$("#close-fullscreen-"+id+", #close-fullscreen-link-"+id).on("click",function(event){self.disableFullscreen();event.preventDefault();return false});$(window).on("resize",function(event){self.setFullscreenImageSize()});self.slideshow.on("afterslidechange",function(options){
// the multiple options came here
$fbshare=$("#gallery-container-"+id).find("a.fb-share-link");var index=$("#gallery-container-"+id+" .slide-wrapper").index(self.slideshow.currentSlide());var imageNumber=self.slideshow.currentSlide().find(".slider-image").data("image-number");var isAd=false;imageNumber=typeof imageNumber!==typeof undefined&&imageNumber!==false?imageNumber:-1;
// if current slide is one before or one after an diashow ad
// try to load the diashow ad (if necessary)
/*
        if (((index % 10 == 0) || ((index + 2) % 10 == 0)) && index != 0 && $('#gallery-container-' + id + ' .more-content-cad').length > 0) {
            if (typeof loadDiashowAd['ad_' + (Math.round(index / 10))] === 'function') {
                loadDiashowAd['ad_' + (Math.round(index / 10))]();
            }
        }
        */if(self.slideshow.currentSlide().find(".slider-image").hasClass("more-content-cad")){isAd=true;$("#gallery-container-"+id+" .gallery").addClass("gallery--greycad");$("#gallery-container-"+id+" .gallery__advertisement").hide();$("#gallery-container-"+id+" .gallery-image-counts").show();$("#gallery-container-"+id+" .gallery-image-credit").show();
// $(window).trigger('resize');
}else if(self.slideshow.currentSlide().find(".slider-image").hasClass("more-content")||self.slideshow.currentSlide().find(".more-content").length>0){$("#gallery-container-"+id+" .gallery").addClass("gallery--grey");$("#gallery-container-"+id+" .gallery__advertisement").hide();$("#gallery-container-"+id+" .gallery-image-counts").hide();$("#gallery-container-"+id+" .gallery-image-credit").hide()}else{$("#gallery-container-"+id+" .gallery").removeClass("gallery--grey gallery--greycad");$("#gallery-container-"+id+" .gallery__advertisement").show();$("#gallery-container-"+id+" .gallery-image-counts").show();$("#gallery-container-"+id+" .gallery-image-credit").show();if(!options.noResize){$(window).trigger("resize")}}$("#gallery-image-current-"+id).text(options.index+1);$("#gallery-image-credit-"+id+" span").hide();
// $('#gallery-image-credit-' + id + ' .credit-' + options.index).show();
$("#gallery-image-text-"+id+" span").hide();
// $('#gallery-text-' + id).html($('#gallery-image-text-' + id + ' .text-' + options.index).html());
// $('#gallery-image-text-' + id + ' .text-' + options.index).show().css('display', 'inline-block');
if(imageNumber>-1){$("#gallery-text-"+id).html($("#gallery-image-text-"+id+' span[data-image-number="'+imageNumber+'"]').html());$("#gallery-image-text-"+id+' span[data-image-number="'+imageNumber+'"]').show().css("display","inline-block");$("#gallery-image-credit-"+id+' span[data-image-number="'+imageNumber+'"]').show()}if(isAd){$("#gallery-image-credit-"+id+" span.credit-ad").show()}if(self.isFullscreen()){window.location.hash="#"+self.getSlideShowId()+","+self.slideshow.currentSlide().find(".slider-image").attr("data-slide-id");$("#gallery-container-"+id).find(".addthis_inline_share_toolbox").data("url",window.location+"")}$fbshare=$("#gallery-container-"+id).find("a.fb-share-link");$fbshare.data("href",self.slideshow.currentSlide().find(".slider-image").data("sharing"));$fbshare.data("picture",self.slideshow.currentSlide().find(".slider-image").attr("src"));
// Google Analytics event tracking
piGoogleAnalytics("Galerie",window.location.origin.concat(window.location.pathname),$(".gallery-right-area .text .title").text().substr(0,$(".gallery-right-area .text .title").text().length-1))});
// handle url-hash
var hash=window.location.hash.replace(/^#/,"");if(hash){var slideShowId=hash.replace(/,.*/,"");if(slideShowId==self.getSlideShowId()){var slideId=hash.replace(/^[^,]*,/,"");for(var i=0;i<$slides.length;i++){if($slides.eq(i).attr("data-slide-id")==slideId){this.slideshow.jumpTo(i,false);this.enableFullscreen();break}}}}$(window).on("hashchange",function(){
// handle url-hash
var hash=window.location.hash.replace(/^#/,"");if(hash){var slideShowId=hash.replace(/,.*/,"");if(slideShowId==self.getSlideShowId()){var slideId=hash.replace(/^[^,]*,/,"");for(var i=0;i<$slides.length;i++){if($slides.eq(i).attr("data-slide-id")==slideId){if(self.slideshow.currentSlideNum()!=i){self.slideshow.jumpTo(i,false)}
//self.enableFullscreen();
break}}}}else{
//self.disableFullscreen();
}});self.on("enabled-fullscreen",function(){window.location.hash="#"+self.getSlideShowId()+","+self.slideshow.currentSlide().find(".slider-image").attr("data-slide-id")}).on("disabled-fullscreen",function(){window.location.hash=""})};cms.makeEventListener(cms.Gallery);cms.Gallery.prototype.getSlideShowId=function(){return this.id.replace(/[^0-9-]/g,"")};cms.Gallery.fullscreenInstance=null;cms.Gallery.mobileInstance=null;cms.Gallery.prototype.enableFullscreen=function(){if(cms.Gallery.fullscreenInstance===this){return}if(cms.Gallery.fullscreenInstance){cms.Gallery.fullscreenInstance.disableFullscreen()}this.trigger("enabling-fullscreen");currentScrollPosition=$(window).scrollTop();cms.Gallery.fullscreenInstance=this;$("body").addClass("gallery-in-fullscreen");$("#gallery-container-"+this.id).addClass("in-fullscreen");this.setFullscreenImageSize();this.slideshow.sizeChanged();var self=this;$(document).on("keydown."+this.id,function(event){if(event.keyCode==27){self.disableFullscreen();event.preventDefault();return false}if(event.keyCode==39){self.slideshow.next();event.preventDefault();return false}if(event.keyCode==37){self.slideshow.prev();event.preventDefault();return false}});this.trigger("enabled-fullscreen");this.slideshow.sizeChanged()};cms.Gallery.prototype.isFullscreen=function(){return cms.Gallery.fullscreenInstance===this};cms.Gallery.prototype.shareSingleImageViaFB=function($link){FB.ui({method:"feed",link:$link.data("href"),picture:$link.data("picture")},function(response){})};cms.Gallery.prototype.disableFullscreen=function(){if(cms.Gallery.fullscreenInstance!==this){return}this.trigger("disabling-fullscreen");var $container=$("#gallery-container-"+this.id);$("body").removeClass("gallery-in-fullscreen");$container.removeClass("in-fullscreen");$container.find(".image-slider").css("height","");$container.find(".image-slider .loaded").css("max-height","");this.slideshow.sizeChanged();cms.Gallery.fullscreenInstance=null;$(document).off("keydown."+this.id);this.trigger("disabled-fullscreen");window.scrollTo(0,currentScrollPosition);this.slideshow.sizeChanged()};cms.Gallery.prototype.setFullscreenImageSize=function(){if(cms.Gallery.fullscreenInstance!==this){return}var self=this;var setMaxHeight=function(){$("#slider-"+self.id+" .loaded").each(function(){$(this).css("max-height",Math.ceil($(this).width()/($(this)[0].naturalWidth/$(this)[0].naturalHeight))+"px");//  fix max-height, so the image is not distorted
})};this.on("enabled-fullscreen",function(){if($("#slider-"+self.id+" .loaded").length){setMaxHeight()}else{self.slideshow.on("imagesLoaded",function(){// waits till images are loaded which is needed when user starts fullscreen directly via link
setMaxHeight()})}})};var cms=cms||{};cms.Slideshow=function($node,$slides){cms.Slideshow.init();var self=this;var index=0;self.$node=$node;self.$node.css("overflow","hidden");self.slideWidth=self.$node.width();self.slideHeight=self.$node.height();var slideNodes=[];$slides.each(function(key,value){slideNodes.push($(value).wrap('<div style="float:left;" class="slide-wrapper image-slider__slide"></div>').parent()[0])});self.$slides=$(slideNodes);self.$slides.width(self.slideWidth);self.$slideContainer=$('<div class="image-slider__slide-container"></div>');self.$slideContainer.width(self.$node.width()*self.$slides.length);self.$slideContainer.css("position","relative");self.$slideContainer.css("left","0px");self.$slideContainer.append(self.$slides);self.$node.prepend(self.$slideContainer);self.$slideContainer.data("direction","next");self.$node.closest(".gallery-container").find(".slider-button-prev, .slider-button-next").css("top",self.currentSlide().width()/16*9/2);self.$slideContainer.find(".more-content").parent().addClass("image-slider__slide--more");self.$node.find(".image-slider__slide:first-of-type").addClass("image-slider__slide--active");this.loadImages([index-1,index,index+1]);self.$slideContainer.find(".more-content").removeClass("hidden");self.$node.removeClass("image-slider--loading");var touchLocation=function(event){event=event.originalEvent;
// android always returns [0,0] as event.pageX/.pageY and provides
// multiple coordinates of multi-touch capable devices as
// event.changedTouches.
if(typeof event.changedTouches!=="undefined"){return[event.changedTouches[0].pageX,event.changedTouches[0].pageY]}return[event.pageX,event.pageY]};self.$slideContainer.on("touchstart",function(event){var $this=$(this);var initialLeft=$this.offset().left;var initialMouseLeft=touchLocation(event)[0];var initialMouseTop=touchLocation(event)[1];var maxLeftDistance=self.slideWidth*(self.isFirstSlide()?.1:1.1);var maxRightDistance=self.slideWidth*(self.isLastSlide()?.1:1.1);self.$slideContainer.one("touchmove",function(event){var horizontalDistance=initialMouseLeft-touchLocation(event)[0];var verticalDistance=initialMouseTop-touchLocation(event)[1];if(Math.abs(horizontalDistance)>Math.abs(verticalDistance)){var moveListener=function(event){var currentMouseLeft=touchLocation(event)[0];var distance=currentMouseLeft-initialMouseLeft;if(distance<0){var relativeDistance=Math.min(1,-distance/maxRightDistance);var adjustedDistance=-maxRightDistance*(1-Math.pow(1-relativeDistance,3))}else{var relativeDistance=Math.min(1,distance/maxLeftDistance);var adjustedDistance=maxLeftDistance*(1-Math.pow(1-relativeDistance,3))}self.$slideContainer.css("left",""+Math.round(initialLeft+adjustedDistance)+"px")};$this.on("touchmove",moveListener);$(document).one("touchend",function(event){$this.off("touchmove",moveListener);if(touchLocation(event)[0]==initialMouseLeft){self.trigger("dragcancel")}else{self.snap();self.trigger("dragstop");event.preventDefault();return false}});$(document).one("touchcancel",function(event){self.$slideContainer.css("left",""+initialLeft+"px");self.trigger("dragcancel")});self.trigger("dragstart");event.preventDefault();return false}})});cms.Slideshow.instances.push(self);self.on("afterslidechange",function(options){if(!options.isUserTriggered){return}
// track oewa PI, on user action
reloadOewa(OEWA);
// self.sizeChanged();
})};cms.Slideshow.instances=[];cms.Slideshow.prototype.isFirstSlide=function(){return this.currentSlideNum()==0};cms.Slideshow.prototype.isLastSlide=function(){return this.currentSlideNum()==this.$slides.length-1};cms.Slideshow.prototype.currentLeft=function(){return parseInt(this.$slideContainer.css("left").replace(/px$/,""),10)};cms.Slideshow.prototype.currentSlide=function(){return this.$slides.eq(this.currentSlideNum())};cms.Slideshow.prototype.currentSlideNum=function(){
/*
    var slideNumber = Math.round(-this.currentLeft() / this.slideWidth);
    return Math.max(0, Math.min(this.$slides.length - 1, slideNumber));
    */
var slideNumber=$(this.$slides).index(this.$slideContainer.find(".image-slider__slide--active"));return slideNumber};cms.Slideshow.prototype.snap=function(){this.jumpTo(this.currentSlideNum())};cms.Slideshow.prototype.next=function(){var self=this;if(self.$slideContainer.data("direction")=="next"&&this.currentSlideNum()+1==this.$slides.index(this.$slides.find(".slider-image").not(".image-slider__slide--more").last().parent())){console.log("Gallery: last image reached");dataLayer.push({event:"gallery-last-image-reached"});piGoogleAnalytics("Galerie","Last-Image-Reached",window.location.href)}if(self.isLastSlide()){self.$slideContainer.stop().animate({left:self.currentLeft()-self.slideWidth*.15},100,"swing",function(){self.jumpTo(0)});return false}self.jumpTo(self.currentSlideNum()+1);return true};cms.Slideshow.prototype.prev=function(){var self=this;if(self.isFirstSlide()){self.$slideContainer.stop().animate({left:self.currentLeft()+self.slideWidth*.15},100,"swing",function(){self.jumpTo(self.$slides.length-1)});return false}self.$slideContainer.data("direction","prev");self.jumpTo(self.currentSlideNum()-1);return true};cms.Slideshow.prototype.jumpTo=function(index,isUserTriggered){var self=this;if(typeof isUserTriggered==="undefined"){isUserTriggered=true}if(this.$slides.eq(index).length==0){return}if(index==0){this.$slideContainer.data("direction","next")}this.$slides.removeClass("image-slider__slide--active");this.$slides.eq(index).addClass("image-slider__slide--active");this.loadImages([index-2,index,index+2]);var margin=(this.$node.width()-this.$slides.eq(index).width())/2;var finalLeft=-this.$slides.eq(index).position().left+margin;
// var finalLeft = -(index * this.slideWidth);
if(isUserTriggered){this.$slideContainer.stop().animate({left:finalLeft},400,"swing",function(){self.trigger("afterslidechange",{index:index,isUserTriggered:isUserTriggered,noResize:false})})}else{this.$slideContainer.css("left",finalLeft);this.trigger("afterslidechange",{index:index,isUserTriggered:isUserTriggered,noResize:true})}this.trigger("slidechange",{index:index,isUserTriggered:isUserTriggered})};cms.Slideshow.prototype.loadImages=function(indexes){var self=this;if(typeof indexes!=="object"){indexes=[indexes]}for(var i=0;i<indexes.length;i++){var index=indexes[i];
// sets which image to load (fullscreen or normal)
var attrToLoad=$("body").hasClass("gallery-in-fullscreen")?"data-src-fullscreen":"data-src";this.$slides.eq(index).find("img["+attrToLoad+"]").each(function(key,img){var $img=$(img);$img.one("load",function(){$(this).addClass("loaded").removeClass("loading");
// At least the normal version of the image is being loaded, so we can remove
// this element for sure. If the fullscreen image was loaded, both attributes
// can be removed, because we don't need the sd image any more.
$(this).removeAttr("data-src");if(attrToLoad==="data-src-fullscreen"){$(this).removeAttr("data-src-fullscreen")}if(i===indexes.length){self.trigger("imagesLoaded")}}).addClass("loading").attr("src",$img.attr(attrToLoad))})}};cms.Slideshow.prototype.sizeChanged=function(){var self=this;var currentSlideNum=this.currentSlideNum();var allSlidesWidth=0;var galleryWidth=this.$node.width();var galleryHeight=this.$node.height();var blockRatio=galleryWidth/galleryHeight<1.5;this.$slideContainer.find(".slide-wrapper").not(".image-slider__slide--more").each(function(i){var $img=$(this).find("img.loaded");if(blockRatio){$img.css("width","auto");$img.css("height","auto");
//$img.css('marginTop', ((galleryHeight - $img.height())/2) + 'px');
if($img.height()>galleryHeight){$img.css("height",galleryHeight+"px");$img.css("width","auto");$img.css("marginTop","0")}}else{$img.css("width","auto");$img.css("height","100%");$img.css("marginTop","0")}allSlidesWidth+=$img.width();if($(this).closest(".gallery-container").hasClass("in-fullscreen")){$(this).width("auto")}else{$(this).width($img.width())}if($(this).find(".more-content-cad")){if($(this).find(".content-ad--manuell")){$(this).width($(this).closest(".gallery").width())}allSlidesWidth+=$(this).width()}});moreWidth=self.$node.width();this.$slideContainer.find(".image-slider__slide--more").width(moreWidth);this.$slideContainer.width(Math.ceil(allSlidesWidth+moreWidth+1));this.jumpTo(currentSlideNum,false);
// Additonal resizing only for rebrush21
if(this.$node.data("rebrush21")&&!this.$node.hasClass("in-fullscreen")){
// var imgWidthOriginal = this.$slides.eq(currentSlideNum).find('img').data('width');
// var imgHeightOriginal = this.$slides.eq(currentSlideNum).find('img').data('height');
var imgWidthOriginal=this.$slides.eq(currentSlideNum).find("img")[0].naturalWidth;var imgHeightOriginal=this.$slides.eq(currentSlideNum).find("img")[0].naturalHeight;if(imgHeightOriginal>imgWidthOriginal){this.$node.css("height","auto")}else{if(this.$node.width()/(imgWidthOriginal/imgHeightOriginal)>imgHeightOriginal){this.$node.height(imgHeightOriginal)}else{this.$node.height(this.$node.width()/(imgWidthOriginal/imgHeightOriginal))}}}};(function(){var onResizeFunction=function(){for(var i=0;i<cms.Slideshow.instances.length;i++){if(typeof cms.Slideshow.instances[i]!=="undefined"){cms.Slideshow.instances[i].sizeChanged()}}};var onResizeTimer=null;$(window).resize(function(){for(var i=0;i<cms.Slideshow.instances.length;i++){if(typeof cms.Slideshow.instances[i]!=="undefined"){cms.Slideshow.instances[i].sizeChanged()}}});$(window).bind("orientationchange",function(){for(var i=0;i<cms.Slideshow.instances.length;i++){if(typeof cms.Slideshow.instances[i]!=="undefined"){cms.Slideshow.instances[i].sizeChanged()}}});cms.Slideshow.init=function(){cms.makeEventListener(cms.Slideshow);cms.Slideshow.init=function(){}}})();var frontend=frontend||{};frontend.heurigenCalendar=function($element,isMobile){var self=this;self.$calendar=$element;self.$activeMonth=self.$calendar.find(".heurigen-month.active");self.loadMonth=false;self.isMobile=isMobile;
/**
     * Constructor;
     */
(function(){self.$activeMonth.find("header .prev").live("click",function(){self.getPreviousMonth()});self.$activeMonth.find("header .next").live("click",function(){self.getNextMonth()});self.$activeMonth.find(".heurigen-month__body .heurigen-day a").live("click",function(){self.triggerGoogleEvent("Klick auf den "+$(this).text()+"-"+self.$activeMonth.data("month"))})})();self.getPreviousMonth=function(){var dataMonth=self.$activeMonth.data("month").split("-");var newMonth=(parseInt(dataMonth[0])-1).toString();if(newMonth<1){newMonth=12;dataMonth[1]=--dataMonth[1]}
// Google Analytics event tracking
eventText="wechsel zu Monat "+newMonth+"-"+dataMonth[1]+" von Monat "+self.$activeMonth.data("month");self.triggerGoogleEvent(eventText);if(!self.loadMonth){if(self.$calendar.find('.heurigen-month[data-month="'+newMonth+"-"+dataMonth[1]+'"]').length<1){self.loadMonth=true;self.$activeMonth.addClass("loading");$.ajax({type:"GET",url:"/_ajax/heurigenkalender/month/"+newMonth+"-"+dataMonth[1]+"/region/"+self.$calendar.attr("data-region"),dataType:"json",success:function(data,textStatus,jqXHR){self.$activeMonth.before($(data.success));self.$activeMonth.removeClass("active");self.$activeMonth.removeClass("loading");self.$activeMonth=self.$calendar.find(".heurigen-month.active");self.loadMonth=false},error:function(data,textStatus,jqXHR){console.log(data.error)}})}else{self.$activeMonth.removeClass("active");self.$activeMonth.removeClass("loading");self.$activeMonth=$('[data-month="'+newMonth+"-"+dataMonth[1]+'"]').addClass("active")}reloadOewa(OEWA)}};self.getNextMonth=function(){var dataMonth=self.$activeMonth.data("month").split("-");var newMonth=(parseInt(dataMonth[0])+1).toString();if(newMonth>12){newMonth=1;dataMonth[1]=++dataMonth[1]}
// Google Analytics event tracking
eventText="wechsel zu Monat "+newMonth+"-"+dataMonth[1]+" von Monat "+self.$activeMonth.data("month");self.triggerGoogleEvent(eventText);if(!self.loadMonth){if(self.$calendar.find('.heurigen-month[data-month="'+newMonth+"-"+dataMonth[1]+'"]').length<1){self.loadMonth=true;self.$activeMonth.addClass("loading");$.ajax({type:"GET",url:"/_ajax/heurigenkalender/month/"+newMonth+"-"+dataMonth[1]+"/region/"+self.$calendar.attr("data-region"),dataType:"json",success:function(data,textStatus,jqXHR){self.$activeMonth.after($(data.success));self.$activeMonth.removeClass("active");self.$activeMonth.removeClass("loading");self.$activeMonth=self.$calendar.find(".heurigen-month.active");self.loadMonth=false},error:function(data,textStatus,jqXHR){console.log(data.error)}})}else{self.$activeMonth.removeClass("active");self.$activeMonth.removeClass("loading");self.$activeMonth=$('[data-month="'+newMonth+"-"+dataMonth[1]+'"]').addClass("active")}reloadOewa(OEWA)}};self.triggerGoogleEvent=function(eventText){piGoogleAnalytics("Heurigenkalender",window.location.origin.concat(window.location.pathname),eventText,self.isMobile)}};var frontend=frontend||{};frontend.NewsletterConfig=function(){};frontend.NewsletterConfig.setup=function(uniqueId){$("#issue-select-"+uniqueId+" li:not(.selectRegion) input[type=checkbox]").each(function(){if($(this).prop("checked")){$path=$("#issue-map-"+uniqueId+" path."+$(this).data("issue"));pathClasses=$path.attr("class")+" selected";$path.attr("class",pathClasses.trim());$(this).parent().find("label").addClass("selected")}});$("#issue-select-"+uniqueId+" li:not(.selectRegion) input[type=checkbox]").on("click",function(){$path=$("#issue-map-"+uniqueId+" path."+$(this).data("issue"));if($(this).prop("checked")){pathClasses=$path.attr("class")+" selected";$path.attr("class",pathClasses.trim());$(this).parent().find("label").addClass("selected")}else{$path.attr("class",$path.attr("class").replace("selected","").trim());$(this).parent().find("label").removeClass("selected");if($(this).parent().parent().find(".selectRegion input[type=checkbox]").prop("checked")){$(this).parent().parent().find(".selectRegion input[type=checkbox]").prop("checked",false)}}});$("#issue-select-"+uniqueId+" li:not(.selectRegion)").on("mouseover",function(){$path=$("#issue-map-"+uniqueId+" path."+$(this).find("input").data("issue"));pathClasses=$path.attr("class")+" hover";$path.attr("class",pathClasses.trim());$(this).find("label").addClass("hover")});$("#issue-select-"+uniqueId+" li:not(.selectRegion)").on("mouseout",function(){$path=$("#issue-map-"+uniqueId+" path."+$(this).find("input").data("issue"));$path.attr("class",$path.attr("class").replace(" hover","").trim());$(this).find("label").removeClass("hover")});$("#issue-select-"+uniqueId+" li.selectRegion input[type=checkbox]").on("click",function(){var selectRegion=$(this).attr("checked")?true:false;$(this).parent().parent().find("li:not(.selectRegion) input[type=checkbox]").each(function(){$path=$("#issue-map-"+uniqueId+" path."+$(this).data("issue"));if(selectRegion){$(this).prop("checked",true);$(this).parent().find("label").addClass("selected");if($path.attr("class").indexOf("selected")===-1){pathClasses=$path.attr("class")+" selected";$path.attr("class",pathClasses.trim())}}else{$(this).prop("checked",false);$(this).parent().find("label").removeClass("selected");$path.attr("class",$path.attr("class").replace(" selected","").trim())}})});$("#issue-select-"+uniqueId+" li.selectRegion").on("mouseover",function(){$(this).parent().find("li:not(.selectRegion) input[type=checkbox]").each(function(){$path=$("#issue-map-"+uniqueId+" path."+$(this).data("issue"));pathClasses=$path.attr("class")+" hover";$(this).parent().find("label").addClass("hover");$path.attr("class",pathClasses.trim())})});$("#issue-select-"+uniqueId+" li.selectRegion").on("mouseout",function(){$(this).parent().find("li:not(.selectRegion) input[type=checkbox]").each(function(){$path=$("#issue-map-"+uniqueId+" path."+$(this).data("issue"));$(this).parent().find("label").removeClass("hover");$path.attr("class",$path.attr("class").replace(" hover","").trim())})});$("#issue-map-"+uniqueId+" path").on("click",function(){$issueCheckbox=$("#issue-select-"+uniqueId+" li input#"+$(this).data("newsletter"));if($issueCheckbox.prop("checked")){$issueCheckbox.prop("checked",false);$issueCheckbox.parent().find("label").removeClass("selected");$(this).attr("class",$(this).attr("class").replace("selected","").trim());if($issueCheckbox.parent().parent().find(".selectRegion input[type=checkbox]").prop("checked")){$issueCheckbox.parent().parent().find(".selectRegion input[type=checkbox]").prop("checked",false)}}else{$issueCheckbox.prop("checked",true);$issueCheckbox.parent().find("label").addClass("selected");pathClasses=$(this).attr("class")+" selected";$(this).attr("class",pathClasses.trim())}});$("#issue-map-"+uniqueId+" path").on("mouseover",function(){$issueCheckbox=$("#issue-select-"+uniqueId+" li input#"+$(this).data("newsletter"));if(!$issueCheckbox.prop("checked")){$issueCheckbox.parent().find("label").addClass("hover");pathClasses=$(this).attr("class")+" hover";$(this).attr("class",pathClasses.trim())}});$("#issue-map-"+uniqueId+" path").on("mouseout",function(){$issueCheckbox=$("#issue-select-"+uniqueId+" li input#"+$(this).data("newsletter"));if(!$issueCheckbox.prop("checked")){$issueCheckbox.parent().find("label").removeClass("hover");$(this).attr("class",$(this).attr("class").replace(" hover","").trim())}});$(".emailInput input[type=text]").on("blur",function(){if($(this).val()!==""){if(frontend.NewsletterConfig.emailValidation($(".emailInput input[type=text]").val())){$(this).parent().find(".icon").removeClass("icon-cancel-circled").addClass("icon-ok-circled")}else{$(this).parent().find(".icon").removeClass("icon-ok-circled").addClass("icon-cancel-circled")}}else{$(this).parent().find(".icon").addClass("icon-cancel-circled")}});$(".issuebox form").on("submit",function(){if($(".emailInput").length>0){if($(".emailInput input[type=text]").val()!==""){if(frontend.NewsletterConfig.emailValidation($(".emailInput input[type=text]").val())){return true}else{$(".emailInput .icon").addClass("icon-cancel-circled");return false}}else{$(".emailInput .icon").addClass("icon-cancel-circled");return false}}})};frontend.NewsletterConfig.emailValidation=function(email){var regex=/^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;return regex.test(email)};var frontend=frontend||{};frontend.Newsletter=function(){var self=this;self.userId=0;self.loadSessionXhr=null;self.updateUrlXhr=null;
/**
     * Constructor;
     */
(function(){
// we could do stuff here
})();self.getUserData=function(userData){if(self.loadSessionXhr!==null){
// do nothing if session request is active or if we already loaded the session
return}self.loadSessionXhr=$.ajax({type:"GET",url:"/_ajax/newsletter-contact-from-email/"+encodeURIComponent(userData.email),dataType:"json",xhrFields:{withCredentials:true},success:function(data,textStatus,jqXHR){if(typeof data!=="undefined"&&data!==false&&!data["message"]){$("#user-newsletter-link").attr("href","/newsletter-config/"+data["email"]);$("#newsletter-banner-link").attr("href","/newsletter-config/"+data["email"]);$("#newsletter-banner .newsletter-banner__link").attr("href","/newsletter-config/"+data["email"]);$("#ouibounce-modal-newsletter iframe").attr("src","/newsletter-config/embedded/"+data["email"])}else{$("#user-newsletter-link").attr("href","/newsletter-config/"+encodeURIComponent(userData.email));$("#newsletter-banner-link").attr("href","/newsletter-config/"+data["email"]);$("#newsletter-banner .newsletter-banner__link").attr("href","/newsletter-config/"+encodeURIComponent(userData.email));$("#ouibounce-modal-newsletter iframe").attr("src","/newsletter-config/embedded/"+encodeURIComponent(userData.email))}},error:function(jqXHR,textStatus,errorThrown){console.log(errorThrown)},complete:function(jqXHR,textStatus){self.loadSessionXhr=null}})}};var Newsletter;(function(){Newsletter=new frontend.Newsletter})();$(document).on(frontend.events.SESSION_LOADED,function(event,userData){if(userData.loggedIn){Newsletter.getUserData(userData)}});
/* LIVESEARCH */$(document).on(frontend.events.HEADER_LOADED,function(){$(".cancelsearch").click(function(){$("#livesearch").hide();$(".searchfield input:text").focus().attr("value","");$(this).hide();return false});$(".frontend-noen .searchfield").on("click",".showallresults",function(){submitSearch();return false});$(".frontend-noen #livesearch").on("mouseenter",function(){$(".frontend-noen #livesearch .focus").removeClass("focus")});$(".frontend-noen .searchfield input:text").on("blur",function(){if($(this).attr("value")==""){$(".cancelsearch").hide()}});$("#searchTerm").on("keyup",function(e){var keycode=e.keyCode;switch(e.keyCode){case 27:$("#livesearch").hide();$(".searchfield input:text").focus().attr("value","");$(".searchloader").hide();$(this).blur();return false;break;case 38:navigate("up");return false;break;case 40:navigate("down");return false;break;case 13:if($("#livesearch .jsLiveResult.focus").length>0){window.location=$("#livesearch .jsLiveResult.focus").children("a").attr("href")}else{submitSearch($(this).val())}return false;break;default:if(keycode>47&&keycode<58||keycode>=63&&keycode<91||keycode>95&&keycode<112){doLiveSearch($(this).val())}break}});$('.searchfield input[name="searchbutton"]').on("click",function(){submitSearch($("#searchTerm").val())})});for(var i=0;i<$(".liveresult").size();i++){$(".liveresult").eq(i).data("number",i);$("#livesearch > .livesearch").css("display","block")}function navigate(direction){if($("#livesearch .jsLiveResult.focus").length===0){currentSelection=-1}if(direction==="up"&&currentSelection!==-1){if(currentSelection!==0){currentSelection--}}else if(direction==="down"){if(currentSelection!==$("#livesearch .jsLiveResult:visible").size()-1){currentSelection++}}$("#livesearch .jsLiveResult:visible").removeClass("focus");$("#livesearch .jsLiveResult:visible").eq(currentSelection).addClass("focus")}function submitSearch(searchTerm){if(searchTerm.length>0){var url="/search/"+encodeURIComponent(searchTerm);window.location.href=url}return false}function resetSearch(){$("#jsAjaxLiveResultContent").hide();$("#jsAjaxLiveResultContent").html('<div class="category"></div><div class="channel-block content shown"><ul><li class="liveresult first"><div class="resultlink"><span>... Bitte warten</span></div></li></ul></div><div class="clear"></div>')}var searchEvalCount=0;var inProgressUntil=4;function evalSearchProgress(init){if(init){$(".cancelsearch").hide();$(".searchloader").hide()}else{searchEvalCount++;$(".searchloader").show();if(searchEvalCount>=inProgressUntil){$(".searchloader").hide();$(".cancelsearch").show();searchEvalCount=0}}}var livesearchHeight=0;function doLiveSearch(searchTerm){var pEl=$(".searchloadcontainer .searchloading");var running=pEl.css("width")!="0%";resetSearchHeight();if(running){pEl.stop();pEl.css("width","0%")}$("#livesearch").hide();if(searchTerm.length<2){return false}resetSearch();evalSearchProgress(true);pEl.animate({width:"100%"},700,function(){$(".searchloader").show();$("#livesearch").show();$("#jsAjaxLiveResultContent").show();$.ajax("/liveResult/content/"+searchTerm,{success:function(data,textStatus,jqXHR){$("#jsAjaxLiveResultContent").html(data);$("#jsAjaxLiveResultContent").show();$(document).one(noen.events.ADS_LOADED,calculateSearchHeight);evalSearchProgress();livesearchHeight=$("#livesearch > .jsLiveSearch").height();if($(".header").hasClass("stickyheader")){livesearchHeight-=10}calculateSearchHeight()},complete:function(){$(".searchloader").hide()}});pEl.css("width","0%")})}function calculateSearchHeight(){if($("#livesearch").length>0){if($("#livesearch").is(":hidden")){return}var offsetTop=$("#livesearch > .jsLiveSearch").offset().top;var newHeight=$(window).height()-offsetTop+$(window).scrollTop();if(newHeight<250){newHeight=250}if(newHeight-37>livesearchHeight){$("#livesearch > .jsLiveSearch").css("height","auto").removeClass("inner-scroll");$("#livesearch > .jsLiveSearch #jsAjaxLiveResultContent").css("height","auto")}else{$("#livesearch > .jsLiveSearch").css("height",newHeight).addClass("inner-scroll");$("#livesearch > .jsLiveSearch #jsAjaxLiveResultContent").css("height",newHeight-37)}}}function resetSearchHeight(){if($("#livesearch > .jsLiveSearch").hasClass("inner-scroll")){$("#livesearch > .jsLiveSearch").css("height","400px").removeClass("inner-scroll")}}$(window).resize(calculateSearchHeight);$(window).on("scroll",calculateSearchHeight);
/* END LIVESEARCH */
/* ADVANCEDSEARCH */var advancedSearchXhrs={};function doAdvancedSearch(term,from,till,channels,sort,page,success,error,always){var hash="search_"+term+"_"+from+"_"+till+"_"+channels.join("-")+"_"+sort+"_"+page;if($.type(advancedSearchXhrs[hash])==="object"){return}advancedSearchXhrs[hash]=$.ajax({type:"POST",url:"/advancedsearch",data:{term:term,from:from,till:till,channels:channels,sort:sort,page:page},dataType:"json",success:function(data,textStatus,jqXHR){if(data){data.jqXHR=jqXHR}if(data&&data.success){if($.type(success)==="function"){success(data)}}else if(data&&data.error){if($.type(error)==="function"){error(data)}}},error:function(jqXHR,textStatus,errorThrown){if($.type(error)==="function"){error({success:null,error:jqXHR.responseText,jqXHR:jqXHR})}},complete:function(jqXHR,textStatus){if($.type(always)==="function"){always({success:null,error:null,jqXHR:jqXHR})}advancedSearchXhrs=$.grep(advancedSearchXhrs,function(value){return value!==advancedSearchXhrs[hash]})}})}
/* END ADVANCEDSEARCH */
/*
 * functions for the management of searchable input fields that associate an
 * object (e.g. tags, geotags, users and stuff like that)
 */function doGenericSearchJSON(url,searchterm,$container,$excludeIds,type,queue){$.ajax({url:url+"/"+searchterm,dataType:"json",type:"get",xhrFields:{withCredentials:true},beforeSend:function(jqXHR){if(queue!==undefined&&Array.isArray(queue)){queue.push(jqXHR)}},success:function(data,textStatus,jqXHR){setupDropdownFromGenericSearch(data,$container,$excludeIds,type)},complete:function(jqXHR){if(queue!==undefined&&Array.isArray(queue)){var i=queue.indexOf(jqXHR);//  get index for current connection completed
if(i>-1)queue.splice(i,1);//  removes from list by index
}return false}})}function setupDropdownFromGenericSearch(result,$container,$excludeIds,type){$container.html("");$container.append("<ul></ul>");for(var i=0;i<Object.keys(result).length;i++){if(!$excludeIds.includes(result[Object.keys(result)[i]].id)){if(type==="author"){var listitem='<li data-id="'+result[Object.keys(result)[i]].id+'"><a href="#">'+result[Object.keys(result)[i]].name+" ("+result[Object.keys(result)[i]].email+")</a></li>"}else{var listitem='<li data-id="'+result[Object.keys(result)[i]].id+'"><a href="#">'+result[Object.keys(result)[i]].name+"</a></li>"}$container.find("ul").append(listitem)}}}function draggableSearch_createTag(item,classname,$container,$toAppend,$hidden){var itemName=$container.find('li[data-id="'+item+'"] a').text();$hidden.val($hidden.val()+($hidden.val().length>0?",":"")+item);$container.find("input").val("");$container.find(".edit_input_dropdown").html("");$toAppend.append('<span data-id="'+item+'" class="edit_input_tagged edit_input_tagged--'+classname+'">'+itemName+'<a href="#"></a></span>')}function draggableSearch_deleteTag($tag,$hidden){currentIds=$hidden.val();currentIds=currentIds.replace($tag.data("id")+",","");currentIds=currentIds.replace($tag.data("id"),"");$hidden.val(currentIds);$tag.remove()}
// https://tc39.github.io/ecma262/#sec-array.prototype.includes
if(!Array.prototype.includes){Object.defineProperty(Array.prototype,"includes",{value:function(searchElement,fromIndex){if(this==null){throw new TypeError('"this" is null or not defined')}
// 1. Let O be ? ToObject(this value).
var o=Object(this);
// 2. Let len be ? ToLength(? Get(O, "length")).
var len=o.length>>>0;
// 3. If len is 0, return false.
if(len===0){return false}
// 4. Let n be ? ToInteger(fromIndex).
//    (If fromIndex is undefined, this step produces the value 0.)
var n=fromIndex|0;
// 5. If n ≥ 0, then
//  a. Let k be n.
// 6. Else n < 0,
//  a. Let k be len + n.
//  b. If k < 0, let k be 0.
var k=Math.max(n>=0?n:len-Math.abs(n),0);function sameValueZero(x,y){return x===y||typeof x==="number"&&typeof y==="number"&&isNaN(x)&&isNaN(y)}
// 7. Repeat, while k < len
while(k<len){
// a. Let elementK be the result of ? Get(O, ! ToString(k)).
// b. If SameValueZero(searchElement, elementK) is true, return true.
if(sameValueZero(o[k],searchElement)){return true}
// c. Increase k by 1.
k++}
// 8. Return false
return false}})}var spunQ=spunQ||{};spunQ.FileUpload=function($buttonNode,options){
/**
     * reference to this.
     */
var self=this;
/**
     * multiUpload: true|false => wether it allows only 1 file or more to be uploaded
     * accept: string => mimeType of files that should be accepted [* = accept all] (e.g. image/*, image/jpeg, text/*, text/csv...)
     * sizeLimit: file size limit in bytes (0 = No Limit [Default])
     */var cfg=$.extend(true,{uploadUrl:"/fileupload",multiUpload:true,accept:"*",sizeLimit:0},options);var eventHandlers={startUploads:[],// triggered when upload starts
beforeUpload:[],// triggered before a file is uploaded
uploadSuccess:[],// triggered after a file is successfully uploaded
uploadError:[],// triggered when a file hits an error
uploadComplete:[]};
/**
     * Adds a Event handler for a given event.
     */self.on=function(event,handler){$.each(event.split(" "),function(i,val){if(typeof eventHandlers[val]==="undefined"){eventHandlers[val]=[]}eventHandlers[val].push(handler)});return self};
/**
     * Triggers a Event with given name + data.
     */var triggerEvent=function(event,data){returnValues=[];for(var i in eventHandlers[event]){var returnValue=eventHandlers[event][i](data);returnValues.push(returnValue)}return returnValues};var upload=function(files){triggerEvent("startUploads",files);fileFor:for(var x in files){file=files[x];if(typeof file!=="object")continue;var beforeUploads=triggerEvent("beforeUpload",file);for(r in beforeUploads){if(beforeUploads[r]===false){break fileFor}}var reader=new FileReader;reader.file=file;var imgWidth=0;reader.onload=function(file){if(cfg.accept.indexOf("image")!==-1){var image=new Image;image.src=file.target.result;image.onload=function(){imgWidth=this.width}}};reader.onloadend=function(ev){var fileReader=ev.currentTarget;var validationError=[];if(cfg.sizeLimit>0&&fileReader.file.size>cfg.sizeLimit){validationError.push("fileSizeTooBig")}else if(fileReader.file.size===0){validationError.push("fileSizeNoData")}else if(cfg.accept!=="*"){if(validateMimeType(cfg.accept.split(", "),fileReader.file.type)===false)validationError.push("unsupportedFileType")}if(validationError.length>0){for(var x in validationError){validationError=validationError[x];triggerEvent("uploadError",{error:validationError,file:file,name:fileReader.file.name})}return}$.ajax({url:cfg.uploadUrl,type:"POST",dataType:"json",xhr:function(){var uploadXhr=$.ajaxSettings.xhr();if(uploadXhr.upload){uploadXhr.upload.addEventListener("progress",function(e){if(e.lengthComputable){triggerEvent("uploadProgress",{name:fileReader.file.name,type:fileReader.file.type,size:fileReader.file.size,loaded:e.loaded,total:e.total,percent:parseInt(e.loaded/e.total*100)})}},false)}return uploadXhr},success:function(response,textStatus,jqXHR){triggerEvent("uploadSuccess",response)},error:function(jqXHR,textStatus,errorThrown){triggerEvent("uploadError",{jqXHR:jqXHR,name:fileReader.file.name,type:fileReader.file.type,size:fileReader.file.size})},complete:function(jqXHR,textStatus){if(cfg.accept.indexOf("image")!==-1){triggerEvent("uploadComplete",{jqXHR:jqXHR,name:fileReader.file.name,type:fileReader.file.type,size:fileReader.file.size,width:imgWidth})}else{triggerEvent("uploadComplete",{jqXHR:jqXHR,name:fileReader.file.name,type:fileReader.file.type,size:fileReader.file.size})}},data:{fileName:fileReader.file.name,fileType:fileReader.file.type,fileSize:fileReader.file.size,fileData:fileReader.result},cache:false})};reader.readAsDataURL(file);if(!cfg.multiUpload){break}}};
/*
     * initialize code for fileupload.
     */var $input=$('<input type="file" accept="'+cfg.accept+'" />').hide();if(cfg.multiUpload){$input.prop("multiple",true)}$buttonNode.after($input);$buttonNode.on("drop",function(e){e.stopPropagation();e.preventDefault();upload(e.target.files||e.originalEvent.originalTarget.files)}).on("dragenter",function(e){e.stopPropagation();e.preventDefault()}).on("dragleave",function(e){e.stopPropagation();e.preventDefault()}).on("dragover",function(e){e.stopPropagation();e.preventDefault()}).on("click",function(e){e.stopPropagation();e.preventDefault();$input.trigger("click")});$input.on("change",function(e){e.stopPropagation();e.preventDefault();upload(e.target.files||e.originalEvent.originalTarget.files)})};
/**
 * Validate MimeType
 * @param   {Array}         accepted    Array of Accepted MimeTypes
 * @param   {String}    filetype    MimeType of Uploaded File
 * @returns {Boolean}               True = Accepted
 */function validateMimeType(accepted,filetype){for(var x in accepted){accept=accepted[x];if(accept.indexOf("/*")===-1){if(accept===filetype){return true}}else if(accept.indexOf("/*")>=0){if(accept===filetype.substring(0,filetype.indexOf("/"))+"/*"){return true}}}return false}var noen=noen||{};
/**
 * The Sub Navigation.
 * @param element the form node surrounding the questionnaire form.
 * @param isBox boolean determining if its a ContentBox or in article.
 */noen.Questionnaire=function(element,isBox){var self=this;
/**
     * The form node we use as reference.
     */var node=$(element);
/**
     * We save this object in the form node.
     */node.data("questionnaire",self);
/**
     * Shows a message of a given type.
     * @param message the message to show.
     * @param type the type of the message, either 'error' or 'info'
     * @return void
     */self.showMessage=function(message,type){
// for now we dont need the type, maybe we need to add it for styling
node.find(".jsQuestionnaireChoices").removeClass("loading").html(message);node.find(".jsQuestionnaireButtons .buttonsmall").hide()};
/**
     * Shows a result given by a json.
     * @param json Json representing a result.
     * @return void
     */self.showResult=function(json){if(isBox){var list=$("<ul></ul>");if(typeof json.questions!=="undefined"){list.append($("<li>"+json.completeUserCount+" Mitspieler.</li>"));list.append($("<li>Du hast "+json.correctAnswerRatio+"% richtig.</li>"));list.append($("<li>Mehr erfährst du auf der Quizseite.</li>"))}else{var questionId=Object.keys(json)[0];var isAdminView=node.data("questionnaire-adminview")===1;
// show the result
for(var i in json){if(json.length>1){node.find(".questionText").text("");list.append("<li>"+json[i].text+"<span>"+json[i].count+"</span></li>")}else{node.find(".questionText").html(json[i].text+"<span>"+json[i].count+"</span>")}if($.map(json[i].choices,function(n,i){return i}).length>3){list.append($('<li><span class="resulttext">Danke für Deine Stimme!</span></li>'));list.append($('<li><span class="resulttext">Das Ergebnis erfährst Du auf der Umfrageseite.</span></li>'))}else{for(var j in json[i].choices){var choice=json[i].choices[j];if(json[i].hidePercent){list.append($('<li><p class="resulttext">'+choice.text+'</p><p class="resultcontainer"><span class="bar" style="width:'+choice.percentage+'%" '+(isAdminView?'data-count="'+choice.count+'"':'data-count="0"')+"></span></p></li>"))}else{list.append($('<li><p class="resulttext">'+choice.text+'</p><p class="resultcontainer"><span class="bar" style="width:'+choice.percentage+'%" '+(isAdminView?'data-count="'+choice.count+'"':'data-count="0"')+'></span><span class="percent">'+choice.percentage+"%</span></p></li>"))}}}}}node.find(".jsQuestionnaireChoices").replaceWith($('<div class="jsQuestionnaireChoices" />').append(list));node.find(".jsQuestionnaireButtons .buttonsmall").hide()}else{var list=$("<ul></ul>");if(typeof json.questions!=="undefined"){node.find(".jsQuestionnaireText").text("");
// quiz
node.find(".jsQuestionnaireChoices").removeClass("loading");node.find(".questioncount").empty().append($('<span class="openbold">Auflösung</span>'));var container=node.find(".questioncontainer");container.empty();var isQuizSession=typeof json.correctAnswerCountOverall!=="undefined";var statusText="Du bist auf einem guten Weg. Du hast "+json.correctAnswerRatio+" Prozent der Fragen richtig beantwortet. Versuch es noch einmal!";if(!isQuizSession){if(json.correctAnswerRatio>79){statusText="Super! Du hast "+json.correctAnswerRatio+" Prozent der Fragen richtig beantwortet."}else if(json.correctAnswerRatio<40){statusText="Das war wohl nichts. Du hast nur "+json.correctAnswerRatio+" Prozent der Fragen richtig beantwortet. Versuch es noch einmal!"}container.prepend($('<span class="blockcontent conclusion-text">'+statusText+"</span>"))}else{if(json.correctAnswerCount===6){statusText='<span class="conclusion-text__headline">Von Unterradlberg bis Ochsenburg, von Völtendorf bis Zwerndorf...</span>... du kennst jede Ecke und hast 6 von 6 Fragen richtig beantwortet!'}else if(json.correctAnswerCount>3){statusText='<span class="conclusion-text__headline">Auf dem Weg zur Spitze des <s>Olymps</s> Klangturms!</span>Du hast '+json.correctAnswerCount+" von "+(json.correctAnswerCount+json.wrongAnswerCount)+" Fragen richtig beantwortet. Weiter so!"}else if(json.correctAnswerCount===3){statusText='<span class="conclusion-text__headline">In dir steckt doch noch mehr St. Pölten, oder?</span>Du hast '+json.correctAnswerCount+" von "+(json.correctAnswerCount+json.wrongAnswerCount)+" Fragen richtig. Probier's gleich nochmal!"}else if(json.correctAnswerCount>=1){statusText='<span class="conclusion-text__headline">Da muss noch viel Wasser die Traisen hinunter fließen...</span>Du hast '+json.correctAnswerCount+" von "+(json.correctAnswerCount+json.wrongAnswerCount)+" Fragen richtig beantwortet. Probier's gleich nochmal!"}else{statusText='<span class="conclusion-text__headline">Hast du denn schon mal von St. Pölten gehört?</span>Du hast leider keine Frage richtig. Probier\'s gleich nochmal!'}container.append($('<span class="blockcontent conclusion-text">'+statusText+"</span>"));container.append($('<h4 class="jsQuestionnaireText">Dein bisheriges Ergebnis</h4>'));container.append($('<span class="blockcontent conclusion-game-info"><span>'+json.timesPlayedCurrentQuestionnaire+"</span> Spiele</span>"));container.append($('<span class="blockcontent conclusion-game-info"><span>'+json.correctAnswerCountOverall+"</span> richtige Antworten</span>"));container.append($('<span class="blockcontent conclusion-game-info"><span>'+json.wrongAnswerCountOverall+"</span> falsche Antworten</span>"));container.append($('<h4 class="jsQuestionnaireText">Schon gewusst?</h4>'));container.append($('<span class="blockcontent conclusion-text">Die besten Quiz-Profis haben im Herbst die Möglichkeit gegen den St. Pöltner Bürgermeister anzutreten und tolle Preise zu gewinnen! Also versuche es gleich nochmal!</span>'))}var list=$("<ul></ul>");var questionIndex=1;for(var i in json.questions){var listitem=$('<li class="question"><span class="open9 blockletters questioncount">Frage '+questionIndex+++"</span></li>");listitem.append($('<h3 class="jsQuestionnaireText questionnaire-question">'+json.questions[i].text+"</h3>"));if(typeof json.questions[i].imageUrl!=="undefined"){listitem.append($('<img src="'+json.questions[i].imageUrl+'" alt="'+json.questions[i].text+'" /><span class="open12">'+json.questions[i].imageDescription+"</span>"))}var choices=$('<ul class="withimg"></ul>');for(var j in json.questions[i].choices){var cssClass="";var conclusion="";if(json.questions[i].choices[j].userAnswer&&json.questions[i].choices[j].correctAnswer){cssClass="green";conclusion="richtig"}else if(json.questions[i].choices[j].correctAnswer){cssClass="green";conclusion=""}else if(json.questions[i].choices[j].userAnswer&&!json.questions[i].choices[j].correctAnswer){cssClass="red";conclusion="falsch"}var choiceElement=$('<label for="choice-'+j+'" class="'+cssClass+'"></label>');var isActive=false;if(json.questions[i].choices[j].userAnswer){choiceElement.append($('<input name="choices['+i+'][]" type="radio" disabled checked id="choice-'+j+'">'));isActive=true}else{choiceElement.append($('<input name="choices['+i+'][]" type="radio" disabled id="choice-'+j+'">'))}if(json.questions[i].choices[j].relatedContent){for(var k in json.questions[i].choices[j].relatedContent){var text=json.questions[i].choices[j].text;var imageUrl=json.questions[i].choices[j].relatedContent[k].imageUrl;if(!imageUrl){continue}choiceElement.append($('<span class="answer"><img src="'+imageUrl+'" height="80" alt="'+text+'"/></span>'));if(conclusion!==""){choiceElement.append($('<span class="conclusion open9 blockletters">'+conclusion+"</span>"))}break}}else{choiceElement.append($('<span class="answer">'+json.questions[i].choices[j].text+"</span>"));if(conclusion!==""){choiceElement.append($('<span class="conclusion open9 blockletters">'+conclusion+"</span>"))}}choiceElement.append($('<div class="clear"></div>'));if(isActive){choices.append($('<li class="active"></li>').append(choiceElement))}else{choices.append($("<li></li>").append(choiceElement))}}listitem.append(choices);list.append(listitem)}container.append(list);$(".type_buzzquiz div.questionnaireContainer").addClass("hide");$(".type_buzzquiz hgroup, .type_buzzquiz figure").removeClass("hide")}else if(typeof json.resultcategorytext!=="undefined"){node.find(".questionnaireResultText").removeClass("hide");if(typeof json.imageUrl!=="undefined"){$(".type_buzzquiz .inner figure img").attr("src",json.imageUrl).css({display:"block",margin:"10px 0"});$(".type_buzzquiz .inner figure").addClass("relative");$(".type_buzzquiz .inner figure").append('<span class="buzzfeed-img-copyright">'+json.imageCopyright+"</span>");$(".type_buzzquiz .inner figure").removeClass("hide")}$(".type_buzzquiz hgroup h1").text(json.title);$(".type_buzzquiz hgroup .textsection").html(json.resultcategorytext);$(".type_buzzquiz div.questionnaireContainer").addClass("hide");$(".type_buzzquiz hgroup").removeClass("hide");if(typeof json.color!=="undefined"){$(".quizcontainer").css("background-color",json.color)}}else{
// poll
node.find(".jsQuestionnaireChoices").removeClass("loading");var questionId=Object.keys(json)[0];var isAdminView=node.data("questionnaire-adminview")===1;for(var i in json){if(json.length>1){node.find(".questionText").text("");list.append("<li>"+json[i].text+"<span>"+json[i].count+"</span></li>")}else{node.find(".questionText").html(json[i].text+"<span>"+json[i].count+"</span>")}for(var j in json[i].choices){var choice=json[i].choices[j];if(json[i].hidePercent){list.append($('<li><p class="resulttext">'+choice.text+'</p><p class="resultcontainer"><span class="bar" style="width:'+Math.round(choice.percentage)+'%;" '+(isAdminView?'data-count="'+choice.count+'"':'data-count="0"')+"></span></p></li>"))}else{list.append($('<li><p class="resulttext">'+choice.text+'</p><p class="resultcontainer"><span class="bar" style="width:'+Math.round(choice.percentage)+'%;" '+(isAdminView?'data-count="'+choice.count+'"':'data-count="0"')+'></span><span class="percent">'+choice.percentage+"%</span></p></li>"))}}}}node.find(".jsQuestionnaireChoices").addClass("results").empty().append(list);node.find(".jsQuestionnaireButtons .buttonsmall").hide()}};
/**
     * Shows a question given by a json.
     * @param json Json representing a question.
     * @return void
     */self.showQuestion=function(json){var list=$("<ul></ul>");node.attr("action",json.action);$userReference=node.find("input[name=userReference]");if($userReference.length===0){$userReference=$('<input type="hidden" name="userReference" value="'+json.userReference+'">')}node.append($userReference);if(isBox){node.find(".questionText").html(json.text);for(var i in json.choices){var label=$('<label for="choice-'+i+'"></label>');label.append($('<input name="choice[]" type="radio" value="'+i+'" id="choice-'+i+'">'));label.append($('<span class="blockcontent">'+json.choices[i].text+'</span><span class="clear"></span>'));list.append($("<li></li>").append(label))}}else{
// new question
node.find(".jsQuestionnaireText").html(json.text);node.find(".buzzfeed-question-sub-text").removeClass("hide");node.find('[name="currentQuestionIndex"]').val(json.index);node.find(".jsQuestionIndex").text(json.index+1);node.find(".bullets .bullet").removeClass("active").eq(json.index).addClass("active");if(typeof json.imageUrl!=="undefined"){node.find(".questionImageContainer .questionImage").attr({src:json.imageUrl,alt:json.text,style:""}).removeClass("hide");node.find(".buzzfeed-textimage-text.jsQuestionnaireText").text(json.text.substr(0,80));node.find(".buzzfeed-img-copyright").removeClass("hide");node.find(".questionImageContainer .questionImageCaption").text(json.imageDescription);if(typeof json.questionnaire!=="undefined"&&typeof json.imageCopyright!=="undefined"&&json.imageCopyright!=null){if(typeof json.questionnaire.type!=="undefined"&&json.questionnaire.type===5){node.find(".buzzfeed-textimage .buzzfeed-img-copyright").text(json.imageCopyright)}if(typeof json.imageDescription.length!=="undefined"&&json.imageDescription.length!==0){node.find(".questionImageContainer .questionImageCopyright").text(" - "+json.imageCopyright)}else{node.find(".questionImageContainer .questionImageCopyright").text(json.imageCopyright)}}if(typeof json.imageCopyrightUri!=="undefined"&&json.imageCopyrightUri!=null){if(json.imageCopyright.length!==0){node.find(".questionImageContainer .questionImageCopyrightUri").text(" - "+json.imageCopyrightUri)}else{node.find(".questionImageContainer .questionImageCopyrightUri").text(json.imageCopyrightUri)}}}else{node.find(".buzzfeed-question-sub-text").addClass("hide");node.find(".buzzfeed-img-copyright").addClass("hide");node.find(".questionImageContainer .questionImage").addClass("hide")}if(typeof json.type!=="undefined"&&json.type==6){var choices=Object.values(json.choices);
// Randomize Choices
for(let i=choices.length-1;i>0;i--){const j=Math.floor(Math.random()*(i+1));[choices[i],choices[j]]=[choices[j],choices[i]]}for(var i in choices){var labelContent;if(choices[i].relatedContent){for(var j in choices[i].relatedContent){if(json.questionnaire.type===5){labelContent='<span class="answer down">'+choices[i].text+"</span>";labelContent+='<img src="'+choices[i].relatedContent[j].imageUrl+'" width="195" height="137" alt="'+choices[i].text+'" /><span class="buzzfeed-img-copyright">'+choices[i].relatedContent[j].imageCopyright+"</span>"}else if(json.questionnaire.styleSheet){labelContent='<img src="'+choices[i].relatedContent[j].imageUrl+'" width="195" height="137" alt="'+choices[i].text+'" />'}else{labelContent='<img src="'+choices[i].relatedContent[j].imageUrl+'" height="80" alt="'+choices[i].text+'" />'}break}}else{labelContent=choices[i].text}var label=$('<label for="choice-'+choices[i].id+'"></label>');label.append($('<input name="choice[]" type="radio" value="'+choices[i].id+'" id="choice-'+choices[i].id+'">'));label.append($('<span class="answer">'+labelContent+'</span><span class="clear"></span>'));list.append($("<li></li>").append(label))}}else{for(var i in json.choices){var labelContent;if(json.choices[i].relatedContent){for(var j in json.choices[i].relatedContent){if(json.questionnaire.type===5){labelContent='<span class="answer down">'+json.choices[i].text+"</span>";labelContent+='<img src="'+json.choices[i].relatedContent[j].imageUrl+'" width="195" height="137" alt="'+json.choices[i].text+'" /><span class="buzzfeed-img-copyright">'+json.choices[i].relatedContent[j].imageCopyright+"</span>"}else if(json.questionnaire.styleSheet){labelContent='<img src="'+json.choices[i].relatedContent[j].imageUrl+'" width="195" height="137" alt="'+json.choices[i].text+'" />'}else{labelContent='<img src="'+json.choices[i].relatedContent[j].imageUrl+'" height="80" alt="'+json.choices[i].text+'" />'}break}}else{labelContent=json.choices[i].text}var label=$('<label for="choice-'+i+'"></label>');label.append($('<input name="choice[]" type="radio" value="'+i+'" id="choice-'+i+'">'));label.append($('<span class="answer">'+labelContent+'</span><span class="clear"></span>'));list.append($("<li></li>").append(label))}}if(typeof json.uploadAction!=="undefined"){var label=$('<iframe height="75" width="400" src="'+json.uploadAction+'" border="0" frameborder="0" allowTransparency="true"></iframe>');list.append($("<li></li>").append(label))}if(json.freeTextAllowed){var label=$('<label for="question-'+json.id+'-freechoice"></label>');label.append($('<input name="choice[]" type="text" id="question-'+json.id+'-freechoice">'));list.append($("<li></li>").append(label))}}list=$('<span class="questions-list"></span>').append(list);node.find(".jsQuestionnaireChoices").replaceWith($('<div class="jsQuestionnaireChoices" />').append(list));var inputs=node.find("input");self.buttonControl(inputs);node.find(".jsQuestionnaireButtons").addClass("buttonsmall-inactive")};self.buttonControl=function(inputs){node.find(".jsQuestionnaireButtons").show();if(inputs.length==0){var txtArea=node.find("textarea");var upload_iFrame=node.find("iframe");if(txtArea){for(var i=0,len=txtArea.length;i<len;i++){$(txtArea[i]).bind("keydown",function(){node.find(".jsQuestionnaireButtons").removeClass("buttonsmall-inactive");$(this).unbind("keydown")})}}if(upload_iFrame){node.find(".jsQuestionnaireButtons").removeClass("buttonsmall-inactive")}}else{for(var i=0,len=inputs.length;i<len;i++){var inputType=inputs[i].type;if(inputType=="radio"){$(inputs[i]).bind("change",function(){node.find(".jsQuestionnaireButtons").removeClass("buttonsmall-inactive");$(this).unbind("change")})}else if(inputType=="text"){$(inputs[i]).bind("keydown",function(){node.find(".jsQuestionnaireButtons").removeClass("buttonsmall-inactive");$(this).unbind("keydown")})}else{node.find(".jsQuestionnaireButtons").removeClass("buttonsmall-inactive")}}}if($(".type_buzzquiz div.questionnaireContainer")){node.find('input[type="radio"]').live("click",function(){$(this).closest(".jsQuestionnaireChoices").find("li").removeClass("active");$(this).closest("li").addClass("active");node.find('input[type="text"]').val("")});node.find('input[type="text"]').live("click",function(){$(this).closest(".jsQuestionnaireChoices").find("li").removeClass("active");$(this).closest("li").addClass("active");node.find("input[type=radio]:checked").attr("checked",false)})}};
/**
     * Constructor.
     */
(function(){var inputs=node.find("input");self.buttonControl(inputs);$(document).on(frontend.events.SESSION_LOADED,function(event,data){if(data&&!$.isEmptyObject(data)){node.find(".questionnaireContainer").removeClass("hide");node.find(".loginNotice").addClass("hide")}});
// timing Fallback
if(typeof User!=="undefined"&&User.loggedIn==true){node.find(".questionnaireContainer").removeClass("hide");node.find(".loginNotice").addClass("hide")}node.find("a.login").on("click",function(evt){var $login=$(".topmenus .minimenu .symbol.login");if($login){$login.click()}return false});node.find(".submitButton").on("click",function(){
//check if one radio button is checked
var input=node.find("input");var checked=false;if(input.length==0){var txtArea=node.find("textarea");if(txtArea){for(var i=0,len=txtArea.length;i<len;i++){if(txtArea[0].value!=""){checked=true;break}}}}else{for(var i=0,len=input.length;i<len;i++){if(input[i].type=="radio"){if(input[i].checked==true){checked=true;break}}else if(input[i].type=="text"){if(input[i].value!=""){checked=true;break}}else if(input[i].type=="file"){if(input[i].value!=""){checked=true;break}}}}if(!checked||$(this).hasClass("privacy-not-confirmed")){return false}node.find(".jsQuestionnaireButtons").hide();node.find(".jsQuestionnaireButtons").addClass("buttonsmall-inactive");
// so we can be sure that its a json object.
var url=node.attr("action");var data=node.serialize();var choices=node.find(".jsQuestionnaireChoices .questions-list").html();if(data.length==0){return false}node.find(".jsQuestionnaireChoices").addClass("loading").html("");if(typeof OEWA!=="undefined"){reloadOewa(OEWA)}if(node.data("newsletter")){url=url+"/newsletter/"+node.data("newsletter")}$.ajax({url:url,type:"POST",data:data,dataType:"JSON",success:function(data,textStatus,jqXHR){if(typeof data.recaptcha!=="undefined"){self.showMessage(data.recaptcha.message,"recaptcha");node.find(".jsQuestionnaireChoices").html('<span class="questions-list">'+choices.replace('class="active"',"")+"</span>"+'<span class="recaptcha-error">'+node.find(".jsQuestionnaireChoices").html()+"</span>");node.find(".jsQuestionnaireButtons").show();node.find(".jsQuestionnaireButtons").removeClass("buttonsmall-inactive")}else if(typeof data.error!=="undefined"){self.showMessage(data.error.message,"error");node.find(".privacy").hide();node.find(".newsletter").hide()}else if(typeof data.message!=="undefined"){self.showMessage(data.message,"info");node.find(".recaptcha").hide();node.find(".privacy").hide();node.find(".newsletter").hide()}else if(typeof data.result!=="undefined"){self.showResult(data.result);node.find(".recaptcha").hide();node.find(".privacy").hide();node.find(".newsletter").hide()}else if(typeof data.question!=="undefined"){self.showQuestion(data.question)}}});return false});node.find(".freeTextChoice").keypress(function(event){if(event.which===13){node.find(".submitButton").focus().click();return false}});
// show result if user already voted
if(node.data("questionnaire-type")=="1"&&(node.data("questionnaire-isrunning")=="0"||$.cookie("questionnaire:"+node.data("questionnaire-id")+"-question:"+node.data("firstquestion-id"))!==null)){
// only for poll
node.find(".jsQuestionnaireButtons").hide();var url=node.data("result-url");$.ajax({url:url,type:"GET",dataType:"JSON",success:function(data,textStatus,jqXHR){if(typeof data.error!=="undefined"){self.showMessage(data.error.message,"error")}else if(typeof data.message!=="undefined"){self.showMessage(data.message,"info")}else if(typeof data.result!=="undefined"){self.showResult(data.result)}node.find(".recaptcha").hide();node.find(".privacy").hide();node.find(".newsletter").hide()}})}})()};
