/*
 RequireJS 0.23.0 Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.
 Available via the MIT or new BSD license.
 see: http://github.com/jrburke/requirejs for details
 RequireJS i18n Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.
 Available via the MIT or new BSD license.
 see: http://github.com/jrburke/requirejs for details
 RequireJS text Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.
 Available via the MIT or new BSD license.
 see: http://github.com/jrburke/requirejs for details
 RequireJS order Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.
 Available via the MIT or new BSD license.
 see: http://github.com/jrburke/requirejs for details

 jQuery JavaScript Library v1.4.4
 http://jquery.com/

 Copyright 2010, John Resig
 Dual licensed under the MIT or GPL Version 2 licenses.
 http://jquery.org/license

 Includes Sizzle.js
 http://sizzlejs.com/
 Copyright 2010, The Dojo Foundation
 Released under the MIT, BSD, and GPL Licenses.

 Date: Thu Nov 11 19:04:53 2010 -0500
*/
var require,define;
(function(){function Q(y){return ma.call(y)==="[object Function]"}function B(y){return ma.call(y)==="[object Array]"}function Aa(y,E,K){for(var M in E)if(!(M in w)&&(!(M in y)||K))y[M]=E[M];return F}function aa(y,E,K){var M,ba,T;for(M=0;T=E[M];M++){T=typeof T==="string"?{name:T}:T;ba=T.location;if(K&&(!ba||ba.indexOf("/")!==0&&ba.indexOf(":")===-1))ba=K+"/"+(ba||T.name);y[T.name]={name:T.name,location:ba||T.name,lib:T.lib||"lib",main:(T.main||"lib/main").replace(W,"").replace(ia,"")}}}function L(y){function E(k){var n,
r;for(n=0;r=k[n];n++)if(r==="."){k.splice(n,1);n-=1}else if(r==="..")if(n===1&&(k[2]===".."||k[0]===".."))break;else if(n>0){k.splice(n-1,2);n-=2}}function K(k,n){var r;if(k.charAt(0)===".")if(n){if(na.pkgs[n])n=[n];else{n=n.split("/");n=n.slice(0,n.length-1)}k=n.concat(k.split("/"));E(k);r=na.pkgs[n=k[0]];k=k.join("/");if(r&&k===n+"/"+r.main)k=n}return k}function M(k,n){var r=k?k.indexOf("!"):-1,x=null,G=n?n.name:null,S=k,ca,R;if(r!==-1){x=k.substring(0,r);k=k.substring(r+1,k.length)}if(x){x=K(x,
G);x=mb[x]||x}if(k){if(x)ca=(r=ea[x])?r.normalize?r.normalize(k,function(oa){return K(oa,G)}):K(k,G):"__$p"+G+"@"+k;else ca=K(k,G);R=Za[ca];if(!R){R=F.toModuleUrl?F.toModuleUrl(J,k,n):J.nameToUrl(k,null,n);Za[ca]=R}}return{prefix:x,name:ca,parentMap:n,url:R,originalName:S,fullName:x?x+"!"+ca:ca}}function ba(){var k=true,n=na.priorityWait,r,x;if(n){for(x=0;r=n[x];x++)if(!ta[r]){k=false;break}k&&delete na.priorityWait}return k}function T(k){return function(n){k.exports=n}}function Va(k,n,r){return function(){var x=
[].concat(pa.call(arguments,0)),G;if(r&&Q(G=x[x.length-1]))G.__requireJsBuild=true;x.push(n);return k.apply(null,x)}}function eb(k,n){n=Va(J.require,k,n);Aa(n,{nameToUrl:Va(J.nameToUrl,k),toUrl:Va(J.toUrl,k),isDefined:Va(J.isDefined,k),ready:F.ready,isBrowser:F.isBrowser});if(F.paths)n.paths=F.paths;return n}function nb(k){var n,r,x,G,S,ca,R,oa=Ha[k];if(oa)for(G=0;r=oa[G];G++){n=r.fullName;r=M(r.originalName,r.parentMap);r=r.fullName;x=sa[n];S=sa[r];if(r!==n){if(n in Ca){delete Ca[n];Ca[r]=true}sa[r]=
S?S.concat(x):x;delete sa[n];for(S=0;S<x.length;S++){R=x[S].depArray;for(ca=0;ca<R.length;ca++)if(R[ca]===n)R[ca]=r}}}delete Ha[k]}function fb(k){var n=k.prefix,r=k.fullName;if(!(Ca[r]||r in ea)){if(n&&!Ma[n]){Ma[n]=undefined;(Ha[n]||(Ha[n]=[])).push(k);(sa[n]||(sa[n]=[])).push({onDep:function(x){x===n&&nb(n)}});fb(M(n))}J.paused.push(k)}}function $a(k){var n,r,x;n=k.callback;var G=k.fullName;x=[];var S=k.depArray;if(n&&Q(n)){if(S)for(n=0;n<S.length;n++)x.push(k.deps[S[n]]);r=F.execCb(G,k.callback,
x);if(G)if(k.usingExports&&r===undefined&&(!k.cjsModule||!("exports"in k.cjsModule)))r=ea[G];else if(k.cjsModule&&"exports"in k.cjsModule)r=ea[G]=k.cjsModule.exports;else{if(G in ea&&!k.usingExports)return F.onError(new Error(G+" has already been defined"));ea[G]=r}}else if(G)r=ea[G]=n;if(G)if(x=sa[G]){for(n=0;n<x.length;n++)x[n].onDep(G,r);delete sa[G]}if(Fa[k.waitId]){delete Fa[k.waitId];k.isDone=true;J.waitCount-=1;if(J.waitCount===0)ab=[]}}function gb(k,n,r,x){k=M(k,x);var G=k.name,S=k.fullName,
ca={},R={waitId:G||Ia+ob++,depCount:0,depMax:0,prefix:k.prefix,name:G,fullName:S,deps:{},depArray:n,callback:r,onDep:function(hb,pb){if(!(hb in R.deps)){R.deps[hb]=pb;R.depCount+=1;R.depCount===R.depMax&&$a(R)}}},oa,la;if(S){if(S in ea||ta[S]===true)return;Ca[S]=true;ta[S]=true;J.jQueryDef=S==="jquery"}for(r=0;r<n.length;r++)if(oa=n[r]){oa=M(oa,G?k:x);la=oa.fullName;n[r]=la;if(la==="require")R.deps[la]=eb(k);else if(la==="exports"){R.deps[la]=ea[S]={};R.usingExports=true}else if(la==="module"){R.cjsModule=
oa=R.deps[la]={id:G,uri:G?J.nameToUrl(G,null,x):undefined};oa.setExports=T(oa)}else if(la in ea&&!(la in Fa))R.deps[la]=ea[la];else if(!ca[la]){R.depMax+=1;fb(oa);(sa[la]||(sa[la]=[])).push(R);ca[la]=true}}if(R.depCount===R.depMax)$a(R);else{Fa[R.waitId]=R;ab.push(R);J.waitCount+=1}}function Na(k){gb.apply(null,k);ta[k[0]]=true}function Pa(k){if(!J.jQuery)if((k=k||(typeof jQuery!=="undefined"?jQuery:null))&&"readyWait"in k){J.jQuery=k;Na(["jquery",[],function(){return jQuery}]);if(J.scriptCount){k.readyWait+=
1;J.jQueryIncremented=true}}}function bb(k,n){if(!k.isDone){var r=k.fullName,x=k.depArray,G,S;if(r){if(n[r])return ea[r];n[r]=true}for(S=0;S<x.length;S++)(G=x[S])&&!k.deps[G]&&Fa[G]&&k.onDep(G,bb(Fa[G],n));return r?ea[r]:undefined}}function Wa(){var k=na.waitSeconds*1E3,n=k&&J.startTime+k<(new Date).getTime();k="";var r=false,x=false,G;if(!(J.pausedCount>0)){if(na.priorityWait)if(ba())Ja();else return;for(G in ta)if(!(G in w)){r=true;if(!ta[G])if(n)k+=G+" ";else{x=true;break}}if(r||J.waitCount){if(n&&
k){G=new Error("require.js load timeout for modules: "+k);G.requireType="timeout";G.requireModules=k;return F.onError(G)}if(x||J.scriptCount){if(ja||qa)setTimeout(Wa,50)}else if(J.waitCount){for(Ka=0;k=ab[Ka];Ka++)bb(k,{});Wa()}else F.checkReadyState()}}}function ib(k,n){var r=n.name,x=n.fullName;if(!(x in ea||x in ta)){Ma[k]||(Ma[k]=ea[k]);ta[x]||(ta[x]=false);Ma[k].load(r,eb(n.parentMap,true),function(G){require.onPluginLoad&&require.onPluginLoad(J,k,r,G);$a({prefix:n.prefix,name:n.name,fullName:n.fullName,
callback:function(){return G}});ta[x]=true},na)}}function qb(k){if(k.prefix&&k.name.indexOf("__$p")===0&&ea[k.prefix])k=M(k.originalName,k.parentMap);var n=k.prefix,r=k.fullName;if(!(Ca[r]||r in ea)){Ca[r]=true;if(n)if(ea[n])ib(n,k);else{if(!Da[n]){Da[n]=[];(sa[n]||(sa[n]=[])).push({onDep:function(x){if(x===n){var G,S=Da[n];for(x=0;x<S.length;x++){G=S[x];ib(n,M(G.originalName,G.parentMap))}delete Da[n]}}})}Da[n].push(k)}else F.load(J,r,k.url)}}var J,Ja,na={waitSeconds:7,baseUrl:ha.baseUrl||"./",paths:{},
pkgs:{}},ka=[],Ca={require:true,exports:true,module:true},Za={},ea={},ta={},Fa={},ab=[],ob=0,sa={},Ma={},Da={},Xa=0,Ha={};Ja=function(){var k,n,r;Xa+=1;if(J.scriptCount<=0)J.scriptCount=0;for(;ka.length;){k=ka.shift();if(k[0]===null)return F.onError(new Error("Mismatched anonymous require.def modules"));else Na(k)}if(!(na.priorityWait&&!ba())){for(;J.paused.length;){r=J.paused;J.pausedCount+=r.length;J.paused=[];for(n=0;k=r[n];n++)qb(k);J.startTime=(new Date).getTime();J.pausedCount-=r.length}Xa===
1&&Wa();Xa-=1}};J={contextName:y,config:na,defQueue:ka,waiting:Fa,waitCount:0,specified:Ca,loaded:ta,urlMap:Za,scriptCount:0,urlFetched:{},defined:ea,paused:[],pausedCount:0,plugins:Ma,managerCallbacks:sa,makeModuleMap:M,normalize:K,configure:function(k){var n,r,x;if(k.baseUrl)if(k.baseUrl.charAt(k.baseUrl.length-1)!=="/")k.baseUrl+="/";n=na.paths;x=na.pkgs;Aa(na,k,true);if(k.paths){for(r in k.paths)r in w||(n[r]=k.paths[r]);na.paths=n}if((n=k.packagePaths)||k.packages){if(n)for(r in n)r in w||aa(x,
n[r],r);k.packages&&aa(x,k.packages);na.pkgs=x}if(k.priority){r=J.requireWait;J.requireWait=false;J.require(k.priority);Ja();J.requireWait=r;na.priorityWait=k.priority}if(k.deps||k.callback)J.require(k.deps||[],k.callback);k.ready&&F.ready(k.ready)},isDefined:function(k,n){return M(k,n).fullName in ea},require:function(k,n,r){if(typeof k==="string"){if(F.get)return F.get(J,k,n);r=n;n=M(k,r);k=ea[n.fullName];if(k===undefined)return F.onError(new Error("require: module name '"+n.fullName+"' has not been loaded yet for context: "+
y));return k}gb(null,k,n,r);if(!J.requireWait)for(;!J.scriptCount&&J.paused.length;)Ja()},takeGlobalQueue:function(){if(wa.length){Qa.apply(J.defQueue,[J.defQueue.length-1,0].concat(wa));wa=[]}},completeLoad:function(k){var n;for(J.takeGlobalQueue();ka.length;){n=ka.shift();if(n[0]===null){n[0]=k;break}else if(n[0]===k)break;else{Na(n);n=null}}n?Na(n):Na([k,[],k==="jquery"&&typeof jQuery!=="undefined"?function(){return jQuery}:null]);ta[k]=true;Pa();if(F.isAsync)J.scriptCount-=1;Ja();F.isAsync||(J.scriptCount-=
1)},toUrl:function(k,n){var r=k.lastIndexOf("."),x=null;if(r!==-1){x=k.substring(r,k.length);k=k.substring(0,r)}return J.nameToUrl(k,x,n)},nameToUrl:function(k,n,r){var x,G,S,ca,R=J.config;if(k.indexOf("./")===0||k.indexOf("../")===0){r=r&&r.url?r.url.split("/"):[];r.length&&r.pop();r=r.concat(k.split("/"));E(r);n=r.join("/")+(n?n:F.jsExtRegExp.test(k)?"":".js")}else{k=K(k,r);if(F.jsExtRegExp.test(k))n=k+(n?n:"");else{x=R.paths;G=R.pkgs;r=k.split("/");for(ca=r.length;ca>0;ca--){S=r.slice(0,ca).join("/");
if(x[S]){r.splice(0,ca,x[S]);break}else if(S=G[S]){k=k===S.name?S.location+"/"+S.main:S.location+"/"+S.lib;r.splice(0,ca,k);break}}n=r.join("/")+(n||".js");n=(n.charAt(0)==="/"||n.match(/^\w+:/)?"":R.baseUrl)+n}}return R.urlArgs?n+((n.indexOf("?")===-1?"?":"&")+R.urlArgs):n}};J.jQueryCheck=Pa;J.resume=Ja;return J}function X(){var y,E,K;if(Ra&&Ra.readyState==="interactive")return Ra;y=document.getElementsByTagName("script");for(E=y.length-1;E>-1&&(K=y[E]);E--)if(K.readyState==="interactive")return Ra=
K;return null}var N=/(\/\*([\s\S]*?)\*\/|\/\/(.*)$)/mg,U=/require\(["']([^'"\s]+)["']\)/g,W=/^\.\//,ia=/\.js$/,ma=Object.prototype.toString,Z=Array.prototype,pa=Z.slice,Qa=Z.splice,ja=!!(typeof window!=="undefined"&&navigator&&document),qa=!ja&&typeof importScripts!=="undefined",Ea=ja&&navigator.platform==="PLAYSTATION 3"?/^complete$/:/^(complete|loaded)$/,Ia="_r@@",w={},c={},wa=[],Ra=null,jb=false,Ya=false,mb={text:"require/text",i18n:"require/i18n",order:"require/order"},F;Z={};var cb,ha,Oa,Sa,
ua,La,Ta,Ka,db,kb,Ga;if(typeof require!=="undefined")if(Q(require))return;else Z=require;F=require=function(y,E,K){var M="_",ba;if(!B(y)&&typeof y!=="string"){ba=y;if(B(E)){y=E;E=K}else y=[]}if(ba&&ba.context)M=ba.context;K=c[M]||(c[M]=L(M));ba&&K.configure(ba);return K.require(y,E)};F.version="0.23.0";F.isArray=B;F.isFunction=Q;F.mixin=Aa;F.jsExtRegExp=/^\/|:|\?|\.js$/;ha=F.s={contexts:c,skipAsync:{},isPageLoaded:!ja,readyCalls:[]};if(F.isAsync=F.isBrowser=ja){Oa=ha.head=document.getElementsByTagName("head")[0];
if(Sa=document.getElementsByTagName("base")[0])Oa=ha.head=Sa.parentNode}F.onError=function(y){throw y;};F.load=function(y,E,K){var M=y.contextName,ba=y.urlFetched,T=y.loaded;jb=false;T[E]||(T[E]=false);if(!ba[K]){y.scriptCount+=1;F.attach(K,M,E);ba[K]=true;if(y.jQuery&&!y.jQueryIncremented){y.jQuery.readyWait+=1;y.jQueryIncremented=true}}};define=F.def=function(y,E,K){var M;if(typeof y!=="string"){K=E;E=y;y=null}if(!F.isArray(E)){K=E;E=[]}if(!y&&!E.length&&F.isFunction(K))if(K.length){K.toString().replace(N,
"").replace(U,function(ba,T){E.push(T)});E=["require","exports","module"].concat(E)}if(Ya){M=cb||X();if(!M)return F.onError(new Error("ERROR: No matching script interactive for "+K));y||(y=M.getAttribute("data-requiremodule"));M=c[M.getAttribute("data-requirecontext")]}(M?M.defQueue:wa).push([y,E,K])};define.amd={multiversion:true,plugins:true};F.execCb=function(y,E,K){return E.apply(null,K)};F.onScriptLoad=function(y){var E=y.currentTarget||y.srcElement,K;if(y.type==="load"||Ea.test(E.readyState)){Ra=
null;y=E.getAttribute("data-requirecontext");K=E.getAttribute("data-requiremodule");c[y].completeLoad(K);E.removeEventListener?E.removeEventListener("load",F.onScriptLoad,false):E.detachEvent("onreadystatechange",F.onScriptLoad)}};F.attach=function(y,E,K,M,ba){var T;if(ja){M=M||F.onScriptLoad;T=document.createElement("script");T.type=ba||"text/javascript";T.charset="utf-8";T.async=!ha.skipAsync[y];T.setAttribute("data-requirecontext",E);T.setAttribute("data-requiremodule",K);if(T.addEventListener)T.addEventListener("load",
M,false);else{Ya=true;T.attachEvent("onreadystatechange",M)}T.src=y;cb=T;Sa?Oa.insertBefore(T,Sa):Oa.appendChild(T);cb=null;return T}else if(qa){M=c[E];E=M.loaded;E[K]=false;importScripts(y);M.completeLoad(K)}return null};if(ja){ua=document.getElementsByTagName("script");for(Ka=ua.length-1;Ka>-1&&(La=ua[Ka]);Ka--){if(!Oa)Oa=La.parentNode;if(Ta=La.getAttribute("data-main")){if(!Z.baseUrl){ua=Ta.split("/");La=ua.pop();ua=ua.length?ua.join("/")+"/":"./";Z.baseUrl=ua;Ta=La.replace(ia,"")}Z.deps=Z.deps?
Z.deps.concat(Ta):[Ta];break}}}ha.baseUrl=Z.baseUrl;F.pageLoaded=function(){if(!ha.isPageLoaded){ha.isPageLoaded=true;db&&clearInterval(db);if(kb)document.readyState="complete";F.callReady()}};F.checkReadyState=function(){var y=ha.contexts,E;for(E in y)if(!(E in w))if(y[E].waitCount)return;ha.isDone=true;F.callReady()};F.callReady=function(){var y=ha.readyCalls,E,K,M;if(ha.isPageLoaded&&ha.isDone){if(y.length){ha.readyCalls=[];for(E=0;K=y[E];E++)K()}y=ha.contexts;for(M in y)if(!(M in w)){E=y[M];if(E.jQueryIncremented){E.jQuery.ready(true);
E.jQueryIncremented=false}}}};F.ready=function(y){ha.isPageLoaded&&ha.isDone?y():ha.readyCalls.push(y);return F};if(ja){if(document.addEventListener){document.addEventListener("DOMContentLoaded",F.pageLoaded,false);window.addEventListener("load",F.pageLoaded,false);if(!document.readyState){kb=true;document.readyState="loading"}}else if(window.attachEvent){window.attachEvent("onload",F.pageLoaded);if(self===self.top)db=setInterval(function(){try{if(document.body){document.documentElement.doScroll("left");
F.pageLoaded()}}catch(y){}},30)}document.readyState==="complete"&&F.pageLoaded()}F(Z);if(F.isAsync&&typeof setTimeout!=="undefined"){Ga=ha.contexts[Z.context||"_"];Ga.requireWait=true;setTimeout(function(){Ga.requireWait=false;Ga.takeGlobalQueue();Ga.jQueryCheck();Ga.scriptCount||Ga.resume();F.checkReadyState()},0)}})();
(function(){function Q(aa,L,X,N,U,W){if(L[aa]){X.push(aa);if(L[aa]===true||L[aa]===1)N.push(U+aa+"/"+W)}}function B(aa,L,X,N,U){L=N+L+"/"+U;require._fileExists(aa.nameToUrl(L,null))&&X.push(L)}var Aa=/(^.*(^|\/)nls(\/|$))([^\/]*)\/?([^\/]*)/;define("require/i18n",{load:function(aa,L,X,N){N=N||{};var U=Aa.exec(aa),W=U[1],ia=U[4],ma=U[5],Z=ia.split("-"),pa=[],Qa={},ja,qa,Ea="";if(U[5]){W=U[1];aa=W+ma}else{aa=aa;ma=U[4];ia=N.locale||(N.locale=typeof navigator==="undefined"?"root":(navigator.language||
navigator.userLanguage||"root").toLowerCase());Z=ia.split("-")}if(N.isBuild){pa.push(aa);B(L,"root",pa,W,ma);for(ja=0;qa=Z[ja];ja++){Ea+=(Ea?"-":"")+qa;B(L,Ea,pa,W,ma)}L(pa);X()}else L([aa],function(Ia){var w=[];Q("root",Ia,w,pa,W,ma);for(ja=0;qa=Z[ja];ja++){Ea+=(Ea?"-":"")+qa;Q(Ea,Ia,w,pa,W,ma)}L(pa,function(){var c,wa;for(c=w.length-1;c>-1&&(qa=w[c]);c--){wa=Ia[qa];if(wa===true||wa===1)wa=L(W+qa+"/"+ma);require.mixin(Qa,wa)}X(Qa)})})}})})();
(function(){var Q=["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.4.0"],B=/^\s*<\?xml(\s)+version=[\'\"](\d)*.(\d)*[\'\"](\s)*\?>/im,Aa=/<body[^>]*>\s*([\s\S]+)\s*<\/body>/im,aa=[];if(!require.textStrip)require.textStrip=function(L){if(L){L=L.replace(B,"");var X=L.match(Aa);if(X)L=X[1]}else L="";return L};if(!require.jsEscape)require.jsEscape=function(L){return L.replace(/(['\\])/g,"\\$1").replace(/[\f]/g,"\\f").replace(/[\b]/g,"\\b").replace(/[\n]/g,"\\n").replace(/[\t]/g,"\\t").replace(/[\r]/g,
"\\r")};if(!require.getXhr)require.getXhr=function(){var L,X,N;if(typeof XMLHttpRequest!=="undefined")return new XMLHttpRequest;else for(X=0;X<3;X++){N=Q[X];try{L=new ActiveXObject(N)}catch(U){}if(L){Q=[N];break}}if(!L)throw new Error("require.getXhr(): XMLHttpRequest not available");return L};if(!require.fetchText)require.fetchText=function(L,X){var N=require.getXhr();N.open("GET",L,true);N.onreadystatechange=function(){N.readyState===4&&X(N.responseText)};N.send(null)};define("require/text",["require",
"exports","module"],function(){return{load:function(L,X,N,U){var W=false,ia=L.indexOf("."),ma=L.substring(0,ia),Z=L.substring(ia+1,L.length);ia=Z.indexOf("!");if(ia!==-1){W=Z.substring(ia+1,Z.length);W=W==="strip";Z=Z.substring(0,ia)}X=X.nameToUrl(ma,"."+Z);require.fetchText(X,function(pa){pa=W?require.textStrip(pa):pa;if(U.isBuild&&U.inlineText)aa[L]=pa;N(pa)})},write:function(L,X,N){if(X in aa){var U=require.jsEscape(aa[X]);N("define('"+L+"!"+X+"', function () { return '"+U+"';});\n")}}}})})();
(function(){function Q(N,U,W){U([N],function(ia){W(function(){return ia})})}function B(N){var U=N.currentTarget||N.srcElement,W;if(N.type==="load"||aa.test(U.readyState)){N=U.getAttribute("data-requiremodule");X[N]=true;for(N=0;W=L[N];N++)if(X[W.name])Q(W.name,W.req,W.onLoad);else break;N>0&&L.splice(0,N);setTimeout(function(){U.parentNode.removeChild(U)},15)}}var Aa=typeof document!=="undefined"&&typeof window!=="undefined"&&(document.createElement("script").async||window.opera&&Object.prototype.toString.call(window.opera)===
"[object Opera]"||"MozAppearance"in document.documentElement.style),aa=/^(complete|loaded)$/,L=[],X={};define("require/order",{load:function(N,U,W,ia){var ma=U.nameToUrl(N,null);if(ia.isBuild)Q(N,U,W);else{require.s.skipAsync[ma]=true;if(Aa)U([N],function(Z){W(function(){return Z})});else if(U.isDefined(N))U([N],function(Z){W(function(){return Z})});else{L.push({name:N,req:U,onLoad:W});require.attach(ma,"",N,B,"script/cache")}}}})})();
(function(Q,B){function Aa(a,b,d){if(d===B&&a.nodeType===1){d=a.getAttribute("data-"+b);if(typeof d==="string"){try{d=d==="true"?true:d==="false"?false:d==="null"?null:!c.isNaN(d)?parseFloat(d):Ra.test(d)?c.parseJSON(d):d}catch(e){}c.data(a,b,d)}else d=B}return d}function aa(){return false}function L(){return true}function X(a,b,d){d[0].type=a;return c.event.handle.apply(b,d)}function N(a){var b,d,e,f,h,m,l,p,A,v,H,P=[];f=[];h=c.data(this,this.nodeType?"events":"__events__");if(typeof h==="function")h=
h.events;if(!(a.liveFired===this||!h||!h.live||a.button&&a.type==="click")){if(a.namespace)H=new RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)");a.liveFired=this;var fa=h.live.slice(0);for(l=0;l<fa.length;l++){h=fa[l];h.origType.replace(ua,"")===a.type?f.push(h.selector):fa.splice(l--,1)}f=c(a.target).closest(f,a.currentTarget);p=0;for(A=f.length;p<A;p++){v=f[p];for(l=0;l<fa.length;l++){h=fa[l];if(v.selector===h.selector&&(!H||H.test(h.namespace))){m=v.elem;e=null;if(h.preType===
"mouseenter"||h.preType==="mouseleave"){a.type=h.preType;e=c(a.relatedTarget).closest(h.selector)[0]}if(!e||e!==m)P.push({elem:m,handleObj:h,level:v.level})}}}p=0;for(A=P.length;p<A;p++){f=P[p];if(d&&f.level>d)break;a.currentTarget=f.elem;a.data=f.handleObj.data;a.handleObj=f.handleObj;H=f.handleObj.origHandler.apply(f.elem,arguments);if(H===false||a.isPropagationStopped()){d=f.level;if(H===false)b=false;if(a.isImmediatePropagationStopped())break}}return b}}function U(a,b){return(a&&a!=="*"?a+".":
"")+b.replace(Ta,"`").replace(Ka,"&")}function W(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function ia(a,b,d){if(c.isFunction(b))return c.grep(a,function(f,h){return!!b.call(f,h,f)===d});else if(b.nodeType)return c.grep(a,function(f){return f===b===d});else if(typeof b==="string"){var e=c.grep(a,function(f){return f.nodeType===1});if(fb.test(b))return c.filter(b,e,!d);else b=c.filter(b,e)}return c.grep(a,function(f){return c.inArray(f,b)>=0===d})}function ma(a){return c.nodeName(a,"table")?
a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function Z(a,b){var d=0;b.each(function(){if(this.nodeName===(a[d]&&a[d].nodeName)){var e=c.data(a[d++]),f=c.data(this,e);if(e=e&&e.events){delete f.handle;f.events={};for(var h in e)for(var m in e[h])c.event.add(this,h,e[h][m],e[h][m].data)}}})}function pa(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}
function Qa(a,b,d){var e=b==="width"?a.offsetWidth:a.offsetHeight;if(d==="border")return e;c.each(b==="width"?sa:Ma,function(){d||(e-=parseFloat(c.css(a,"padding"+this))||0);if(d==="margin")e+=parseFloat(c.css(a,"margin"+this))||0;else e-=parseFloat(c.css(a,"border"+this+"Width"))||0});return e}function ja(a,b,d,e){if(c.isArray(b)&&b.length)c.each(b,function(f,h){d||ca.test(a)?e(a,h):ja(a+"["+(typeof h==="object"||c.isArray(h)?f:"")+"]",h,d,e)});else if(!d&&b!=null&&typeof b==="object")c.isEmptyObject(b)?
e(a,""):c.each(b,function(f,h){ja(a+"["+f+"]",h,d,e)});else e(a,b)}function qa(a,b){var d={};c.each(tb.concat.apply([],tb.slice(0,b)),function(){d[this]=a});return d}function Ea(a){if(!rb[a]){var b=c("<"+a+">").appendTo("body"),d=b.css("display");b.remove();if(d==="none"||d==="")d="block";rb[a]=d}return rb[a]}function Ia(a){return c.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:false}var w=Q.document,c=function(){function a(){if(!b.isReady){try{w.documentElement.doScroll("left")}catch(j){setTimeout(a,
1);return}b.ready()}}var b=function(j,t){return new b.fn.init(j,t)},d=Q.jQuery,e=Q.$,f,h=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,m=/\S/,l=/^\s+/,p=/\s+$/,A=/\W/,v=/\d/,H=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,P=/^[\],:{}\s]*$/,fa=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,C=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,da=/(?:^|:|,)(?:\s*\[)+/g,xa=/(webkit)[ \/]([\w.]+)/,g=/(opera)(?:.*version)?[ \/]([\w.]+)/,i=/(msie) ([\w.]+)/,o=/(mozilla)(?:.*? rv:([\w.]+))?/,q=navigator.userAgent,s=false,
u=[],D,I=Object.prototype.toString,Y=Object.prototype.hasOwnProperty,va=Array.prototype.push,ya=Array.prototype.slice,za=String.prototype.trim,V=Array.prototype.indexOf,Ua={};b.fn=b.prototype={init:function(j,t){var z,O;if(!j)return this;if(j.nodeType){this.context=this[0]=j;this.length=1;return this}if(j==="body"&&!t&&w.body){this.context=w;this[0]=w.body;this.selector="body";this.length=1;return this}if(typeof j==="string")if((z=h.exec(j))&&(z[1]||!t))if(z[1]){O=t?t.ownerDocument||t:w;if(j=H.exec(j))if(b.isPlainObject(t)){j=
[w.createElement(j[1])];b.fn.attr.call(j,t,true)}else j=[O.createElement(j[1])];else{j=b.buildFragment([z[1]],[O]);j=(j.cacheable?j.fragment.cloneNode(true):j.fragment).childNodes}return b.merge(this,j)}else{if((t=w.getElementById(z[2]))&&t.parentNode){if(t.id!==z[2])return f.find(j);this.length=1;this[0]=t}this.context=w;this.selector=j;return this}else if(!t&&!A.test(j)){this.selector=j;this.context=w;j=w.getElementsByTagName(j);return b.merge(this,j)}else return!t||t.jquery?(t||f).find(j):b(t).find(j);
else if(b.isFunction(j))return f.ready(j);if(j.selector!==B){this.selector=j.selector;this.context=j.context}return b.makeArray(j,this)},selector:"",jquery:"1.4.4",length:0,size:function(){return this.length},toArray:function(){return ya.call(this,0)},get:function(j){return j==null?this.toArray():j<0?this.slice(j)[0]:this[j]},pushStack:function(j,t,z){var O=b();b.isArray(j)?va.apply(O,j):b.merge(O,j);O.prevObject=this;O.context=this.context;if(t==="find")O.selector=this.selector+(this.selector?" ":
"")+z;else if(t)O.selector=this.selector+"."+t+"("+z+")";return O},each:function(j,t){return b.each(this,j,t)},ready:function(j){b.bindReady();if(b.isReady)j.call(w,b);else u&&u.push(j);return this},eq:function(j){return j===-1?this.slice(j):this.slice(j,+j+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(ya.apply(this,arguments),"slice",ya.call(arguments).join(","))},map:function(j){return this.pushStack(b.map(this,function(t,z){return j.call(t,
z,t)}))},end:function(){return this.prevObject||b(null)},push:va,sort:[].sort,splice:[].splice};b.fn.init.prototype=b.fn;b.extend=b.fn.extend=function(){var j,t,z,O,ga,$=arguments[0]||{},ra=1,Ba=arguments.length,sb=false;if(typeof $==="boolean"){sb=$;$=arguments[1]||{};ra=2}if(typeof $!=="object"&&!b.isFunction($))$={};if(Ba===ra){$=this;--ra}for(;ra<Ba;ra++)if((j=arguments[ra])!=null)for(t in j){z=$[t];O=j[t];if($!==O)if(sb&&O&&(b.isPlainObject(O)||(ga=b.isArray(O)))){if(ga){ga=false;z=z&&b.isArray(z)?
z:[]}else z=z&&b.isPlainObject(z)?z:{};$[t]=b.extend(sb,z,O)}else if(O!==B)$[t]=O}return $};b.extend({noConflict:function(j){Q.$=e;if(j)Q.jQuery=d;return b},isReady:false,readyWait:1,ready:function(j){j===true&&b.readyWait--;if(!b.readyWait||j!==true&&!b.isReady){if(!w.body)return setTimeout(b.ready,1);b.isReady=true;if(!(j!==true&&--b.readyWait>0))if(u){var t=0,z=u;for(u=null;j=z[t++];)j.call(w,b);b.fn.trigger&&b(w).trigger("ready").unbind("ready")}}},bindReady:function(){if(!s){s=true;if(w.readyState===
"complete")return setTimeout(b.ready,1);if(w.addEventListener){w.addEventListener("DOMContentLoaded",D,false);Q.addEventListener("load",b.ready,false)}else if(w.attachEvent){w.attachEvent("onreadystatechange",D);Q.attachEvent("onload",b.ready);var j=false;try{j=Q.frameElement==null}catch(t){}w.documentElement.doScroll&&j&&a()}}},isFunction:function(j){return b.type(j)==="function"},isArray:Array.isArray||function(j){return b.type(j)==="array"},isWindow:function(j){return j&&typeof j==="object"&&"setInterval"in
j},isNaN:function(j){return j==null||!v.test(j)||isNaN(j)},type:function(j){return j==null?String(j):Ua[I.call(j)]||"object"},isPlainObject:function(j){if(!j||b.type(j)!=="object"||j.nodeType||b.isWindow(j))return false;if(j.constructor&&!Y.call(j,"constructor")&&!Y.call(j.constructor.prototype,"isPrototypeOf"))return false;var t;for(t in j);return t===B||Y.call(j,t)},isEmptyObject:function(j){for(var t in j)return false;return true},error:function(j){throw j;},parseJSON:function(j){if(typeof j!==
"string"||!j)return null;j=b.trim(j);if(P.test(j.replace(fa,"@").replace(C,"]").replace(da,"")))return Q.JSON&&Q.JSON.parse?Q.JSON.parse(j):(new Function("return "+j))();else b.error("Invalid JSON: "+j)},noop:function(){},globalEval:function(j){if(j&&m.test(j)){var t=w.getElementsByTagName("head")[0]||w.documentElement,z=w.createElement("script");z.type="text/javascript";if(b.support.scriptEval)z.appendChild(w.createTextNode(j));else z.text=j;t.insertBefore(z,t.firstChild);t.removeChild(z)}},nodeName:function(j,
t){return j.nodeName&&j.nodeName.toUpperCase()===t.toUpperCase()},each:function(j,t,z){var O,ga=0,$=j.length,ra=$===B||b.isFunction(j);if(z)if(ra)for(O in j){if(t.apply(j[O],z)===false)break}else for(;ga<$;){if(t.apply(j[ga++],z)===false)break}else if(ra)for(O in j){if(t.call(j[O],O,j[O])===false)break}else for(z=j[0];ga<$&&t.call(z,ga,z)!==false;z=j[++ga]);return j},trim:za?function(j){return j==null?"":za.call(j)}:function(j){return j==null?"":j.toString().replace(l,"").replace(p,"")},makeArray:function(j,
t){t=t||[];if(j!=null){var z=b.type(j);j.length==null||z==="string"||z==="function"||z==="regexp"||b.isWindow(j)?va.call(t,j):b.merge(t,j)}return t},inArray:function(j,t){if(t.indexOf)return t.indexOf(j);for(var z=0,O=t.length;z<O;z++)if(t[z]===j)return z;return-1},merge:function(j,t){var z=j.length,O=0;if(typeof t.length==="number")for(var ga=t.length;O<ga;O++)j[z++]=t[O];else for(;t[O]!==B;)j[z++]=t[O++];j.length=z;return j},grep:function(j,t,z){var O=[],ga;z=!!z;for(var $=0,ra=j.length;$<ra;$++){ga=
!!t(j[$],$);z!==ga&&O.push(j[$])}return O},map:function(j,t,z){for(var O=[],ga,$=0,ra=j.length;$<ra;$++){ga=t(j[$],$,z);if(ga!=null)O[O.length]=ga}return O.concat.apply([],O)},guid:1,proxy:function(j,t,z){if(arguments.length===2)if(typeof t==="string"){z=j;j=z[t];t=B}else if(t&&!b.isFunction(t)){z=t;t=B}if(!t&&j)t=function(){return j.apply(z||this,arguments)};if(j)t.guid=j.guid=j.guid||t.guid||b.guid++;return t},access:function(j,t,z,O,ga,$){var ra=j.length;if(typeof t==="object"){for(var Ba in t)b.access(j,
Ba,t[Ba],O,ga,z);return j}if(z!==B){O=!$&&O&&b.isFunction(z);for(Ba=0;Ba<ra;Ba++)ga(j[Ba],t,O?z.call(j[Ba],Ba,ga(j[Ba],t)):z,$);return j}return ra?ga(j[0],t):B},now:function(){return(new Date).getTime()},uaMatch:function(j){j=j.toLowerCase();j=xa.exec(j)||g.exec(j)||i.exec(j)||j.indexOf("compatible")<0&&o.exec(j)||[];return{browser:j[1]||"",version:j[2]||"0"}},browser:{}});b.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(j,t){Ua["[object "+t+"]"]=t.toLowerCase()});
q=b.uaMatch(q);if(q.browser){b.browser[q.browser]=true;b.browser.version=q.version}if(b.browser.webkit)b.browser.safari=true;if(V)b.inArray=function(j,t){return V.call(t,j)};if(!/\s/.test("\u00a0")){l=/^[\s\xA0]+/;p=/[\s\xA0]+$/}f=b(w);if(w.addEventListener)D=function(){w.removeEventListener("DOMContentLoaded",D,false);b.ready()};else if(w.attachEvent)D=function(){if(w.readyState==="complete"){w.detachEvent("onreadystatechange",D);b.ready()}};return Q.jQuery=Q.$=b}();(function(){c.support={};var a=
w.documentElement,b=w.createElement("script"),d=w.createElement("div"),e="script"+c.now();d.style.display="none";d.innerHTML="   <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";var f=d.getElementsByTagName("*"),h=d.getElementsByTagName("a")[0],m=w.createElement("select"),l=m.appendChild(w.createElement("option"));if(!(!f||!f.length||!h)){c.support={leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,
htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(h.getAttribute("style")),hrefNormalized:h.getAttribute("href")==="/a",opacity:/^0.55$/.test(h.style.opacity),cssFloat:!!h.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:l.selected,deleteExpando:true,optDisabled:false,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null,inlineBlockNeedsLayout:false,shrinkWrapBlocks:false,reliableHiddenOffsets:true};m.disabled=true;c.support.optDisabled=
!l.disabled;b.type="text/javascript";try{b.appendChild(w.createTextNode("window."+e+"=1;"))}catch(p){}a.insertBefore(b,a.firstChild);if(Q[e]){c.support.scriptEval=true;delete Q[e]}try{delete b.test}catch(A){c.support.deleteExpando=false}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function v(){c.support.noCloneEvent=false;d.detachEvent("onclick",v)});d.cloneNode(true).fireEvent("onclick")}d=w.createElement("div");d.innerHTML="<input type='radio' name='radiotest' checked='checked'/>";
a=w.createDocumentFragment();a.appendChild(d.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var v=w.createElement("div");v.style.width=v.style.paddingLeft="1px";w.body.appendChild(v);c.boxModel=c.support.boxModel=v.offsetWidth===2;if("zoom"in v.style){v.style.display="inline";v.style.zoom=1;c.support.inlineBlockNeedsLayout=v.offsetWidth===2;v.style.display="";v.innerHTML="<div style='width:4px;'></div>";c.support.shrinkWrapBlocks=v.offsetWidth!==
2}v.innerHTML="<table><tr><td style='padding:0;display:none'></td><td>t</td></tr></table>";var H=v.getElementsByTagName("td");c.support.reliableHiddenOffsets=H[0].offsetHeight===0;H[0].style.display="";H[1].style.display="none";c.support.reliableHiddenOffsets=c.support.reliableHiddenOffsets&&H[0].offsetHeight===0;v.innerHTML="";w.body.removeChild(v).style.display="none"});a=function(v){var H=w.createElement("div");v="on"+v;var P=v in H;if(!P){H.setAttribute(v,"return;");P=typeof H[v]==="function"}return P};
c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=f=h=null}})();var wa={},Ra=/^(?:\{.*\}|\[.*\])$/;c.extend({cache:{},uuid:0,expando:"jQuery"+c.now(),noData:{embed:true,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:true},data:function(a,b,d){if(c.acceptData(a)){a=a==Q?wa:a;var e=a.nodeType,f=e?a[c.expando]:null,h=c.cache;if(!(e&&!f&&typeof b==="string"&&d===B)){if(e)f||(a[c.expando]=f=++c.uuid);else h=a;if(typeof b==="object")if(e)h[f]=c.extend(h[f],b);else c.extend(h,
b);else if(e&&!h[f])h[f]={};a=e?h[f]:h;if(d!==B)a[b]=d;return typeof b==="string"?a[b]:a}}},removeData:function(a,b){if(c.acceptData(a)){a=a==Q?wa:a;var d=a.nodeType,e=d?a[c.expando]:a,f=c.cache,h=d?f[e]:e;if(b){if(h){delete h[b];d&&c.isEmptyObject(h)&&c.removeData(a)}}else if(d&&c.support.deleteExpando)delete a[c.expando];else if(a.removeAttribute)a.removeAttribute(c.expando);else if(d)delete f[e];else for(var m in a)delete a[m]}},acceptData:function(a){if(a.nodeName){var b=c.noData[a.nodeName.toLowerCase()];
if(b)return!(b===true||a.getAttribute("classid")!==b)}return true}});c.fn.extend({data:function(a,b){var d=null;if(typeof a==="undefined"){if(this.length){var e=this[0].attributes,f;d=c.data(this[0]);for(var h=0,m=e.length;h<m;h++){f=e[h].name;if(f.indexOf("data-")===0){f=f.substr(5);Aa(this[0],f,d[f])}}}return d}else if(typeof a==="object")return this.each(function(){c.data(this,a)});var l=a.split(".");l[1]=l[1]?"."+l[1]:"";if(b===B){d=this.triggerHandler("getData"+l[1]+"!",[l[0]]);if(d===B&&this.length){d=
c.data(this[0],a);d=Aa(this[0],a,d)}return d===B&&l[1]?this.data(l[0]):d}else return this.each(function(){var p=c(this),A=[l[0],b];p.triggerHandler("setData"+l[1]+"!",A);c.data(this,a,b);p.triggerHandler("changeData"+l[1]+"!",A)})},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});c.extend({queue:function(a,b,d){if(a){b=(b||"fx")+"queue";var e=c.data(a,b);if(!d)return e||[];if(!e||c.isArray(d))e=c.data(a,b,c.makeArray(d));else e.push(d);return e}},dequeue:function(a,b){b=
b||"fx";var d=c.queue(a,b),e=d.shift();if(e==="inprogress")e=d.shift();if(e){b==="fx"&&d.unshift("inprogress");e.call(a,function(){c.dequeue(a,b)})}}});c.fn.extend({queue:function(a,b){if(typeof a!=="string"){b=a;a="fx"}if(b===B)return c.queue(this[0],a);return this.each(function(){var d=c.queue(this,a,b);a==="fx"&&d[0]!=="inprogress"&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this,a)})},delay:function(a,b){a=c.fx?c.fx.speeds[a]||a:a;b=b||"fx";return this.queue(b,
function(){var d=this;setTimeout(function(){c.dequeue(d,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var jb=/[\n\t]/g,Ya=/\s+/,mb=/\r/g,F=/^(?:href|src|style)$/,cb=/^(?:button|input)$/i,ha=/^(?:button|input|object|select|textarea)$/i,Oa=/^a(?:rea)?$/i,Sa=/^(?:radio|checkbox)$/i;c.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};
c.fn.extend({attr:function(a,b){return c.access(this,a,b,true,c.attr)},removeAttr:function(a){return this.each(function(){c.attr(this,a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(c.isFunction(a))return this.each(function(A){var v=c(this);v.addClass(a.call(this,A,v.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(Ya),d=0,e=this.length;d<e;d++){var f=this[d];if(f.nodeType===1)if(f.className){for(var h=" "+f.className+" ",m=f.className,l=0,p=b.length;l<
p;l++)if(h.indexOf(" "+b[l]+" ")<0)m+=" "+b[l];f.className=c.trim(m)}else f.className=a}return this},removeClass:function(a){if(c.isFunction(a))return this.each(function(p){var A=c(this);A.removeClass(a.call(this,p,A.attr("class")))});if(a&&typeof a==="string"||a===B)for(var b=(a||"").split(Ya),d=0,e=this.length;d<e;d++){var f=this[d];if(f.nodeType===1&&f.className)if(a){for(var h=(" "+f.className+" ").replace(jb," "),m=0,l=b.length;m<l;m++)h=h.replace(" "+b[m]+" "," ");f.className=c.trim(h)}else f.className=
""}return this},toggleClass:function(a,b){var d=typeof a,e=typeof b==="boolean";if(c.isFunction(a))return this.each(function(f){var h=c(this);h.toggleClass(a.call(this,f,h.attr("class"),b),b)});return this.each(function(){if(d==="string")for(var f,h=0,m=c(this),l=b,p=a.split(Ya);f=p[h++];){l=e?l:!m.hasClass(f);m[l?"addClass":"removeClass"](f)}else if(d==="undefined"||d==="boolean"){this.className&&c.data(this,"__className__",this.className);this.className=this.className||a===false?"":c.data(this,
"__className__")||""}})},hasClass:function(a){a=" "+a+" ";for(var b=0,d=this.length;b<d;b++)if((" "+this[b].className+" ").replace(jb," ").indexOf(a)>-1)return true;return false},val:function(a){if(!arguments.length){var b=this[0];if(b){if(c.nodeName(b,"option")){var d=b.attributes.value;return!d||d.specified?b.value:b.text}if(c.nodeName(b,"select")){var e=b.selectedIndex;d=[];var f=b.options;b=b.type==="select-one";if(e<0)return null;var h=b?e:0;for(e=b?e+1:f.length;h<e;h++){var m=f[h];if(m.selected&&
(c.support.optDisabled?!m.disabled:m.getAttribute("disabled")===null)&&(!m.parentNode.disabled||!c.nodeName(m.parentNode,"optgroup"))){a=c(m).val();if(b)return a;d.push(a)}}return d}if(Sa.test(b.type)&&!c.support.checkOn)return b.getAttribute("value")===null?"on":b.value;return(b.value||"").replace(mb,"")}return B}var l=c.isFunction(a);return this.each(function(p){var A=c(this),v=a;if(this.nodeType===1){if(l)v=a.call(this,p,A.val());if(v==null)v="";else if(typeof v==="number")v+="";else if(c.isArray(v))v=
c.map(v,function(P){return P==null?"":P+""});if(c.isArray(v)&&Sa.test(this.type))this.checked=c.inArray(A.val(),v)>=0;else if(c.nodeName(this,"select")){var H=c.makeArray(v);c("option",this).each(function(){this.selected=c.inArray(c(this).val(),H)>=0});if(!H.length)this.selectedIndex=-1}else this.value=v}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(a,b,d,e){if(!a||a.nodeType===3||a.nodeType===8)return B;if(e&&b in c.attrFn)return c(a)[b](d);
e=a.nodeType!==1||!c.isXMLDoc(a);var f=d!==B;b=e&&c.props[b]||b;var h=F.test(b);if((b in a||a[b]!==B)&&e&&!h){if(f){b==="type"&&cb.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed");if(d===null)a.nodeType===1&&a.removeAttribute(b);else a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&b.specified?b.value:ha.test(a.nodeName)||Oa.test(a.nodeName)&&a.href?0:B;return a[b]}if(!c.support.style&&
e&&b==="style"){if(f)a.style.cssText=""+d;return a.style.cssText}f&&a.setAttribute(b,""+d);if(!a.attributes[b]&&a.hasAttribute&&!a.hasAttribute(b))return B;a=!c.support.hrefNormalized&&e&&h?a.getAttribute(b,2):a.getAttribute(b);return a===null?B:a}});var ua=/\.(.*)$/,La=/^(?:textarea|input|select)$/i,Ta=/\./g,Ka=/ /g,db=/[^\w\s.|`]/g,kb=function(a){return a.replace(db,"\\$&")},Ga={focusin:0,focusout:0};c.event={add:function(a,b,d,e){if(!(a.nodeType===3||a.nodeType===8)){if(c.isWindow(a)&&a!==Q&&!a.frameElement)a=
Q;if(d===false)d=aa;else if(!d)return;var f,h;if(d.handler){f=d;d=f.handler}if(!d.guid)d.guid=c.guid++;if(h=c.data(a)){var m=a.nodeType?"events":"__events__",l=h[m],p=h.handle;if(typeof l==="function"){p=l.handle;l=l.events}else if(!l){a.nodeType||(h[m]=h=function(){});h.events=l={}}if(!p)h.handle=p=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(p.elem,arguments):B};p.elem=a;b=b.split(" ");for(var A=0,v;m=b[A++];){h=f?c.extend({},f):{handler:d,data:e};if(m.indexOf(".")>
-1){v=m.split(".");m=v.shift();h.namespace=v.slice(0).sort().join(".")}else{v=[];h.namespace=""}h.type=m;if(!h.guid)h.guid=d.guid;var H=l[m],P=c.event.special[m]||{};if(!H){H=l[m]=[];if(!P.setup||P.setup.call(a,e,v,p)===false)if(a.addEventListener)a.addEventListener(m,p,false);else a.attachEvent&&a.attachEvent("on"+m,p)}if(P.add){P.add.call(a,h);if(!h.handler.guid)h.handler.guid=d.guid}H.push(h);c.event.global[m]=true}a=null}}},global:{},remove:function(a,b,d,e){if(!(a.nodeType===3||a.nodeType===
8)){if(d===false)d=aa;var f,h,m=0,l,p,A,v,H,P,fa=a.nodeType?"events":"__events__",C=c.data(a),da=C&&C[fa];if(C&&da){if(typeof da==="function"){C=da;da=da.events}if(b&&b.type){d=b.handler;b=b.type}if(!b||typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(f in da)c.event.remove(a,f+b)}else{for(b=b.split(" ");f=b[m++];){v=f;l=f.indexOf(".")<0;p=[];if(!l){p=f.split(".");f=p.shift();A=new RegExp("(^|\\.)"+c.map(p.slice(0).sort(),kb).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(H=da[f])if(d){v=c.event.special[f]||
{};for(h=e||0;h<H.length;h++){P=H[h];if(d.guid===P.guid){if(l||A.test(P.namespace)){e==null&&H.splice(h--,1);v.remove&&v.remove.call(a,P)}if(e!=null)break}}if(H.length===0||e!=null&&H.length===1){if(!v.teardown||v.teardown.call(a,p)===false)c.removeEvent(a,f,C.handle);delete da[f]}}else for(h=0;h<H.length;h++){P=H[h];if(l||A.test(P.namespace)){c.event.remove(a,v,P.handler,h);H.splice(h--,1)}}}if(c.isEmptyObject(da)){if(b=C.handle)b.elem=null;delete C.events;delete C.handle;if(typeof C==="function")c.removeData(a,
fa);else c.isEmptyObject(C)&&c.removeData(a)}}}}},trigger:function(a,b,d,e){var f=a.type||a;if(!e){a=typeof a==="object"?a[c.expando]?a:c.extend(c.Event(f),a):c.Event(f);if(f.indexOf("!")>=0){a.type=f=f.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();c.event.global[f]&&c.each(c.cache,function(){this.events&&this.events[f]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType===8)return B;a.result=B;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(e=d.nodeType?
c.data(d,"handle"):(c.data(d,"__events__")||{}).handle)&&e.apply(d,b);e=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+f]&&d["on"+f].apply(d,b)===false){a.result=false;a.preventDefault()}}catch(h){}if(!a.isPropagationStopped()&&e)c.event.trigger(a,b,e,true);else if(!a.isDefaultPrevented()){var m;e=a.target;var l=f.replace(ua,""),p=c.nodeName(e,"a")&&l==="click",A=c.event.special[l]||{};if((!A._default||A._default.call(d,a)===false)&&!p&&!(e&&e.nodeName&&
c.noData[e.nodeName.toLowerCase()])){try{if(e[l]){if(m=e["on"+l])e["on"+l]=null;c.event.triggered=true;e[l]()}}catch(v){}if(m)e["on"+l]=m;c.event.triggered=false}}},handle:function(a){var b,d,e,f;d=[];var h=c.makeArray(arguments);a=h[0]=c.event.fix(a||Q.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive;if(!b){e=a.type.split(".");a.type=e.shift();d=e.slice(0).sort();e=new RegExp("(^|\\.)"+d.join("\\.(?:.*\\.)?")+"(\\.|$)")}a.namespace=a.namespace||d.join(".");f=c.data(this,this.nodeType?
"events":"__events__");if(typeof f==="function")f=f.events;d=(f||{})[a.type];if(f&&d){d=d.slice(0);f=0;for(var m=d.length;f<m;f++){var l=d[f];if(b||e.test(l.namespace)){a.handler=l.handler;a.data=l.data;a.handleObj=l;l=l.handler.apply(this,h);if(l!==B){a.result=l;if(l===false){a.preventDefault();a.stopPropagation()}}if(a.isImmediatePropagationStopped())break}}}return a.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),
fix:function(a){if(a[c.expando])return a;var b=a;a=c.Event(b);for(var d=this.props.length,e;d;){e=this.props[--d];a[e]=b[e]}if(!a.target)a.target=a.srcElement||w;if(a.target.nodeType===3)a.target=a.target.parentNode;if(!a.relatedTarget&&a.fromElement)a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement;if(a.pageX==null&&a.clientX!=null){b=w.documentElement;d=w.body;a.pageX=a.clientX+(b&&b.scrollLeft||d&&d.scrollLeft||0)-(b&&b.clientLeft||d&&d.clientLeft||0);a.pageY=a.clientY+(b&&b.scrollTop||
d&&d.scrollTop||0)-(b&&b.clientTop||d&&d.clientTop||0)}if(a.which==null&&(a.charCode!=null||a.keyCode!=null))a.which=a.charCode!=null?a.charCode:a.keyCode;if(!a.metaKey&&a.ctrlKey)a.metaKey=a.ctrlKey;if(!a.which&&a.button!==B)a.which=a.button&1?1:a.button&2?3:a.button&4?2:0;return a},guid:1E8,proxy:c.proxy,special:{ready:{setup:c.bindReady,teardown:c.noop},live:{add:function(a){c.event.add(this,U(a.origType,a.selector),c.extend({},a,{handler:N,guid:a.handler.guid}))},remove:function(a){c.event.remove(this,
U(a.origType,a.selector),a)}},beforeunload:{setup:function(a,b,d){if(c.isWindow(this))this.onbeforeunload=d},teardown:function(a,b){if(this.onbeforeunload===b)this.onbeforeunload=null}}}};c.removeEvent=w.removeEventListener?function(a,b,d){a.removeEventListener&&a.removeEventListener(b,d,false)}:function(a,b,d){a.detachEvent&&a.detachEvent("on"+b,d)};c.Event=function(a){if(!this.preventDefault)return new c.Event(a);if(a&&a.type){this.originalEvent=a;this.type=a.type}else this.type=a;this.timeStamp=
c.now();this[c.expando]=true};c.Event.prototype={preventDefault:function(){this.isDefaultPrevented=L;var a=this.originalEvent;if(a)if(a.preventDefault)a.preventDefault();else a.returnValue=false},stopPropagation:function(){this.isPropagationStopped=L;var a=this.originalEvent;if(a){a.stopPropagation&&a.stopPropagation();a.cancelBubble=true}},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=L;this.stopPropagation()},isDefaultPrevented:aa,isPropagationStopped:aa,isImmediatePropagationStopped:aa};
var y=function(a){var b=a.relatedTarget;try{for(;b&&b!==this;)b=b.parentNode;if(b!==this){a.type=a.data;c.event.handle.apply(this,arguments)}}catch(d){}},E=function(a){a.type=a.data;c.event.handle.apply(this,arguments)};c.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){c.event.special[a]={setup:function(d){c.event.add(this,b,d&&d.selector?E:y,a)},teardown:function(d){c.event.remove(this,b,d&&d.selector?E:y)}}});if(!c.support.submitBubbles)c.event.special.submit={setup:function(){if(this.nodeName.toLowerCase()!==
"form"){c.event.add(this,"click.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="submit"||d==="image")&&c(b).closest("form").length){a.liveFired=B;return X("submit",this,arguments)}});c.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="text"||d==="password")&&c(b).closest("form").length&&a.keyCode===13){a.liveFired=B;return X("submit",this,arguments)}})}else return false},teardown:function(){c.event.remove(this,".specialSubmit")}};if(!c.support.changeBubbles){var K,
M=function(a){var b=a.type,d=a.value;if(b==="radio"||b==="checkbox")d=a.checked;else if(b==="select-multiple")d=a.selectedIndex>-1?c.map(a.options,function(e){return e.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d},ba=function(a,b){var d=a.target,e,f;if(!(!La.test(d.nodeName)||d.readOnly)){e=c.data(d,"_change_data");f=M(d);if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data",f);if(!(e===B||f===e))if(e!=null||f){a.type="change";a.liveFired=
B;return c.event.trigger(a,b,d)}}};c.event.special.change={filters:{focusout:ba,beforedeactivate:ba,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return ba.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return ba.call(this,a)},beforeactivate:function(a){a=a.target;c.data(a,"_change_data",M(a))}},setup:function(){if(this.type===
"file")return false;for(var a in K)c.event.add(this,a+".specialChange",K[a]);return La.test(this.nodeName)},teardown:function(){c.event.remove(this,".specialChange");return La.test(this.nodeName)}};K=c.event.special.change.filters;K.focus=K.beforeactivate}w.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(e){e=c.event.fix(e);e.type=b;return c.event.trigger(e,null,e.target)}c.event.special[b]={setup:function(){Ga[b]++===0&&w.addEventListener(a,d,true)},teardown:function(){--Ga[b]===
0&&w.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,e,f){if(typeof d==="object"){for(var h in d)this[b](h,e,d[h],f);return this}if(c.isFunction(e)||e===false){f=e;e=B}var m=b==="one"?c.proxy(f,function(p){c(this).unbind(p,m);return f.apply(this,arguments)}):f;if(d==="unload"&&b!=="one")this.one(d,e,f);else{h=0;for(var l=this.length;h<l;h++)c.event.add(this[h],d,m,e)}return this}});c.fn.extend({unbind:function(a,b){if(typeof a==="object"&&!a.preventDefault)for(var d in a)this.unbind(d,
a[d]);else{d=0;for(var e=this.length;d<e;d++)c.event.remove(this[d],a,b)}return this},delegate:function(a,b,d,e){return this.live(b,d,e,a)},undelegate:function(a,b,d){return arguments.length===0?this.unbind("live"):this.die(b,null,d,a)},trigger:function(a,b){return this.each(function(){c.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0]){a=c.Event(a);a.preventDefault();a.stopPropagation();c.event.trigger(a,b,this[0]);return a.result}},toggle:function(a){for(var b=arguments,d=1;d<
b.length;)c.proxy(a,b[d++]);return this.click(c.proxy(a,function(e){var f=(c.data(this,"lastToggle"+a.guid)||0)%d;c.data(this,"lastToggle"+a.guid,f+1);e.preventDefault();return b[f].apply(this,arguments)||false}))},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var T={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};c.each(["live","die"],function(a,b){c.fn[b]=function(d,e,f,h){var m,l=0,p,A,v=h||this.selector;h=h?this:c(this.context);if(typeof d==="object"&&
!d.preventDefault){for(m in d)h[b](m,e,d[m],v);return this}if(c.isFunction(e)){f=e;e=B}for(d=(d||"").split(" ");(m=d[l++])!=null;){p=ua.exec(m);A="";if(p){A=p[0];m=m.replace(ua,"")}if(m==="hover")d.push("mouseenter"+A,"mouseleave"+A);else{p=m;if(m==="focus"||m==="blur"){d.push(T[m]+A);m+=A}else m=(T[m]||m)+A;if(b==="live"){A=0;for(var H=h.length;A<H;A++)c.event.add(h[A],"live."+U(m,v),{data:e,selector:v,handler:f,origType:m,origHandler:f,preType:p})}else h.unbind("live."+U(m,v),f)}}return this}});
c.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "),function(a,b){c.fn[b]=function(d,e){if(e==null){e=d;d=null}return arguments.length>0?this.bind(b,d,e):this.trigger(b)};if(c.attrFn)c.attrFn[b]=true});Q.attachEvent&&!Q.addEventListener&&c(Q).bind("unload",function(){for(var a in c.cache)if(c.cache[a].handle)try{c.event.remove(c.cache[a].handle.elem)}catch(b){}});
(function(){function a(g,i,o,q,s,u){s=0;for(var D=q.length;s<D;s++){var I=q[s];if(I){var Y=false;for(I=I[g];I;){if(I.sizcache===o){Y=q[I.sizset];break}if(I.nodeType===1&&!u){I.sizcache=o;I.sizset=s}if(I.nodeName.toLowerCase()===i){Y=I;break}I=I[g]}q[s]=Y}}}function b(g,i,o,q,s,u){s=0;for(var D=q.length;s<D;s++){var I=q[s];if(I){var Y=false;for(I=I[g];I;){if(I.sizcache===o){Y=q[I.sizset];break}if(I.nodeType===1){if(!u){I.sizcache=o;I.sizset=s}if(typeof i!=="string"){if(I===i){Y=true;break}}else if(l.filter(i,
[I]).length>0){Y=I;break}}I=I[g]}q[s]=Y}}}var d=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,e=0,f=Object.prototype.toString,h=false,m=true;[0,0].sort(function(){m=false;return 0});var l=function(g,i,o,q){o=o||[];var s=i=i||w;if(i.nodeType!==1&&i.nodeType!==9)return[];if(!g||typeof g!=="string")return o;var u,D,I,Y,va,ya=true,za=l.isXML(i),V=[],Ua=g;do{d.exec("");if(u=d.exec(Ua)){Ua=u[3];V.push(u[1]);if(u[2]){Y=
u[3];break}}}while(u);if(V.length>1&&A.exec(g))if(V.length===2&&p.relative[V[0]])D=xa(V[0]+V[1],i);else for(D=p.relative[V[0]]?[i]:l(V.shift(),i);V.length;){g=V.shift();if(p.relative[g])g+=V.shift();D=xa(g,D)}else{if(!q&&V.length>1&&i.nodeType===9&&!za&&p.match.ID.test(V[0])&&!p.match.ID.test(V[V.length-1])){u=l.find(V.shift(),i,za);i=u.expr?l.filter(u.expr,u.set)[0]:u.set[0]}if(i){u=q?{expr:V.pop(),set:P(q)}:l.find(V.pop(),V.length===1&&(V[0]==="~"||V[0]==="+")&&i.parentNode?i.parentNode:i,za);D=
u.expr?l.filter(u.expr,u.set):u.set;if(V.length>0)I=P(D);else ya=false;for(;V.length;){u=va=V.pop();if(p.relative[va])u=V.pop();else va="";if(u==null)u=i;p.relative[va](I,u,za)}}else I=[]}I||(I=D);I||l.error(va||g);if(f.call(I)==="[object Array]")if(ya)if(i&&i.nodeType===1)for(g=0;I[g]!=null;g++){if(I[g]&&(I[g]===true||I[g].nodeType===1&&l.contains(i,I[g])))o.push(D[g])}else for(g=0;I[g]!=null;g++)I[g]&&I[g].nodeType===1&&o.push(D[g]);else o.push.apply(o,I);else P(I,o);if(Y){l(Y,s,o,q);l.uniqueSort(o)}return o};
l.uniqueSort=function(g){if(C){h=m;g.sort(C);if(h)for(var i=1;i<g.length;i++)g[i]===g[i-1]&&g.splice(i--,1)}return g};l.matches=function(g,i){return l(g,null,null,i)};l.matchesSelector=function(g,i){return l(i,null,null,[g]).length>0};l.find=function(g,i,o){var q;if(!g)return[];for(var s=0,u=p.order.length;s<u;s++){var D,I=p.order[s];if(D=p.leftMatch[I].exec(g)){var Y=D[1];D.splice(1,1);if(Y.substr(Y.length-1)!=="\\"){D[1]=(D[1]||"").replace(/\\/g,"");q=p.find[I](D,i,o);if(q!=null){g=g.replace(p.match[I],
"");break}}}}q||(q=i.getElementsByTagName("*"));return{set:q,expr:g}};l.filter=function(g,i,o,q){for(var s,u,D=g,I=[],Y=i,va=i&&i[0]&&l.isXML(i[0]);g&&i.length;){for(var ya in p.filter)if((s=p.leftMatch[ya].exec(g))!=null&&s[2]){var za,V,Ua=p.filter[ya];V=s[1];u=false;s.splice(1,1);if(V.substr(V.length-1)!=="\\"){if(Y===I)I=[];if(p.preFilter[ya])if(s=p.preFilter[ya](s,Y,o,I,q,va)){if(s===true)continue}else u=za=true;if(s)for(var j=0;(V=Y[j])!=null;j++)if(V){za=Ua(V,s,j,Y);var t=q^!!za;if(o&&za!=null)if(t)u=
true;else Y[j]=false;else if(t){I.push(V);u=true}}if(za!==B){o||(Y=I);g=g.replace(p.match[ya],"");if(!u)return[];break}}}if(g===D)if(u==null)l.error(g);else break;D=g}return Y};l.error=function(g){throw"Syntax error, unrecognized expression: "+g;};var p=l.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,
TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+\-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(g){return g.getAttribute("href")}},relative:{"+":function(g,i){var o=typeof i==="string",q=o&&!/\W/.test(i);o=o&&!q;if(q)i=i.toLowerCase();q=0;for(var s=g.length,
u;q<s;q++)if(u=g[q]){for(;(u=u.previousSibling)&&u.nodeType!==1;);g[q]=o||u&&u.nodeName.toLowerCase()===i?u||false:u===i}o&&l.filter(i,g,true)},">":function(g,i){var o,q=typeof i==="string",s=0,u=g.length;if(q&&!/\W/.test(i))for(i=i.toLowerCase();s<u;s++){if(o=g[s]){o=o.parentNode;g[s]=o.nodeName.toLowerCase()===i?o:false}}else{for(;s<u;s++)if(o=g[s])g[s]=q?o.parentNode:o.parentNode===i;q&&l.filter(i,g,true)}},"":function(g,i,o){var q,s=e++,u=b;if(typeof i==="string"&&!/\W/.test(i)){q=i=i.toLowerCase();
u=a}u("parentNode",i,s,g,q,o)},"~":function(g,i,o){var q,s=e++,u=b;if(typeof i==="string"&&!/\W/.test(i)){q=i=i.toLowerCase();u=a}u("previousSibling",i,s,g,q,o)}},find:{ID:function(g,i,o){if(typeof i.getElementById!=="undefined"&&!o)return(g=i.getElementById(g[1]))&&g.parentNode?[g]:[]},NAME:function(g,i){if(typeof i.getElementsByName!=="undefined"){var o=[];i=i.getElementsByName(g[1]);for(var q=0,s=i.length;q<s;q++)i[q].getAttribute("name")===g[1]&&o.push(i[q]);return o.length===0?null:o}},TAG:function(g,
i){return i.getElementsByTagName(g[1])}},preFilter:{CLASS:function(g,i,o,q,s,u){g=" "+g[1].replace(/\\/g,"")+" ";if(u)return g;u=0;for(var D;(D=i[u])!=null;u++)if(D)if(s^(D.className&&(" "+D.className+" ").replace(/[\t\n]/g," ").indexOf(g)>=0))o||q.push(D);else if(o)i[u]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()},CHILD:function(g){if(g[1]==="nth"){var i=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&
"0n+"+g[2]||g[2]);g[2]=i[1]+(i[2]||1)-0;g[3]=i[3]-0}g[0]=e++;return g},ATTR:function(g,i,o,q,s,u){i=g[1].replace(/\\/g,"");if(!u&&p.attrMap[i])g[1]=p.attrMap[i];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,i,o,q,s){if(g[1]==="not")if((d.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=l(g[3],null,null,i);else{g=l.filter(g[3],i,o,true^s);o||q.push.apply(q,g);return false}else if(p.match.POS.test(g[0])||p.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},
filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled===true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,i,o){return!!l(o[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)},text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===
g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"===g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}},setFilters:{first:function(g,i){return i===0},last:function(g,i,o,q){return i===q.length-1},even:function(g,i){return i%2===
0},odd:function(g,i){return i%2===1},lt:function(g,i,o){return i<o[3]-0},gt:function(g,i,o){return i>o[3]-0},nth:function(g,i,o){return o[3]-0===i},eq:function(g,i,o){return o[3]-0===i}},filter:{PSEUDO:function(g,i,o,q){var s=i[1],u=p.filters[s];if(u)return u(g,o,i,q);else if(s==="contains")return(g.textContent||g.innerText||l.getText([g])||"").indexOf(i[3])>=0;else if(s==="not"){i=i[3];o=0;for(q=i.length;o<q;o++)if(i[o]===g)return false;return true}else l.error("Syntax error, unrecognized expression: "+
s)},CHILD:function(g,i){var o=i[1],q=g;switch(o){case "only":case "first":for(;q=q.previousSibling;)if(q.nodeType===1)return false;if(o==="first")return true;q=g;case "last":for(;q=q.nextSibling;)if(q.nodeType===1)return false;return true;case "nth":o=i[2];var s=i[3];if(o===1&&s===0)return true;i=i[0];var u=g.parentNode;if(u&&(u.sizcache!==i||!g.nodeIndex)){var D=0;for(q=u.firstChild;q;q=q.nextSibling)if(q.nodeType===1)q.nodeIndex=++D;u.sizcache=i}g=g.nodeIndex-s;return o===0?g===0:g%o===0&&g/o>=
0}},ID:function(g,i){return g.nodeType===1&&g.getAttribute("id")===i},TAG:function(g,i){return i==="*"&&g.nodeType===1||g.nodeName.toLowerCase()===i},CLASS:function(g,i){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(i)>-1},ATTR:function(g,i){var o=i[1];g=p.attrHandle[o]?p.attrHandle[o](g):g[o]!=null?g[o]:g.getAttribute(o);o=g+"";var q=i[2];i=i[4];return g==null?q==="!=":q==="="?o===i:q==="*="?o.indexOf(i)>=0:q==="~="?(" "+o+" ").indexOf(i)>=0:!i?o&&g!==false:q==="!="?o!==i:q==="^="?
o.indexOf(i)===0:q==="$="?o.substr(o.length-i.length)===i:q==="|="?o===i||o.substr(0,i.length+1)===i+"-":false},POS:function(g,i,o,q){var s=p.setFilters[i[2]];if(s)return s(g,o,i,q)}}},A=p.match.POS,v=function(g,i){return"\\"+(i-0+1)};for(var H in p.match){p.match[H]=new RegExp(p.match[H].source+/(?![^\[]*\])(?![^\(]*\))/.source);p.leftMatch[H]=new RegExp(/(^(?:.|\r|\n)*?)/.source+p.match[H].source.replace(/\\(\d+)/g,v))}var P=function(g,i){g=Array.prototype.slice.call(g,0);if(i){i.push.apply(i,g);
return i}return g};try{Array.prototype.slice.call(w.documentElement.childNodes,0)}catch(fa){P=function(g,i){var o=0;i=i||[];if(f.call(g)==="[object Array]")Array.prototype.push.apply(i,g);else if(typeof g.length==="number")for(var q=g.length;o<q;o++)i.push(g[o]);else for(;g[o];o++)i.push(g[o]);return i}}var C,da;if(w.documentElement.compareDocumentPosition)C=function(g,i){if(g===i){h=true;return 0}if(!g.compareDocumentPosition||!i.compareDocumentPosition)return g.compareDocumentPosition?-1:1;return g.compareDocumentPosition(i)&
4?-1:1};else{C=function(g,i){var o,q,s=[],u=[];o=g.parentNode;q=i.parentNode;var D=o;if(g===i){h=true;return 0}else if(o===q)return da(g,i);else if(o){if(!q)return 1}else return-1;for(;D;){s.unshift(D);D=D.parentNode}for(D=q;D;){u.unshift(D);D=D.parentNode}o=s.length;q=u.length;for(D=0;D<o&&D<q;D++)if(s[D]!==u[D])return da(s[D],u[D]);return D===o?da(g,u[D],-1):da(s[D],i,1)};da=function(g,i,o){if(g===i)return o;for(g=g.nextSibling;g;){if(g===i)return-1;g=g.nextSibling}return 1}}l.getText=function(g){for(var i=
"",o,q=0;g[q];q++){o=g[q];if(o.nodeType===3||o.nodeType===4)i+=o.nodeValue;else if(o.nodeType!==8)i+=l.getText(o.childNodes)}return i};(function(){var g=w.createElement("div"),i="script"+(new Date).getTime(),o=w.documentElement;g.innerHTML="<a name='"+i+"'/>";o.insertBefore(g,o.firstChild);if(w.getElementById(i)){p.find.ID=function(q,s,u){if(typeof s.getElementById!=="undefined"&&!u)return(s=s.getElementById(q[1]))?s.id===q[1]||typeof s.getAttributeNode!=="undefined"&&s.getAttributeNode("id").nodeValue===
q[1]?[s]:B:[]};p.filter.ID=function(q,s){var u=typeof q.getAttributeNode!=="undefined"&&q.getAttributeNode("id");return q.nodeType===1&&u&&u.nodeValue===s}}o.removeChild(g);o=g=null})();(function(){var g=w.createElement("div");g.appendChild(w.createComment(""));if(g.getElementsByTagName("*").length>0)p.find.TAG=function(i,o){o=o.getElementsByTagName(i[1]);if(i[1]==="*"){i=[];for(var q=0;o[q];q++)o[q].nodeType===1&&i.push(o[q]);o=i}return o};g.innerHTML="<a href='#'></a>";if(g.firstChild&&typeof g.firstChild.getAttribute!==
"undefined"&&g.firstChild.getAttribute("href")!=="#")p.attrHandle.href=function(i){return i.getAttribute("href",2)};g=null})();w.querySelectorAll&&function(){var g=l,i=w.createElement("div");i.innerHTML="<p class='TEST'></p>";if(!(i.querySelectorAll&&i.querySelectorAll(".TEST").length===0)){l=function(q,s,u,D){s=s||w;q=q.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!D&&!l.isXML(s))if(s.nodeType===9)try{return P(s.querySelectorAll(q),u)}catch(I){}else if(s.nodeType===1&&s.nodeName.toLowerCase()!==
"object"){var Y=s.getAttribute("id"),va=Y||"__sizzle__";Y||s.setAttribute("id",va);try{return P(s.querySelectorAll("#"+va+" "+q),u)}catch(ya){}finally{Y||s.removeAttribute("id")}}return g(q,s,u,D)};for(var o in g)l[o]=g[o];i=null}}();(function(){var g=w.documentElement,i=g.matchesSelector||g.mozMatchesSelector||g.webkitMatchesSelector||g.msMatchesSelector,o=false;try{i.call(w.documentElement,"[test!='']:sizzle")}catch(q){o=true}if(i)l.matchesSelector=function(s,u){u=u.replace(/\=\s*([^'"\]]*)\s*\]/g,
"='$1']");if(!l.isXML(s))try{if(o||!p.match.PSEUDO.test(u)&&!/!=/.test(u))return i.call(s,u)}catch(D){}return l(u,null,null,[s]).length>0}})();(function(){var g=w.createElement("div");g.innerHTML="<div class='test e'></div><div class='test'></div>";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){p.order.splice(1,0,"CLASS");p.find.CLASS=function(i,o,q){if(typeof o.getElementsByClassName!=="undefined"&&
!q)return o.getElementsByClassName(i[1])};g=null}}})();l.contains=w.documentElement.contains?function(g,i){return g!==i&&(g.contains?g.contains(i):true)}:w.documentElement.compareDocumentPosition?function(g,i){return!!(g.compareDocumentPosition(i)&16)}:function(){return false};l.isXML=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false};var xa=function(g,i){var o,q=[],s="";for(i=i.nodeType?[i]:i;o=p.match.PSEUDO.exec(g);){s+=o[0];g=g.replace(p.match.PSEUDO,"")}g=
p.relative[g]?g+"*":g;o=0;for(var u=i.length;o<u;o++)l(g,i[o],q);return l.filter(s,q)};c.find=l;c.expr=l.selectors;c.expr[":"]=c.expr.filters;c.unique=l.uniqueSort;c.text=l.getText;c.isXMLDoc=l.isXML;c.contains=l.contains})();var Va=/Until$/,eb=/^(?:parents|prevUntil|prevAll)/,nb=/,/,fb=/^.[^:#\[\.,]*$/,$a=Array.prototype.slice,gb=c.expr.match.POS;c.fn.extend({find:function(a){for(var b=this.pushStack("","find",a),d=0,e=0,f=this.length;e<f;e++){d=b.length;c.find(a,this[e],b);if(e>0)for(var h=d;h<
b.length;h++)for(var m=0;m<d;m++)if(b[m]===b[h]){b.splice(h--,1);break}}return b},has:function(a){var b=c(a);return this.filter(function(){for(var d=0,e=b.length;d<e;d++)if(c.contains(this,b[d]))return true})},not:function(a){return this.pushStack(ia(this,a,false),"not",a)},filter:function(a){return this.pushStack(ia(this,a,true),"filter",a)},is:function(a){return!!a&&c.filter(a,this).length>0},closest:function(a,b){var d=[],e,f,h=this[0];if(c.isArray(a)){var m,l={},p=1;if(h&&a.length){e=0;for(f=
a.length;e<f;e++){m=a[e];l[m]||(l[m]=c.expr.match.POS.test(m)?c(m,b||this.context):m)}for(;h&&h.ownerDocument&&h!==b;){for(m in l){a=l[m];if(a.jquery?a.index(h)>-1:c(h).is(a))d.push({selector:m,elem:h,level:p})}h=h.parentNode;p++}}return d}m=gb.test(a)?c(a,b||this.context):null;e=0;for(f=this.length;e<f;e++)for(h=this[e];h;)if(m?m.index(h)>-1:c.find.matchesSelector(h,a)){d.push(h);break}else{h=h.parentNode;if(!h||!h.ownerDocument||h===b)break}d=d.length>1?c.unique(d):d;return this.pushStack(d,"closest",
a)},index:function(a){if(!a||typeof a==="string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){a=typeof a==="string"?c(a,b||this.context):c.makeArray(a);b=c.merge(this.get(),a);return this.pushStack(W(a[0])||W(b[0])?b:c.unique(b))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,
b,d){return c.dir(a,"parentNode",d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,
"iframe")?a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,b){c.fn[a]=function(d,e){var f=c.map(this,b,d);Va.test(a)||(e=d);if(e&&typeof e==="string")f=c.filter(e,f);f=this.length>1?c.unique(f):f;if((this.length>1||nb.test(e))&&eb.test(a))f=f.reverse();return this.pushStack(f,a,$a.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return b.length===1?c.find.matchesSelector(b[0],a)?[b[0]]:[]:c.find.matches(a,b)},dir:function(a,b,d){var e=
[];for(a=a[b];a&&a.nodeType!==9&&(d===B||a.nodeType!==1||!c(a).is(d));){a.nodeType===1&&e.push(a);a=a[b]}return e},nth:function(a,b,d){b=b||1;for(var e=0;a;a=a[d])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var Na=/ jQuery\d+="(?:\d+|null)"/g,Pa=/^\s+/,bb=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Wa=/<([\w:]+)/,ib=/<tbody/i,qb=/<|&#?\w+;/,J=/<(?:script|object|embed|option|style)/i,
Ja=/checked\s*(?:[^=]|=\s*.checked.)/i,na=/\=([^="'>\s]+\/)>/g,ka={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,"",""]};ka.optgroup=ka.option;ka.tbody=ka.tfoot=ka.colgroup=ka.caption=ka.thead;ka.th=ka.td;if(!c.support.htmlSerialize)ka._default=
[1,"div<div>","</div>"];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d=c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==B)return this.empty().append((this[0]&&this[0].ownerDocument||w).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=
this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this},wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,
true,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,
false,function(b){this.parentNode.insertBefore(b,this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},remove:function(a,b){for(var d=0,e;(e=this[d])!=null;d++)if(!a||c.filter(a,[e]).length){if(!b&&e.nodeType===1){c.cleanData(e.getElementsByTagName("*"));c.cleanData([e])}e.parentNode&&e.parentNode.removeChild(e)}return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++)for(b.nodeType===1&&c.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild);
return this},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var d=this.outerHTML,e=this.ownerDocument;if(!d){d=e.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(Na,"").replace(na,'="$1">').replace(Pa,"")],e)[0]}else return this.cloneNode(true)});if(a===true){Z(this,b);Z(this.find("*"),b.find("*"))}return b},html:function(a){if(a===B)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Na,""):null;
else if(typeof a==="string"&&!J.test(a)&&(c.support.leadingWhitespace||!Pa.test(a))&&!ka[(Wa.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(bb,"<$1></$2>");try{for(var b=0,d=this.length;b<d;b++)if(this[b].nodeType===1){c.cleanData(this[b].getElementsByTagName("*"));this[b].innerHTML=a}}catch(e){this.empty().append(a)}}else c.isFunction(a)?this.each(function(f){var h=c(this);h.html(a.call(this,f,h.html()))}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(c.isFunction(a))return this.each(function(b){var d=
c(this),e=d.html();d.replaceWith(a.call(this,b,e))});if(typeof a!=="string")a=c(a).detach();return this.each(function(){var b=this.nextSibling,d=this.parentNode;c(this).remove();b?c(b).before(a):c(d).append(a)})}else return this.pushStack(c(c.isFunction(a)?a():a),"replaceWith",a)},detach:function(a){return this.remove(a,true)},domManip:function(a,b,d){var e,f,h,m=a[0],l=[];if(!c.support.checkClone&&arguments.length===3&&typeof m==="string"&&Ja.test(m))return this.each(function(){c(this).domManip(a,
b,d,true)});if(c.isFunction(m))return this.each(function(v){var H=c(this);a[0]=m.call(this,v,b?H.html():B);H.domManip(a,b,d)});if(this[0]){e=m&&m.parentNode;e=c.support.parentNode&&e&&e.nodeType===11&&e.childNodes.length===this.length?{fragment:e}:c.buildFragment(a,this,l);h=e.fragment;if(f=h.childNodes.length===1?(h=h.firstChild):h.firstChild){b=b&&c.nodeName(f,"tr");for(var p=0,A=this.length;p<A;p++)d.call(b?ma(this[p],f):this[p],p>0||e.cacheable||this.length>1?h.cloneNode(true):h)}l.length&&c.each(l,
pa)}return this}});c.buildFragment=function(a,b,d){var e,f,h;b=b&&b[0]?b[0].ownerDocument||b[0]:w;if(a.length===1&&typeof a[0]==="string"&&a[0].length<512&&b===w&&!J.test(a[0])&&(c.support.checkClone||!Ja.test(a[0]))){f=true;if(h=c.fragments[a[0]])if(h!==1)e=h}if(!e){e=b.createDocumentFragment();c.clean(a,b,e,d)}if(f)c.fragments[a[0]]=h?e:1;return{fragment:e,cacheable:f}};c.fragments={};c.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},
function(a,b){c.fn[a]=function(d){var e=[];d=c(d);var f=this.length===1&&this[0].parentNode;if(f&&f.nodeType===11&&f.childNodes.length===1&&d.length===1){d[b](this[0]);return this}else{f=0;for(var h=d.length;f<h;f++){var m=(f>0?this.clone(true):this).get();c(d[f])[b](m);e=e.concat(m)}return this.pushStack(e,a,d.selector)}}});c.extend({clean:function(a,b,d,e){b=b||w;if(typeof b.createElement==="undefined")b=b.ownerDocument||b[0]&&b[0].ownerDocument||w;for(var f=[],h=0,m;(m=a[h])!=null;h++){if(typeof m===
"number")m+="";if(m){if(typeof m==="string"&&!qb.test(m))m=b.createTextNode(m);else if(typeof m==="string"){m=m.replace(bb,"<$1></$2>");var l=(Wa.exec(m)||["",""])[1].toLowerCase(),p=ka[l]||ka._default,A=p[0],v=b.createElement("div");for(v.innerHTML=p[1]+m+p[2];A--;)v=v.lastChild;if(!c.support.tbody){A=ib.test(m);l=l==="table"&&!A?v.firstChild&&v.firstChild.childNodes:p[1]==="<table>"&&!A?v.childNodes:[];for(p=l.length-1;p>=0;--p)c.nodeName(l[p],"tbody")&&!l[p].childNodes.length&&l[p].parentNode.removeChild(l[p])}!c.support.leadingWhitespace&&
Pa.test(m)&&v.insertBefore(b.createTextNode(Pa.exec(m)[0]),v.firstChild);m=v.childNodes}if(m.nodeType)f.push(m);else f=c.merge(f,m)}}if(d)for(h=0;f[h];h++)if(e&&c.nodeName(f[h],"script")&&(!f[h].type||f[h].type.toLowerCase()==="text/javascript"))e.push(f[h].parentNode?f[h].parentNode.removeChild(f[h]):f[h]);else{f[h].nodeType===1&&f.splice.apply(f,[h+1,0].concat(c.makeArray(f[h].getElementsByTagName("script"))));d.appendChild(f[h])}return f},cleanData:function(a){for(var b,d,e=c.cache,f=c.event.special,
h=c.support.deleteExpando,m=0,l;(l=a[m])!=null;m++)if(!(l.nodeName&&c.noData[l.nodeName.toLowerCase()]))if(d=l[c.expando]){if((b=e[d])&&b.events)for(var p in b.events)f[p]?c.event.remove(l,p):c.removeEvent(l,p,b.handle);if(h)delete l[c.expando];else l.removeAttribute&&l.removeAttribute(c.expando);delete e[d]}}});var Ca=/alpha\([^)]*\)/i,Za=/opacity=([^)]*)/,ea=/-([a-z])/ig,ta=/([A-Z])/g,Fa=/^-?\d+(?:px)?$/i,ab=/^-?\d/,ob={position:"absolute",visibility:"hidden",display:"block"},sa=["Left","Right"],
Ma=["Top","Bottom"],Da,Xa,Ha,k=function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){if(arguments.length===2&&b===B)return this;return c.access(this,a,b,true,function(d,e,f){return f!==B?c.style(d,e,f):c.css(d,e)})};c.extend({cssHooks:{opacity:{get:function(a,b){if(b){a=Da(a,"opacity","opacity");return a===""?"1":a}else return a.style.opacity}}},cssNumber:{zIndex:true,fontWeight:true,opacity:true,zoom:true,lineHeight:true},cssProps:{"float":c.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,
b,d,e){if(!(!a||a.nodeType===3||a.nodeType===8||!a.style)){var f,h=c.camelCase(b),m=a.style,l=c.cssHooks[h];b=c.cssProps[h]||h;if(d!==B){if(!(typeof d==="number"&&isNaN(d)||d==null)){if(typeof d==="number"&&!c.cssNumber[h])d+="px";if(!l||!("set"in l)||(d=l.set(a,d))!==B)try{m[b]=d}catch(p){}}}else{if(l&&"get"in l&&(f=l.get(a,false,e))!==B)return f;return m[b]}}},css:function(a,b,d){var e,f=c.camelCase(b),h=c.cssHooks[f];b=c.cssProps[f]||f;if(h&&"get"in h&&(e=h.get(a,true,d))!==B)return e;else if(Da)return Da(a,
b,f)},swap:function(a,b,d){var e={};for(var f in b){e[f]=a.style[f];a.style[f]=b[f]}d.call(a);for(f in b)a.style[f]=e[f]},camelCase:function(a){return a.replace(ea,k)}});c.curCSS=c.css;c.each(["height","width"],function(a,b){c.cssHooks[b]={get:function(d,e,f){var h;if(e){if(d.offsetWidth!==0)h=Qa(d,b,f);else c.swap(d,ob,function(){h=Qa(d,b,f)});if(h<=0){h=Da(d,b,b);if(h==="0px"&&Ha)h=Ha(d,b,b);if(h!=null)return h===""||h==="auto"?"0px":h}if(h<0||h==null){h=d.style[b];return h===""||h==="auto"?"0px":
h}return typeof h==="string"?h:h+"px"}},set:function(d,e){if(Fa.test(e)){e=parseFloat(e);if(e>=0)return e+"px"}else return e}}});if(!c.support.opacity)c.cssHooks.opacity={get:function(a,b){return Za.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){a=a.style;a.zoom=1;b=c.isNaN(b)?"":"alpha(opacity="+b*100+")";var d=a.filter||"";a.filter=Ca.test(d)?d.replace(Ca,b):a.filter+" "+b}};if(w.defaultView&&w.defaultView.getComputedStyle)Xa=
function(a,b,d){var e;d=d.replace(ta,"-$1").toLowerCase();if(!(b=a.ownerDocument.defaultView))return B;if(b=b.getComputedStyle(a,null)){e=b.getPropertyValue(d);if(e===""&&!c.contains(a.ownerDocument.documentElement,a))e=c.style(a,d)}return e};if(w.documentElement.currentStyle)Ha=function(a,b){var d,e,f=a.currentStyle&&a.currentStyle[b],h=a.style;if(!Fa.test(f)&&ab.test(f)){d=h.left;e=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;h.left=b==="fontSize"?"1em":f||0;f=h.pixelLeft+"px";h.left=
d;a.runtimeStyle.left=e}return f===""?"auto":f};Da=Xa||Ha;if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b=a.offsetHeight;return a.offsetWidth===0&&b===0||!c.support.reliableHiddenOffsets&&(a.style.display||c.css(a,"display"))==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var n=c.now(),r=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,x=/^(?:select|textarea)/i,G=/^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,
S=/^(?:GET|HEAD)$/,ca=/\[\]$/,R=/\=\?(&|$)/,oa=/\?/,la=/([?&])_=[^&]*/,hb=/^(\w+:)?\/\/([^\/?#]+)/,pb=/%20/g,wb=/#.*$/,ub=c.fn.load;c.fn.extend({load:function(a,b,d){if(typeof a!=="string"&&ub)return ub.apply(this,arguments);else if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var f=a.slice(e,a.length);a=a.slice(0,e)}e="GET";if(b)if(c.isFunction(b)){d=b;b=null}else if(typeof b==="object"){b=c.param(b,c.ajaxSettings.traditional);e="POST"}var h=this;c.ajax({url:a,type:e,dataType:"html",data:b,
complete:function(m,l){if(l==="success"||l==="notmodified")h.html(f?c("<div>").append(m.responseText.replace(r,"")).find(f):m.responseText);d&&h.each(d,[m.responseText,l,m])}});return this},serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?c.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||x.test(this.nodeName)||G.test(this.type))}).map(function(a,b){a=c(this).val();
return a==null?null:c.isArray(a)?c.map(a,function(d){return{name:b.name,value:d}}):{name:b.name,value:a}}).get()}});c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){c.fn[b]=function(d){return this.bind(b,d)}});c.extend({get:function(a,b,d,e){if(c.isFunction(b)){e=e||d;d=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:d,dataType:e})},getScript:function(a,b){return c.get(a,null,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")},post:function(a,
b,d,e){if(c.isFunction(b)){e=e||d;d=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:d,dataType:e})},ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return new Q.XMLHttpRequest},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},
ajax:function(a){var b=c.extend(true,{},c.ajaxSettings,a),d,e,f,h=b.type.toUpperCase(),m=S.test(h);b.url=b.url.replace(wb,"");b.context=a&&a.context!=null?a.context:b;if(b.data&&b.processData&&typeof b.data!=="string")b.data=c.param(b.data,b.traditional);if(b.dataType==="jsonp"){if(h==="GET")R.test(b.url)||(b.url+=(oa.test(b.url)?"&":"?")+(b.jsonp||"callback")+"=?");else if(!b.data||!R.test(b.data))b.data=(b.data?b.data+"&":"")+(b.jsonp||"callback")+"=?";b.dataType="json"}if(b.dataType==="json"&&
(b.data&&R.test(b.data)||R.test(b.url))){d=b.jsonpCallback||"jsonp"+n++;if(b.data)b.data=(b.data+"").replace(R,"="+d+"$1");b.url=b.url.replace(R,"="+d+"$1");b.dataType="script";var l=Q[d];Q[d]=function(q){if(c.isFunction(l))l(q);else{Q[d]=B;try{delete Q[d]}catch(s){}}f=q;c.handleSuccess(b,C,e,f);c.handleComplete(b,C,e,f);v&&v.removeChild(H)}}if(b.dataType==="script"&&b.cache===null)b.cache=false;if(b.cache===false&&m){var p=c.now(),A=b.url.replace(la,"$1_="+p);b.url=A+(A===b.url?(oa.test(b.url)?"&":
"?")+"_="+p:"")}if(b.data&&m)b.url+=(oa.test(b.url)?"&":"?")+b.data;b.global&&c.active++===0&&c.event.trigger("ajaxStart");p=(p=hb.exec(b.url))&&(p[1]&&p[1].toLowerCase()!==location.protocol||p[2].toLowerCase()!==location.host);if(b.dataType==="script"&&h==="GET"&&p){var v=w.getElementsByTagName("head")[0]||w.documentElement,H=w.createElement("script");if(b.scriptCharset)H.charset=b.scriptCharset;H.src=b.url;if(!d){var P=false;H.onload=H.onreadystatechange=function(){if(!P&&(!this.readyState||this.readyState===
"loaded"||this.readyState==="complete")){P=true;c.handleSuccess(b,C,e,f);c.handleComplete(b,C,e,f);H.onload=H.onreadystatechange=null;v&&H.parentNode&&v.removeChild(H)}}}v.insertBefore(H,v.firstChild);return B}var fa=false,C=b.xhr();if(C){b.username?C.open(h,b.url,b.async,b.username,b.password):C.open(h,b.url,b.async);try{if(b.data!=null&&!m||a&&a.contentType)C.setRequestHeader("Content-Type",b.contentType);if(b.ifModified){c.lastModified[b.url]&&C.setRequestHeader("If-Modified-Since",c.lastModified[b.url]);
c.etag[b.url]&&C.setRequestHeader("If-None-Match",c.etag[b.url])}p||C.setRequestHeader("X-Requested-With","XMLHttpRequest");C.setRequestHeader("Accept",b.dataType&&b.accepts[b.dataType]?b.accepts[b.dataType]+", */*; q=0.01":b.accepts._default)}catch(da){}if(b.beforeSend&&b.beforeSend.call(b.context,C,b)===false){b.global&&c.active--===1&&c.event.trigger("ajaxStop");C.abort();return false}b.global&&c.triggerGlobal(b,"ajaxSend",[C,b]);var xa=C.onreadystatechange=function(q){if(!C||C.readyState===0||
q==="abort"){fa||c.handleComplete(b,C,e,f);fa=true;if(C)C.onreadystatechange=c.noop}else if(!fa&&C&&(C.readyState===4||q==="timeout")){fa=true;C.onreadystatechange=c.noop;e=q==="timeout"?"timeout":!c.httpSuccess(C)?"error":b.ifModified&&c.httpNotModified(C,b.url)?"notmodified":"success";var s;if(e==="success")try{f=c.httpData(C,b.dataType,b)}catch(u){e="parsererror";s=u}if(e==="success"||e==="notmodified")d||c.handleSuccess(b,C,e,f);else c.handleError(b,C,e,s);d||c.handleComplete(b,C,e,f);q==="timeout"&&
C.abort();if(b.async)C=null}};try{var g=C.abort;C.abort=function(){C&&Function.prototype.call.call(g,C);xa("abort")}}catch(i){}b.async&&b.timeout>0&&setTimeout(function(){C&&!fa&&xa("timeout")},b.timeout);try{C.send(m||b.data==null?null:b.data)}catch(o){c.handleError(b,C,null,o);c.handleComplete(b,C,e,f)}b.async||xa();return C}},param:function(a,b){var d=[],e=function(h,m){m=c.isFunction(m)?m():m;d[d.length]=encodeURIComponent(h)+"="+encodeURIComponent(m)};if(b===B)b=c.ajaxSettings.traditional;if(c.isArray(a)||
a.jquery)c.each(a,function(){e(this.name,this.value)});else for(var f in a)ja(f,a[f],b,e);return d.join("&").replace(pb,"+")}});c.extend({active:0,lastModified:{},etag:{},handleError:function(a,b,d,e){a.error&&a.error.call(a.context,b,d,e);a.global&&c.triggerGlobal(a,"ajaxError",[b,a,e])},handleSuccess:function(a,b,d,e){a.success&&a.success.call(a.context,e,d,b);a.global&&c.triggerGlobal(a,"ajaxSuccess",[b,a])},handleComplete:function(a,b,d){a.complete&&a.complete.call(a.context,b,d);a.global&&c.triggerGlobal(a,
"ajaxComplete",[b,a]);a.global&&c.active--===1&&c.event.trigger("ajaxStop")},triggerGlobal:function(a,b,d){(a.context&&a.context.url==null?c(a.context):c.event).trigger(b,d)},httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status===1223}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"),e=a.getResponseHeader("Etag");if(d)c.lastModified[b]=d;if(e)c.etag[b]=e;return a.status===304},
httpData:function(a,b,d){var e=a.getResponseHeader("content-type")||"",f=b==="xml"||!b&&e.indexOf("xml")>=0;a=f?a.responseXML:a.responseText;f&&a.documentElement.nodeName==="parsererror"&&c.error("parsererror");if(d&&d.dataFilter)a=d.dataFilter(a,b);if(typeof a==="string")if(b==="json"||!b&&e.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&e.indexOf("javascript")>=0)c.globalEval(a);return a}});if(Q.ActiveXObject)c.ajaxSettings.xhr=function(){if(Q.location.protocol!=="file:")try{return new Q.XMLHttpRequest}catch(a){}try{return new Q.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}};
c.support.ajax=!!c.ajaxSettings.xhr();var rb={},xb=/^(?:toggle|show|hide)$/,yb=/^([+\-]=)?([\d+.\-]+)(.*)$/,lb,tb=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b,d){if(a||a===0)return this.animate(qa("show",3),a,b,d);else{d=0;for(var e=this.length;d<e;d++){a=this[d];b=a.style.display;if(!c.data(a,"olddisplay")&&b==="none")b=a.style.display="";b===""&&c.css(a,"display")===
"none"&&c.data(a,"olddisplay",Ea(a.nodeName))}for(d=0;d<e;d++){a=this[d];b=a.style.display;if(b===""||b==="none")a.style.display=c.data(a,"olddisplay")||""}return this}},hide:function(a,b,d){if(a||a===0)return this.animate(qa("hide",3),a,b,d);else{a=0;for(b=this.length;a<b;a++){d=c.css(this[a],"display");d!=="none"&&c.data(this[a],"olddisplay",d)}for(a=0;a<b;a++)this[a].style.display="none";return this}},_toggle:c.fn.toggle,toggle:function(a,b,d){var e=typeof a==="boolean";if(c.isFunction(a)&&c.isFunction(b))this._toggle.apply(this,
arguments);else a==null||e?this.each(function(){var f=e?a:c(this).is(":hidden");c(this)[f?"show":"hide"]()}):this.animate(qa("toggle",3),a,b,d);return this},fadeTo:function(a,b,d,e){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,d,e)},animate:function(a,b,d,e){var f=c.speed(b,d,e);if(c.isEmptyObject(a))return this.each(f.complete);return this[f.queue===false?"each":"queue"](function(){var h=c.extend({},f),m,l=this.nodeType===1,p=l&&c(this).is(":hidden"),A=this;for(m in a){var v=
c.camelCase(m);if(m!==v){a[v]=a[m];delete a[m];m=v}if(a[m]==="hide"&&p||a[m]==="show"&&!p)return h.complete.call(this);if(l&&(m==="height"||m==="width")){h.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY];if(c.css(this,"display")==="inline"&&c.css(this,"float")==="none")if(c.support.inlineBlockNeedsLayout)if(Ea(this.nodeName)==="inline")this.style.display="inline-block";else{this.style.display="inline";this.style.zoom=1}else this.style.display="inline-block"}if(c.isArray(a[m])){(h.specialEasing=
h.specialEasing||{})[m]=a[m][1];a[m]=a[m][0]}}if(h.overflow!=null)this.style.overflow="hidden";h.curAnim=c.extend({},a);c.each(a,function(H,P){var fa=new c.fx(A,h,H);if(xb.test(P))fa[P==="toggle"?p?"show":"hide":P](a);else{var C=yb.exec(P),da=fa.cur()||0;if(C){P=parseFloat(C[2]);var xa=C[3]||"px";if(xa!=="px"){c.style(A,H,(P||1)+xa);da=(P||1)/fa.cur()*da;c.style(A,H,da+xa)}if(C[1])P=(C[1]==="-="?-1:1)*P+da;fa.custom(da,P,xa)}else fa.custom(da,P,"")}});return true})},stop:function(a,b){var d=c.timers;
a&&this.queue([]);this.each(function(){for(var e=d.length-1;e>=0;e--)if(d[e].elem===this){b&&d[e](true);d.splice(e,1)}});b||this.dequeue();return this}});c.each({slideDown:qa("show",1),slideUp:qa("hide",1),slideToggle:qa("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){c.fn[a]=function(d,e,f){return this.animate(b,d,e,f)}});c.extend({speed:function(a,b,d){var e=a&&typeof a==="object"?c.extend({},a):{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,
easing:d&&b||b&&!c.isFunction(b)&&b};e.duration=c.fx.off?0:typeof e.duration==="number"?e.duration:e.duration in c.fx.speeds?c.fx.speeds[e.duration]:c.fx.speeds._default;e.old=e.complete;e.complete=function(){e.queue!==false&&c(this).dequeue();c.isFunction(e.old)&&e.old.call(this)};return e},easing:{linear:function(a,b,d,e){return d+e*a},swing:function(a,b,d,e){return(-Math.cos(a*Math.PI)/2+0.5)*e+d}},timers:[],fx:function(a,b,d){this.options=b;this.elem=a;this.prop=d;if(!b.orig)b.orig={}}});c.fx.prototype=
{update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(c.fx.step[this.prop]||c.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a=parseFloat(c.css(this.elem,this.prop));return a&&a>-10000?a:0},custom:function(a,b,d){function e(m){return f.step(m)}var f=this,h=c.fx;this.startTime=c.now();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start;this.pos=
this.state=0;e.elem=this.elem;if(e()&&c.timers.push(e)&&!lb)lb=setInterval(h.tick,h.interval)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(a){var b=c.now(),d=true;if(a||b>=this.options.duration+this.startTime){this.now=
this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var e in this.options.curAnim)if(this.options.curAnim[e]!==true)d=false;if(d){if(this.options.overflow!=null&&!c.support.shrinkWrapBlocks){var f=this.elem,h=this.options;c.each(["","X","Y"],function(l,p){f.style["overflow"+p]=h.overflow[l]})}this.options.hide&&c(this.elem).hide();if(this.options.hide||this.options.show)for(var m in this.options.curAnim)c.style(this.elem,m,this.options.orig[m]);this.options.complete.call(this.elem)}return false}else{a=
b-this.startTime;this.state=a/this.options.duration;b=this.options.easing||(c.easing.swing?"swing":"linear");this.pos=c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||b](this.state,a,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a=c.timers,b=0;b<a.length;b++)a[b]()||a.splice(b--,1);a.length||c.fx.stop()},interval:13,stop:function(){clearInterval(lb);lb=null},speeds:{slow:600,
fast:200,_default:400},step:{opacity:function(a){c.style(a.elem,"opacity",a.now)},_default:function(a){if(a.elem.style&&a.elem.style[a.prop]!=null)a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit;else a.elem[a.prop]=a.now}}});if(c.expr&&c.expr.filters)c.expr.filters.animated=function(a){return c.grep(c.timers,function(b){return a===b.elem}).length};var zb=/^t(?:able|d|h)$/i,vb=/^(?:body|html)$/i;c.fn.offset="getBoundingClientRect"in w.documentElement?function(a){var b=
this[0],d;if(a)return this.each(function(m){c.offset.setOffset(this,a,m)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);try{d=b.getBoundingClientRect()}catch(e){}var f=b.ownerDocument,h=f.documentElement;if(!d||!c.contains(h,b))return d||{top:0,left:0};b=f.body;f=Ia(f);return{top:d.top+(f.pageYOffset||c.support.boxModel&&h.scrollTop||b.scrollTop)-(h.clientTop||b.clientTop||0),left:d.left+(f.pageXOffset||c.support.boxModel&&h.scrollLeft||b.scrollLeft)-
(h.clientLeft||b.clientLeft||0)}}:function(a){var b=this[0];if(a)return this.each(function(v){c.offset.setOffset(this,a,v)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);c.offset.initialize();var d,e=b.offsetParent,f=b,h=b.ownerDocument,m=h.documentElement,l=h.body;d=(h=h.defaultView)?h.getComputedStyle(b,null):b.currentStyle;for(var p=b.offsetTop,A=b.offsetLeft;(b=b.parentNode)&&b!==l&&b!==m;){if(c.offset.supportsFixedPosition&&d.position==="fixed")break;
d=h?h.getComputedStyle(b,null):b.currentStyle;p-=b.scrollTop;A-=b.scrollLeft;if(b===e){p+=b.offsetTop;A+=b.offsetLeft;if(c.offset.doesNotAddBorder&&!(c.offset.doesAddBorderForTableAndCells&&zb.test(b.nodeName))){p+=parseFloat(d.borderTopWidth)||0;A+=parseFloat(d.borderLeftWidth)||0}f=e;e=b.offsetParent}if(c.offset.subtractsBorderForOverflowNotVisible&&d.overflow!=="visible"){p+=parseFloat(d.borderTopWidth)||0;A+=parseFloat(d.borderLeftWidth)||0}d=d}if(d.position==="relative"||d.position==="static"){p+=
l.offsetTop;A+=l.offsetLeft}if(c.offset.supportsFixedPosition&&d.position==="fixed"){p+=Math.max(m.scrollTop,l.scrollTop);A+=Math.max(m.scrollLeft,l.scrollLeft)}return{top:p,left:A}};c.offset={initialize:function(){var a=w.body,b=w.createElement("div"),d,e,f,h=parseFloat(c.css(a,"marginTop"))||0;c.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"});b.innerHTML="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";
a.insertBefore(b,a.firstChild);d=b.firstChild;e=d.firstChild;f=d.nextSibling.firstChild.firstChild;this.doesNotAddBorder=e.offsetTop!==5;this.doesAddBorderForTableAndCells=f.offsetTop===5;e.style.position="fixed";e.style.top="20px";this.supportsFixedPosition=e.offsetTop===20||e.offsetTop===15;e.style.position=e.style.top="";d.style.overflow="hidden";d.style.position="relative";this.subtractsBorderForOverflowNotVisible=e.offsetTop===-5;this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==h;a.removeChild(b);
c.offset.initialize=c.noop},bodyOffset:function(a){var b=a.offsetTop,d=a.offsetLeft;c.offset.initialize();if(c.offset.doesNotIncludeMarginInBodyOffset){b+=parseFloat(c.css(a,"marginTop"))||0;d+=parseFloat(c.css(a,"marginLeft"))||0}return{top:b,left:d}},setOffset:function(a,b,d){var e=c.css(a,"position");if(e==="static")a.style.position="relative";var f=c(a),h=f.offset(),m=c.css(a,"top"),l=c.css(a,"left"),p=e==="absolute"&&c.inArray("auto",[m,l])>-1;e={};var A={};if(p)A=f.position();m=p?A.top:parseInt(m,
10)||0;l=p?A.left:parseInt(l,10)||0;if(c.isFunction(b))b=b.call(a,d,h);if(b.top!=null)e.top=b.top-h.top+m;if(b.left!=null)e.left=b.left-h.left+l;"using"in b?b.using.call(a,e):f.css(e)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),e=vb.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.css(a,"marginTop"))||0;d.left-=parseFloat(c.css(a,"marginLeft"))||0;e.top+=parseFloat(c.css(b[0],"borderTopWidth"))||0;e.left+=parseFloat(c.css(b[0],
"borderLeftWidth"))||0;return{top:d.top-e.top,left:d.left-e.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||w.body;a&&!vb.test(a.nodeName)&&c.css(a,"position")==="static";)a=a.offsetParent;return a})}});c.each(["Left","Top"],function(a,b){var d="scroll"+b;c.fn[d]=function(e){var f=this[0],h;if(!f)return null;if(e!==B)return this.each(function(){if(h=Ia(this))h.scrollTo(!a?e:c(h).scrollLeft(),a?e:c(h).scrollTop());else this[d]=e});else return(h=Ia(f))?"pageXOffset"in
h?h[a?"pageYOffset":"pageXOffset"]:c.support.boxModel&&h.document.documentElement[d]||h.document.body[d]:f[d]}});c.each(["Height","Width"],function(a,b){var d=b.toLowerCase();c.fn["inner"+b]=function(){return this[0]?parseFloat(c.css(this[0],d,"padding")):null};c.fn["outer"+b]=function(e){return this[0]?parseFloat(c.css(this[0],d,e?"margin":"border")):null};c.fn[d]=function(e){var f=this[0];if(!f)return e==null?null:this;if(c.isFunction(e))return this.each(function(m){var l=c(this);l[d](e.call(this,
m,l[d]()))});if(c.isWindow(f))return f.document.compatMode==="CSS1Compat"&&f.document.documentElement["client"+b]||f.document.body["client"+b];else if(f.nodeType===9)return Math.max(f.documentElement["client"+b],f.body["scroll"+b],f.documentElement["scroll"+b],f.body["offset"+b],f.documentElement["offset"+b]);else if(e===B){f=c.css(f,d);var h=parseFloat(f);return c.isNaN(h)?f:h}else return this.css(d,typeof e==="string"?e:e+"px")}});typeof define!=="undefined"&&define("jquery",[],function(){return c})})(window);
/*! Copyright (c) 2010 Brandon Aaron (http://brandonaaron.net)
 * Dual licensed under the MIT (MIT_LICENSE.txt)
 * and GPL Version 2 (GPL_LICENSE.txt) licenses.
 *
 * Version: 1.1.1
 * Requires jQuery 1.3+
 * Docs: http://docs.jquery.com/Plugins/livequery
 */
(function($){$.extend($.fn,{livequery:function(type,fn,fn2){var self=this,q;if($.isFunction(type)){fn2=fn;fn=type;type=undefined;}$.each($.livequery.queries,function(i,query){if(self.selector===query.selector&&self.context===query.context&&type===query.type&&(!fn||fn.$lqguid===query.fn.$lqguid)&&(!fn2||fn2.$lqguid===query.fn2.$lqguid)){return(q=query)&&false;}});q=q||new $.livequery(this.selector,this.context,type,fn,fn2);q.stopped=false;q.run();return this;},expire:function(type,fn,fn2){var self=this;if($.isFunction(type)){fn2=fn;fn=type;type=undefined;}$.each($.livequery.queries,function(i,query){if(self.selector===query.selector&&self.context===query.context&&(!type||type===query.type)&&(!fn||fn.$lqguid===query.fn.$lqguid)&&(!fn2||fn2.$lqguid===query.fn2.$lqguid)&&!this.stopped){$.livequery.stop(query.id);}});return this;}});$.livequery=function(selector,context,type,fn,fn2){this.selector=selector;this.context=context;this.type=type;this.fn=fn;this.fn2=fn2;this.elements=[];this.stopped=false;this.id=$.livequery.queries.push(this)-1;fn.$lqguid=fn.$lqguid||$.livequery.guid++;if(fn2){fn2.$lqguid=fn2.$lqguid||$.livequery.guid++;}return this;};$.livequery.prototype={stop:function(){var query=this;if(this.type){this.elements.unbind(this.type,this.fn);}else if(this.fn2){this.elements.each(function(i,el){query.fn2.apply(el);});}this.elements=[];this.stopped=true;},run:function(){if(this.stopped){return;}var query=this;var oEls=this.elements,els=$(this.selector,this.context),nEls=els.not(oEls);this.elements=els;if(this.type){nEls.bind(this.type,this.fn);if(oEls.length>0){$.each(oEls,function(i,el){if($.inArray(el,els)<0){$.event.remove(el,query.type,query.fn);}});}}else{nEls.each(function(){query.fn.apply(this);});if(this.fn2&&oEls.length>0){$.each(oEls,function(i,el){if($.inArray(el,els)<0){query.fn2.apply(el);}});}}}};$.extend($.livequery,{guid:0,queries:[],queue:[],running:false,timeout:null,checkQueue:function(){if($.livequery.running&&$.livequery.queue.length){var length=$.livequery.queue.length;while(length--){$.livequery.queries[$.livequery.queue.shift()].run();}}},pause:function(){$.livequery.running=false;},play:function(){$.livequery.running=true;$.livequery.run();},registerPlugin:function(){$.each(arguments,function(i,n){if(!$.fn[n]){return;}var old=$.fn[n];$.fn[n]=function(){var r=old.apply(this,arguments);$.livequery.run();return r;};});},run:function(id){if(id!==undefined){if($.inArray(id,$.livequery.queue)<0){$.livequery.queue.push(id);}}else{$.each($.livequery.queries,function(id){if($.inArray(id,$.livequery.queue)<0){$.livequery.queue.push(id);}});}if($.livequery.timeout){clearTimeout($.livequery.timeout);}$.livequery.timeout=setTimeout($.livequery.checkQueue,20);},stop:function(id){if(id!==undefined){$.livequery.queries[id].stop();}else{$.each($.livequery.queries,function(id){$.livequery.queries[id].stop();});}}});$.livequery.registerPlugin('append','prepend','after','before','wrap','attr','removeAttr','addClass','removeClass','toggleClass','empty','remove','html');$(function(){$.livequery.play();});})(jQuery);/*!
 * jQuery UI 1.8.16
 *
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI
 */
(function(c,j){function k(a,b){var d=a.nodeName.toLowerCase();if("area"===d){b=a.parentNode;d=b.name;if(!a.href||!d||b.nodeName.toLowerCase()!=="map")return false;a=c("img[usemap=#"+d+"]")[0];return!!a&&l(a)}return(/input|select|textarea|button|object/.test(d)?!a.disabled:"a"==d?a.href||b:b)&&l(a)}function l(a){return!c(a).parents().andSelf().filter(function(){return c.curCSS(this,"visibility")==="hidden"||c.expr.filters.hidden(this)}).length}c.ui=c.ui||{};if(!c.ui.version){c.extend(c.ui,{version:"1.8.16",
keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}});c.fn.extend({propAttr:c.fn.prop||c.fn.attr,_focus:c.fn.focus,focus:function(a,b){return typeof a==="number"?this.each(function(){var d=
this;setTimeout(function(){c(d).focus();b&&b.call(d)},a)}):this._focus.apply(this,arguments)},scrollParent:function(){var a;a=c.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(c.curCSS(this,"position",1))&&/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(c.curCSS(this,
"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0);return/fixed/.test(this.css("position"))||!a.length?c(document):a},zIndex:function(a){if(a!==j)return this.css("zIndex",a);if(this.length){a=c(this[0]);for(var b;a.length&&a[0]!==document;){b=a.css("position");if(b==="absolute"||b==="relative"||b==="fixed"){b=parseInt(a.css("zIndex"),10);if(!isNaN(b)&&b!==0)return b}a=a.parent()}}return 0},disableSelection:function(){return this.bind((c.support.selectstart?"selectstart":
"mousedown")+".ui-disableSelection",function(a){a.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}});c.each(["Width","Height"],function(a,b){function d(f,g,m,n){c.each(e,function(){g-=parseFloat(c.curCSS(f,"padding"+this,true))||0;if(m)g-=parseFloat(c.curCSS(f,"border"+this+"Width",true))||0;if(n)g-=parseFloat(c.curCSS(f,"margin"+this,true))||0});return g}var e=b==="Width"?["Left","Right"]:["Top","Bottom"],h=b.toLowerCase(),i={innerWidth:c.fn.innerWidth,innerHeight:c.fn.innerHeight,
outerWidth:c.fn.outerWidth,outerHeight:c.fn.outerHeight};c.fn["inner"+b]=function(f){if(f===j)return i["inner"+b].call(this);return this.each(function(){c(this).css(h,d(this,f)+"px")})};c.fn["outer"+b]=function(f,g){if(typeof f!=="number")return i["outer"+b].call(this,f);return this.each(function(){c(this).css(h,d(this,f,true,g)+"px")})}});c.extend(c.expr[":"],{data:function(a,b,d){return!!c.data(a,d[3])},focusable:function(a){return k(a,!isNaN(c.attr(a,"tabindex")))},tabbable:function(a){var b=c.attr(a,
"tabindex"),d=isNaN(b);return(d||b>=0)&&k(a,!d)}});c(function(){var a=document.body,b=a.appendChild(b=document.createElement("div"));c.extend(b.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0});c.support.minHeight=b.offsetHeight===100;c.support.selectstart="onselectstart"in b;a.removeChild(b).style.display="none"});c.extend(c.ui,{plugin:{add:function(a,b,d){a=c.ui[a].prototype;for(var e in d){a.plugins[e]=a.plugins[e]||[];a.plugins[e].push([b,d[e]])}},call:function(a,b,d){if((b=a.plugins[b])&&
a.element[0].parentNode)for(var e=0;e<b.length;e++)a.options[b[e][0]]&&b[e][1].apply(a.element,d)}},contains:function(a,b){return document.compareDocumentPosition?a.compareDocumentPosition(b)&16:a!==b&&a.contains(b)},hasScroll:function(a,b){if(c(a).css("overflow")==="hidden")return false;b=b&&b==="left"?"scrollLeft":"scrollTop";var d=false;if(a[b]>0)return true;a[b]=1;d=a[b]>0;a[b]=0;return d},isOverAxis:function(a,b,d){return a>b&&a<b+d},isOver:function(a,b,d,e,h,i){return c.ui.isOverAxis(a,d,h)&&
c.ui.isOverAxis(b,e,i)}})}})(jQuery);
;/*!
 * jQuery UI Widget 1.8.16
 *
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Widget
 */
(function(b,j){if(b.cleanData){var k=b.cleanData;b.cleanData=function(a){for(var c=0,d;(d=a[c])!=null;c++)try{b(d).triggerHandler("remove")}catch(e){}k(a)}}else{var l=b.fn.remove;b.fn.remove=function(a,c){return this.each(function(){if(!c)if(!a||b.filter(a,[this]).length)b("*",this).add([this]).each(function(){try{b(this).triggerHandler("remove")}catch(d){}});return l.call(b(this),a,c)})}}b.widget=function(a,c,d){var e=a.split(".")[0],f;a=a.split(".")[1];f=e+"-"+a;if(!d){d=c;c=b.Widget}b.expr[":"][f]=
function(h){return!!b.data(h,a)};b[e]=b[e]||{};b[e][a]=function(h,g){arguments.length&&this._createWidget(h,g)};c=new c;c.options=b.extend(true,{},c.options);b[e][a].prototype=b.extend(true,c,{namespace:e,widgetName:a,widgetEventPrefix:b[e][a].prototype.widgetEventPrefix||a,widgetBaseClass:f},d);b.widget.bridge(a,b[e][a])};b.widget.bridge=function(a,c){b.fn[a]=function(d){var e=typeof d==="string",f=Array.prototype.slice.call(arguments,1),h=this;d=!e&&f.length?b.extend.apply(null,[true,d].concat(f)):
d;if(e&&d.charAt(0)==="_")return h;e?this.each(function(){var g=b.data(this,a),i=g&&b.isFunction(g[d])?g[d].apply(g,f):g;if(i!==g&&i!==j){h=i;return false}}):this.each(function(){var g=b.data(this,a);g?g.option(d||{})._init():b.data(this,a,new c(d,this))});return h}};b.Widget=function(a,c){arguments.length&&this._createWidget(a,c)};b.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:false},_createWidget:function(a,c){b.data(c,this.widgetName,this);this.element=b(c);this.options=
b.extend(true,{},this.options,this._getCreateOptions(),a);var d=this;this.element.bind("remove."+this.widgetName,function(){d.destroy()});this._create();this._trigger("create");this._init()},_getCreateOptions:function(){return b.metadata&&b.metadata.get(this.element[0])[this.widgetName]},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName);this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+
"-disabled ui-state-disabled")},widget:function(){return this.element},option:function(a,c){var d=a;if(arguments.length===0)return b.extend({},this.options);if(typeof a==="string"){if(c===j)return this.options[a];d={};d[a]=c}this._setOptions(d);return this},_setOptions:function(a){var c=this;b.each(a,function(d,e){c._setOption(d,e)});return this},_setOption:function(a,c){this.options[a]=c;if(a==="disabled")this.widget()[c?"addClass":"removeClass"](this.widgetBaseClass+"-disabled ui-state-disabled").attr("aria-disabled",
c);return this},enable:function(){return this._setOption("disabled",false)},disable:function(){return this._setOption("disabled",true)},_trigger:function(a,c,d){var e=this.options[a];c=b.Event(c);c.type=(a===this.widgetEventPrefix?a:this.widgetEventPrefix+a).toLowerCase();d=d||{};if(c.originalEvent){a=b.event.props.length;for(var f;a;){f=b.event.props[--a];c[f]=c.originalEvent[f]}}this.element.trigger(c,d);return!(b.isFunction(e)&&e.call(this.element[0],c,d)===false||c.isDefaultPrevented())}}})(jQuery);
;/*!
 * jQuery UI Mouse 1.8.16
 *
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Mouse
 *
 * Depends:
 *	jquery.ui.widget.js
 */
(function(b){var d=false;b(document).mouseup(function(){d=false});b.widget("ui.mouse",{options:{cancel:":input,option",distance:1,delay:0},_mouseInit:function(){var a=this;this.element.bind("mousedown."+this.widgetName,function(c){return a._mouseDown(c)}).bind("click."+this.widgetName,function(c){if(true===b.data(c.target,a.widgetName+".preventClickEvent")){b.removeData(c.target,a.widgetName+".preventClickEvent");c.stopImmediatePropagation();return false}});this.started=false},_mouseDestroy:function(){this.element.unbind("."+
this.widgetName)},_mouseDown:function(a){if(!d){this._mouseStarted&&this._mouseUp(a);this._mouseDownEvent=a;var c=this,f=a.which==1,g=typeof this.options.cancel=="string"&&a.target.nodeName?b(a.target).closest(this.options.cancel).length:false;if(!f||g||!this._mouseCapture(a))return true;this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet)this._mouseDelayTimer=setTimeout(function(){c.mouseDelayMet=true},this.options.delay);if(this._mouseDistanceMet(a)&&this._mouseDelayMet(a)){this._mouseStarted=
this._mouseStart(a)!==false;if(!this._mouseStarted){a.preventDefault();return true}}true===b.data(a.target,this.widgetName+".preventClickEvent")&&b.removeData(a.target,this.widgetName+".preventClickEvent");this._mouseMoveDelegate=function(e){return c._mouseMove(e)};this._mouseUpDelegate=function(e){return c._mouseUp(e)};b(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);a.preventDefault();return d=true}},_mouseMove:function(a){if(b.browser.msie&&
!(document.documentMode>=9)&&!a.button)return this._mouseUp(a);if(this._mouseStarted){this._mouseDrag(a);return a.preventDefault()}if(this._mouseDistanceMet(a)&&this._mouseDelayMet(a))(this._mouseStarted=this._mouseStart(this._mouseDownEvent,a)!==false)?this._mouseDrag(a):this._mouseUp(a);return!this._mouseStarted},_mouseUp:function(a){b(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=
false;a.target==this._mouseDownEvent.target&&b.data(a.target,this.widgetName+".preventClickEvent",true);this._mouseStop(a)}return false},_mouseDistanceMet:function(a){return Math.max(Math.abs(this._mouseDownEvent.pageX-a.pageX),Math.abs(this._mouseDownEvent.pageY-a.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return true}})})(jQuery);
;/*
 * jQuery UI Position 1.8.16
 *
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Position
 */
(function(c){c.ui=c.ui||{};var n=/left|center|right/,o=/top|center|bottom/,t=c.fn.position,u=c.fn.offset;c.fn.position=function(b){if(!b||!b.of)return t.apply(this,arguments);b=c.extend({},b);var a=c(b.of),d=a[0],g=(b.collision||"flip").split(" "),e=b.offset?b.offset.split(" "):[0,0],h,k,j;if(d.nodeType===9){h=a.width();k=a.height();j={top:0,left:0}}else if(d.setTimeout){h=a.width();k=a.height();j={top:a.scrollTop(),left:a.scrollLeft()}}else if(d.preventDefault){b.at="left top";h=k=0;j={top:b.of.pageY,
left:b.of.pageX}}else{h=a.outerWidth();k=a.outerHeight();j=a.offset()}c.each(["my","at"],function(){var f=(b[this]||"").split(" ");if(f.length===1)f=n.test(f[0])?f.concat(["center"]):o.test(f[0])?["center"].concat(f):["center","center"];f[0]=n.test(f[0])?f[0]:"center";f[1]=o.test(f[1])?f[1]:"center";b[this]=f});if(g.length===1)g[1]=g[0];e[0]=parseInt(e[0],10)||0;if(e.length===1)e[1]=e[0];e[1]=parseInt(e[1],10)||0;if(b.at[0]==="right")j.left+=h;else if(b.at[0]==="center")j.left+=h/2;if(b.at[1]==="bottom")j.top+=
k;else if(b.at[1]==="center")j.top+=k/2;j.left+=e[0];j.top+=e[1];return this.each(function(){var f=c(this),l=f.outerWidth(),m=f.outerHeight(),p=parseInt(c.curCSS(this,"marginLeft",true))||0,q=parseInt(c.curCSS(this,"marginTop",true))||0,v=l+p+(parseInt(c.curCSS(this,"marginRight",true))||0),w=m+q+(parseInt(c.curCSS(this,"marginBottom",true))||0),i=c.extend({},j),r;if(b.my[0]==="right")i.left-=l;else if(b.my[0]==="center")i.left-=l/2;if(b.my[1]==="bottom")i.top-=m;else if(b.my[1]==="center")i.top-=
m/2;i.left=Math.round(i.left);i.top=Math.round(i.top);r={left:i.left-p,top:i.top-q};c.each(["left","top"],function(s,x){c.ui.position[g[s]]&&c.ui.position[g[s]][x](i,{targetWidth:h,targetHeight:k,elemWidth:l,elemHeight:m,collisionPosition:r,collisionWidth:v,collisionHeight:w,offset:e,my:b.my,at:b.at})});c.fn.bgiframe&&f.bgiframe();f.offset(c.extend(i,{using:b.using}))})};c.ui.position={fit:{left:function(b,a){var d=c(window);d=a.collisionPosition.left+a.collisionWidth-d.width()-d.scrollLeft();b.left=
d>0?b.left-d:Math.max(b.left-a.collisionPosition.left,b.left)},top:function(b,a){var d=c(window);d=a.collisionPosition.top+a.collisionHeight-d.height()-d.scrollTop();b.top=d>0?b.top-d:Math.max(b.top-a.collisionPosition.top,b.top)}},flip:{left:function(b,a){if(a.at[0]!=="center"){var d=c(window);d=a.collisionPosition.left+a.collisionWidth-d.width()-d.scrollLeft();var g=a.my[0]==="left"?-a.elemWidth:a.my[0]==="right"?a.elemWidth:0,e=a.at[0]==="left"?a.targetWidth:-a.targetWidth,h=-2*a.offset[0];b.left+=
a.collisionPosition.left<0?g+e+h:d>0?g+e+h:0}},top:function(b,a){if(a.at[1]!=="center"){var d=c(window);d=a.collisionPosition.top+a.collisionHeight-d.height()-d.scrollTop();var g=a.my[1]==="top"?-a.elemHeight:a.my[1]==="bottom"?a.elemHeight:0,e=a.at[1]==="top"?a.targetHeight:-a.targetHeight,h=-2*a.offset[1];b.top+=a.collisionPosition.top<0?g+e+h:d>0?g+e+h:0}}}};if(!c.offset.setOffset){c.offset.setOffset=function(b,a){if(/static/.test(c.curCSS(b,"position")))b.style.position="relative";var d=c(b),
g=d.offset(),e=parseInt(c.curCSS(b,"top",true),10)||0,h=parseInt(c.curCSS(b,"left",true),10)||0;g={top:a.top-g.top+e,left:a.left-g.left+h};"using"in a?a.using.call(b,g):d.css(g)};c.fn.offset=function(b){var a=this[0];if(!a||!a.ownerDocument)return null;if(b)return this.each(function(){c.offset.setOffset(this,b)});return u.call(this)}}})(jQuery);
;/*
 * jQuery UI Autocomplete 1.8.16
 *
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Autocomplete
 *
 * Depends:
 *	jquery.ui.core.js
 *	jquery.ui.widget.js
 *	jquery.ui.position.js
 */
(function(d){var e=0;d.widget("ui.autocomplete",{options:{appendTo:"body",autoFocus:false,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null},pending:0,_create:function(){var a=this,b=this.element[0].ownerDocument,g;this.element.addClass("ui-autocomplete-input").attr("autocomplete","off").attr({role:"textbox","aria-autocomplete":"list","aria-haspopup":"true"}).bind("keydown.autocomplete",function(c){if(!(a.options.disabled||a.element.propAttr("readOnly"))){g=
false;var f=d.ui.keyCode;switch(c.keyCode){case f.PAGE_UP:a._move("previousPage",c);break;case f.PAGE_DOWN:a._move("nextPage",c);break;case f.UP:a._move("previous",c);c.preventDefault();break;case f.DOWN:a._move("next",c);c.preventDefault();break;case f.ENTER:case f.NUMPAD_ENTER:if(a.menu.active){g=true;c.preventDefault()}case f.TAB:if(!a.menu.active)return;a.menu.select(c);break;case f.ESCAPE:a.element.val(a.term);a.close(c);break;default:clearTimeout(a.searching);a.searching=setTimeout(function(){if(a.term!=
a.element.val()){a.selectedItem=null;a.search(null,c)}},a.options.delay);break}}}).bind("keypress.autocomplete",function(c){if(g){g=false;c.preventDefault()}}).bind("focus.autocomplete",function(){if(!a.options.disabled){a.selectedItem=null;a.previous=a.element.val()}}).bind("blur.autocomplete",function(c){if(!a.options.disabled){clearTimeout(a.searching);a.closing=setTimeout(function(){a.close(c);a._change(c)},150)}});this._initSource();this.response=function(){return a._response.apply(a,arguments)};
this.menu=d("<ul></ul>").addClass("ui-autocomplete").appendTo(d(this.options.appendTo||"body",b)[0]).mousedown(function(c){var f=a.menu.element[0];d(c.target).closest(".ui-menu-item").length||setTimeout(function(){d(document).one("mousedown",function(h){h.target!==a.element[0]&&h.target!==f&&!d.ui.contains(f,h.target)&&a.close()})},1);setTimeout(function(){clearTimeout(a.closing)},13)}).menu({focus:function(c,f){f=f.item.data("item.autocomplete");false!==a._trigger("focus",c,{item:f})&&/^key/.test(c.originalEvent.type)&&
a.element.val(f.value)},selected:function(c,f){var h=f.item.data("item.autocomplete"),i=a.previous;if(a.element[0]!==b.activeElement){a.element.focus();a.previous=i;setTimeout(function(){a.previous=i;a.selectedItem=h},1)}false!==a._trigger("select",c,{item:h})&&a.element.val(h.value);a.term=a.element.val();a.close(c);a.selectedItem=h},blur:function(){a.menu.element.is(":visible")&&a.element.val()!==a.term&&a.element.val(a.term)}}).zIndex(this.element.zIndex()+1).css({top:0,left:0}).hide().data("menu");
d.fn.bgiframe&&this.menu.element.bgiframe()},destroy:function(){this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete").removeAttr("role").removeAttr("aria-autocomplete").removeAttr("aria-haspopup");this.menu.element.remove();d.Widget.prototype.destroy.call(this)},_setOption:function(a,b){d.Widget.prototype._setOption.apply(this,arguments);a==="source"&&this._initSource();if(a==="appendTo")this.menu.element.appendTo(d(b||"body",this.element[0].ownerDocument)[0]);a==="disabled"&&
b&&this.xhr&&this.xhr.abort()},_initSource:function(){var a=this,b,g;if(d.isArray(this.options.source)){b=this.options.source;this.source=function(c,f){f(d.ui.autocomplete.filter(b,c.term))}}else if(typeof this.options.source==="string"){g=this.options.source;this.source=function(c,f){a.xhr&&a.xhr.abort();a.xhr=d.ajax({url:g,data:c,dataType:"json",autocompleteRequest:++e,success:function(h){this.autocompleteRequest===e&&f(h)},error:function(){this.autocompleteRequest===e&&f([])}})}}else this.source=
this.options.source},search:function(a,b){a=a!=null?a:this.element.val();this.term=this.element.val();if(a.length<this.options.minLength)return this.close(b);clearTimeout(this.closing);if(this._trigger("search",b)!==false)return this._search(a)},_search:function(a){this.pending++;this.element.addClass("ui-autocomplete-loading");this.source({term:a},this.response)},_response:function(a){if(!this.options.disabled&&a&&a.length){a=this._normalize(a);this._suggest(a);this._trigger("open")}else this.close();
this.pending--;this.pending||this.element.removeClass("ui-autocomplete-loading")},close:function(a){clearTimeout(this.closing);if(this.menu.element.is(":visible")){this.menu.element.hide();this.menu.deactivate();this._trigger("close",a)}},_change:function(a){this.previous!==this.element.val()&&this._trigger("change",a,{item:this.selectedItem})},_normalize:function(a){if(a.length&&a[0].label&&a[0].value)return a;return d.map(a,function(b){if(typeof b==="string")return{label:b,value:b};return d.extend({label:b.label||
b.value,value:b.value||b.label},b)})},_suggest:function(a){var b=this.menu.element.empty().zIndex(this.element.zIndex()+1);this._renderMenu(b,a);this.menu.deactivate();this.menu.refresh();b.show();this._resizeMenu();b.position(d.extend({of:this.element},this.options.position));this.options.autoFocus&&this.menu.next(new d.Event("mouseover"))},_resizeMenu:function(){var a=this.menu.element;a.outerWidth(Math.max(a.width("").outerWidth(),this.element.outerWidth()))},_renderMenu:function(a,b){var g=this;
d.each(b,function(c,f){g._renderItem(a,f)})},_renderItem:function(a,b){return d("<li></li>").data("item.autocomplete",b).append(d("<a></a>").text(b.label)).appendTo(a)},_move:function(a,b){if(this.menu.element.is(":visible"))if(this.menu.first()&&/^previous/.test(a)||this.menu.last()&&/^next/.test(a)){this.element.val(this.term);this.menu.deactivate()}else this.menu[a](b);else this.search(null,b)},widget:function(){return this.menu.element}});d.extend(d.ui.autocomplete,{escapeRegex:function(a){return a.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,
"\\$&")},filter:function(a,b){var g=new RegExp(d.ui.autocomplete.escapeRegex(b),"i");return d.grep(a,function(c){return g.test(c.label||c.value||c)})}})})(jQuery);
(function(d){d.widget("ui.menu",{_create:function(){var e=this;this.element.addClass("ui-menu ui-widget ui-widget-content ui-corner-all").attr({role:"listbox","aria-activedescendant":"ui-active-menuitem"}).click(function(a){if(d(a.target).closest(".ui-menu-item a").length){a.preventDefault();e.select(a)}});this.refresh()},refresh:function(){var e=this;this.element.children("li:not(.ui-menu-item):has(a)").addClass("ui-menu-item").attr("role","menuitem").children("a").addClass("ui-corner-all").attr("tabindex",
-1).mouseenter(function(a){e.activate(a,d(this).parent())}).mouseleave(function(){e.deactivate()})},activate:function(e,a){this.deactivate();if(this.hasScroll()){var b=a.offset().top-this.element.offset().top,g=this.element.scrollTop(),c=this.element.height();if(b<0)this.element.scrollTop(g+b);else b>=c&&this.element.scrollTop(g+b-c+a.height())}this.active=a.eq(0).children("a").addClass("ui-state-hover").attr("id","ui-active-menuitem").end();this._trigger("focus",e,{item:a})},deactivate:function(){if(this.active){this.active.children("a").removeClass("ui-state-hover").removeAttr("id");
this._trigger("blur");this.active=null}},next:function(e){this.move("next",".ui-menu-item:first",e)},previous:function(e){this.move("prev",".ui-menu-item:last",e)},first:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},last:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},move:function(e,a,b){if(this.active){e=this.active[e+"All"](".ui-menu-item").eq(0);e.length?this.activate(b,e):this.activate(b,this.element.children(a))}else this.activate(b,
this.element.children(a))},nextPage:function(e){if(this.hasScroll())if(!this.active||this.last())this.activate(e,this.element.children(".ui-menu-item:first"));else{var a=this.active.offset().top,b=this.element.height(),g=this.element.children(".ui-menu-item").filter(function(){var c=d(this).offset().top-a-b+d(this).height();return c<10&&c>-10});g.length||(g=this.element.children(".ui-menu-item:last"));this.activate(e,g)}else this.activate(e,this.element.children(".ui-menu-item").filter(!this.active||
this.last()?":first":":last"))},previousPage:function(e){if(this.hasScroll())if(!this.active||this.first())this.activate(e,this.element.children(".ui-menu-item:last"));else{var a=this.active.offset().top,b=this.element.height();result=this.element.children(".ui-menu-item").filter(function(){var g=d(this).offset().top-a+b-d(this).height();return g<10&&g>-10});result.length||(result=this.element.children(".ui-menu-item:first"));this.activate(e,result)}else this.activate(e,this.element.children(".ui-menu-item").filter(!this.active||
this.first()?":last":":first"))},hasScroll:function(){return this.element.height()<this.element[d.fn.prop?"prop":"attr"]("scrollHeight")},select:function(e){this._trigger("selected",e,{item:this.active})}})})(jQuery);
;/*
 * jQuery UI Slider 1.8.16
 *
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Slider
 *
 * Depends:
 *	jquery.ui.core.js
 *	jquery.ui.mouse.js
 *	jquery.ui.widget.js
 */
(function(d){d.widget("ui.slider",d.ui.mouse,{widgetEventPrefix:"slide",options:{animate:false,distance:0,max:100,min:0,orientation:"horizontal",range:false,step:1,value:0,values:null},_create:function(){var a=this,b=this.options,c=this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),f=b.values&&b.values.length||1,e=[];this._mouseSliding=this._keySliding=false;this._animateOff=true;this._handleIndex=null;this._detectOrientation();this._mouseInit();this.element.addClass("ui-slider ui-slider-"+
this.orientation+" ui-widget ui-widget-content ui-corner-all"+(b.disabled?" ui-slider-disabled ui-disabled":""));this.range=d([]);if(b.range){if(b.range===true){if(!b.values)b.values=[this._valueMin(),this._valueMin()];if(b.values.length&&b.values.length!==2)b.values=[b.values[0],b.values[0]]}this.range=d("<div></div>").appendTo(this.element).addClass("ui-slider-range ui-widget-header"+(b.range==="min"||b.range==="max"?" ui-slider-range-"+b.range:""))}for(var j=c.length;j<f;j+=1)e.push("<a class='ui-slider-handle ui-state-default ui-corner-all' href='#'></a>");
this.handles=c.add(d(e.join("")).appendTo(a.element));this.handle=this.handles.eq(0);this.handles.add(this.range).filter("a").click(function(g){g.preventDefault()}).hover(function(){b.disabled||d(this).addClass("ui-state-hover")},function(){d(this).removeClass("ui-state-hover")}).focus(function(){if(b.disabled)d(this).blur();else{d(".ui-slider .ui-state-focus").removeClass("ui-state-focus");d(this).addClass("ui-state-focus")}}).blur(function(){d(this).removeClass("ui-state-focus")});this.handles.each(function(g){d(this).data("index.ui-slider-handle",
g)});this.handles.keydown(function(g){var k=true,l=d(this).data("index.ui-slider-handle"),i,h,m;if(!a.options.disabled){switch(g.keyCode){case d.ui.keyCode.HOME:case d.ui.keyCode.END:case d.ui.keyCode.PAGE_UP:case d.ui.keyCode.PAGE_DOWN:case d.ui.keyCode.UP:case d.ui.keyCode.RIGHT:case d.ui.keyCode.DOWN:case d.ui.keyCode.LEFT:k=false;if(!a._keySliding){a._keySliding=true;d(this).addClass("ui-state-active");i=a._start(g,l);if(i===false)return}break}m=a.options.step;i=a.options.values&&a.options.values.length?
(h=a.values(l)):(h=a.value());switch(g.keyCode){case d.ui.keyCode.HOME:h=a._valueMin();break;case d.ui.keyCode.END:h=a._valueMax();break;case d.ui.keyCode.PAGE_UP:h=a._trimAlignValue(i+(a._valueMax()-a._valueMin())/5);break;case d.ui.keyCode.PAGE_DOWN:h=a._trimAlignValue(i-(a._valueMax()-a._valueMin())/5);break;case d.ui.keyCode.UP:case d.ui.keyCode.RIGHT:if(i===a._valueMax())return;h=a._trimAlignValue(i+m);break;case d.ui.keyCode.DOWN:case d.ui.keyCode.LEFT:if(i===a._valueMin())return;h=a._trimAlignValue(i-
m);break}a._slide(g,l,h);return k}}).keyup(function(g){var k=d(this).data("index.ui-slider-handle");if(a._keySliding){a._keySliding=false;a._stop(g,k);a._change(g,k);d(this).removeClass("ui-state-active")}});this._refreshValue();this._animateOff=false},destroy:function(){this.handles.remove();this.range.remove();this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-slider-disabled ui-widget ui-widget-content ui-corner-all").removeData("slider").unbind(".slider");this._mouseDestroy();
return this},_mouseCapture:function(a){var b=this.options,c,f,e,j,g;if(b.disabled)return false;this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()};this.elementOffset=this.element.offset();c=this._normValueFromMouse({x:a.pageX,y:a.pageY});f=this._valueMax()-this._valueMin()+1;j=this;this.handles.each(function(k){var l=Math.abs(c-j.values(k));if(f>l){f=l;e=d(this);g=k}});if(b.range===true&&this.values(1)===b.min){g+=1;e=d(this.handles[g])}if(this._start(a,g)===false)return false;
this._mouseSliding=true;j._handleIndex=g;e.addClass("ui-state-active").focus();b=e.offset();this._clickOffset=!d(a.target).parents().andSelf().is(".ui-slider-handle")?{left:0,top:0}:{left:a.pageX-b.left-e.width()/2,top:a.pageY-b.top-e.height()/2-(parseInt(e.css("borderTopWidth"),10)||0)-(parseInt(e.css("borderBottomWidth"),10)||0)+(parseInt(e.css("marginTop"),10)||0)};this.handles.hasClass("ui-state-hover")||this._slide(a,g,c);return this._animateOff=true},_mouseStart:function(){return true},_mouseDrag:function(a){var b=
this._normValueFromMouse({x:a.pageX,y:a.pageY});this._slide(a,this._handleIndex,b);return false},_mouseStop:function(a){this.handles.removeClass("ui-state-active");this._mouseSliding=false;this._stop(a,this._handleIndex);this._change(a,this._handleIndex);this._clickOffset=this._handleIndex=null;return this._animateOff=false},_detectOrientation:function(){this.orientation=this.options.orientation==="vertical"?"vertical":"horizontal"},_normValueFromMouse:function(a){var b;if(this.orientation==="horizontal"){b=
this.elementSize.width;a=a.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)}else{b=this.elementSize.height;a=a.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)}b=a/b;if(b>1)b=1;if(b<0)b=0;if(this.orientation==="vertical")b=1-b;a=this._valueMax()-this._valueMin();return this._trimAlignValue(this._valueMin()+b*a)},_start:function(a,b){var c={handle:this.handles[b],value:this.value()};if(this.options.values&&this.options.values.length){c.value=this.values(b);
c.values=this.values()}return this._trigger("start",a,c)},_slide:function(a,b,c){var f;if(this.options.values&&this.options.values.length){f=this.values(b?0:1);if(this.options.values.length===2&&this.options.range===true&&(b===0&&c>f||b===1&&c<f))c=f;if(c!==this.values(b)){f=this.values();f[b]=c;a=this._trigger("slide",a,{handle:this.handles[b],value:c,values:f});this.values(b?0:1);a!==false&&this.values(b,c,true)}}else if(c!==this.value()){a=this._trigger("slide",a,{handle:this.handles[b],value:c});
a!==false&&this.value(c)}},_stop:function(a,b){var c={handle:this.handles[b],value:this.value()};if(this.options.values&&this.options.values.length){c.value=this.values(b);c.values=this.values()}this._trigger("stop",a,c)},_change:function(a,b){if(!this._keySliding&&!this._mouseSliding){var c={handle:this.handles[b],value:this.value()};if(this.options.values&&this.options.values.length){c.value=this.values(b);c.values=this.values()}this._trigger("change",a,c)}},value:function(a){if(arguments.length){this.options.value=
this._trimAlignValue(a);this._refreshValue();this._change(null,0)}else return this._value()},values:function(a,b){var c,f,e;if(arguments.length>1){this.options.values[a]=this._trimAlignValue(b);this._refreshValue();this._change(null,a)}else if(arguments.length)if(d.isArray(arguments[0])){c=this.options.values;f=arguments[0];for(e=0;e<c.length;e+=1){c[e]=this._trimAlignValue(f[e]);this._change(null,e)}this._refreshValue()}else return this.options.values&&this.options.values.length?this._values(a):
this.value();else return this._values()},_setOption:function(a,b){var c,f=0;if(d.isArray(this.options.values))f=this.options.values.length;d.Widget.prototype._setOption.apply(this,arguments);switch(a){case "disabled":if(b){this.handles.filter(".ui-state-focus").blur();this.handles.removeClass("ui-state-hover");this.handles.propAttr("disabled",true);this.element.addClass("ui-disabled")}else{this.handles.propAttr("disabled",false);this.element.removeClass("ui-disabled")}break;case "orientation":this._detectOrientation();
this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation);this._refreshValue();break;case "value":this._animateOff=true;this._refreshValue();this._change(null,0);this._animateOff=false;break;case "values":this._animateOff=true;this._refreshValue();for(c=0;c<f;c+=1)this._change(null,c);this._animateOff=false;break}},_value:function(){var a=this.options.value;return a=this._trimAlignValue(a)},_values:function(a){var b,c;if(arguments.length){b=this.options.values[a];
return b=this._trimAlignValue(b)}else{b=this.options.values.slice();for(c=0;c<b.length;c+=1)b[c]=this._trimAlignValue(b[c]);return b}},_trimAlignValue:function(a){if(a<=this._valueMin())return this._valueMin();if(a>=this._valueMax())return this._valueMax();var b=this.options.step>0?this.options.step:1,c=(a-this._valueMin())%b;a=a-c;if(Math.abs(c)*2>=b)a+=c>0?b:-b;return parseFloat(a.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max},_refreshValue:function(){var a=
this.options.range,b=this.options,c=this,f=!this._animateOff?b.animate:false,e,j={},g,k,l,i;if(this.options.values&&this.options.values.length)this.handles.each(function(h){e=(c.values(h)-c._valueMin())/(c._valueMax()-c._valueMin())*100;j[c.orientation==="horizontal"?"left":"bottom"]=e+"%";d(this).stop(1,1)[f?"animate":"css"](j,b.animate);if(c.options.range===true)if(c.orientation==="horizontal"){if(h===0)c.range.stop(1,1)[f?"animate":"css"]({left:e+"%"},b.animate);if(h===1)c.range[f?"animate":"css"]({width:e-
g+"%"},{queue:false,duration:b.animate})}else{if(h===0)c.range.stop(1,1)[f?"animate":"css"]({bottom:e+"%"},b.animate);if(h===1)c.range[f?"animate":"css"]({height:e-g+"%"},{queue:false,duration:b.animate})}g=e});else{k=this.value();l=this._valueMin();i=this._valueMax();e=i!==l?(k-l)/(i-l)*100:0;j[c.orientation==="horizontal"?"left":"bottom"]=e+"%";this.handle.stop(1,1)[f?"animate":"css"](j,b.animate);if(a==="min"&&this.orientation==="horizontal")this.range.stop(1,1)[f?"animate":"css"]({width:e+"%"},
b.animate);if(a==="max"&&this.orientation==="horizontal")this.range[f?"animate":"css"]({width:100-e+"%"},{queue:false,duration:b.animate});if(a==="min"&&this.orientation==="vertical")this.range.stop(1,1)[f?"animate":"css"]({height:e+"%"},b.animate);if(a==="max"&&this.orientation==="vertical")this.range[f?"animate":"css"]({height:100-e+"%"},{queue:false,duration:b.animate})}}});d.extend(d.ui.slider,{version:"1.8.16"})})(jQuery);
;/*
 * jQuery UI Effects 1.8.16
 *
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Effects/
 */
jQuery.effects||function(f,j){function m(c){var a;if(c&&c.constructor==Array&&c.length==3)return c;if(a=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(c))return[parseInt(a[1],10),parseInt(a[2],10),parseInt(a[3],10)];if(a=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(c))return[parseFloat(a[1])*2.55,parseFloat(a[2])*2.55,parseFloat(a[3])*2.55];if(a=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(c))return[parseInt(a[1],
16),parseInt(a[2],16),parseInt(a[3],16)];if(a=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(c))return[parseInt(a[1]+a[1],16),parseInt(a[2]+a[2],16),parseInt(a[3]+a[3],16)];if(/rgba\(0, 0, 0, 0\)/.exec(c))return n.transparent;return n[f.trim(c).toLowerCase()]}function s(c,a){var b;do{b=f.curCSS(c,a);if(b!=""&&b!="transparent"||f.nodeName(c,"body"))break;a="backgroundColor"}while(c=c.parentNode);return m(b)}function o(){var c=document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle,
a={},b,d;if(c&&c.length&&c[0]&&c[c[0]])for(var e=c.length;e--;){b=c[e];if(typeof c[b]=="string"){d=b.replace(/\-(\w)/g,function(g,h){return h.toUpperCase()});a[d]=c[b]}}else for(b in c)if(typeof c[b]==="string")a[b]=c[b];return a}function p(c){var a,b;for(a in c){b=c[a];if(b==null||f.isFunction(b)||a in t||/scrollbar/.test(a)||!/color/i.test(a)&&isNaN(parseFloat(b)))delete c[a]}return c}function u(c,a){var b={_:0},d;for(d in a)if(c[d]!=a[d])b[d]=a[d];return b}function k(c,a,b,d){if(typeof c=="object"){d=
a;b=null;a=c;c=a.effect}if(f.isFunction(a)){d=a;b=null;a={}}if(typeof a=="number"||f.fx.speeds[a]){d=b;b=a;a={}}if(f.isFunction(b)){d=b;b=null}a=a||{};b=b||a.duration;b=f.fx.off?0:typeof b=="number"?b:b in f.fx.speeds?f.fx.speeds[b]:f.fx.speeds._default;d=d||a.complete;return[c,a,b,d]}function l(c){if(!c||typeof c==="number"||f.fx.speeds[c])return true;if(typeof c==="string"&&!f.effects[c])return true;return false}f.effects={};f.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor",
"borderTopColor","borderColor","color","outlineColor"],function(c,a){f.fx.step[a]=function(b){if(!b.colorInit){b.start=s(b.elem,a);b.end=m(b.end);b.colorInit=true}b.elem.style[a]="rgb("+Math.max(Math.min(parseInt(b.pos*(b.end[0]-b.start[0])+b.start[0],10),255),0)+","+Math.max(Math.min(parseInt(b.pos*(b.end[1]-b.start[1])+b.start[1],10),255),0)+","+Math.max(Math.min(parseInt(b.pos*(b.end[2]-b.start[2])+b.start[2],10),255),0)+")"}});var n={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,
0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,
211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]},q=["add","remove","toggle"],t={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};f.effects.animateClass=function(c,a,b,
d){if(f.isFunction(b)){d=b;b=null}return this.queue(function(){var e=f(this),g=e.attr("style")||" ",h=p(o.call(this)),r,v=e.attr("class");f.each(q,function(w,i){c[i]&&e[i+"Class"](c[i])});r=p(o.call(this));e.attr("class",v);e.animate(u(h,r),{queue:false,duration:a,easing:b,complete:function(){f.each(q,function(w,i){c[i]&&e[i+"Class"](c[i])});if(typeof e.attr("style")=="object"){e.attr("style").cssText="";e.attr("style").cssText=g}else e.attr("style",g);d&&d.apply(this,arguments);f.dequeue(this)}})})};
f.fn.extend({_addClass:f.fn.addClass,addClass:function(c,a,b,d){return a?f.effects.animateClass.apply(this,[{add:c},a,b,d]):this._addClass(c)},_removeClass:f.fn.removeClass,removeClass:function(c,a,b,d){return a?f.effects.animateClass.apply(this,[{remove:c},a,b,d]):this._removeClass(c)},_toggleClass:f.fn.toggleClass,toggleClass:function(c,a,b,d,e){return typeof a=="boolean"||a===j?b?f.effects.animateClass.apply(this,[a?{add:c}:{remove:c},b,d,e]):this._toggleClass(c,a):f.effects.animateClass.apply(this,
[{toggle:c},a,b,d])},switchClass:function(c,a,b,d,e){return f.effects.animateClass.apply(this,[{add:a,remove:c},b,d,e])}});f.extend(f.effects,{version:"1.8.16",save:function(c,a){for(var b=0;b<a.length;b++)a[b]!==null&&c.data("ec.storage."+a[b],c[0].style[a[b]])},restore:function(c,a){for(var b=0;b<a.length;b++)a[b]!==null&&c.css(a[b],c.data("ec.storage."+a[b]))},setMode:function(c,a){if(a=="toggle")a=c.is(":hidden")?"show":"hide";return a},getBaseline:function(c,a){var b;switch(c[0]){case "top":b=
0;break;case "middle":b=0.5;break;case "bottom":b=1;break;default:b=c[0]/a.height}switch(c[1]){case "left":c=0;break;case "center":c=0.5;break;case "right":c=1;break;default:c=c[1]/a.width}return{x:c,y:b}},createWrapper:function(c){if(c.parent().is(".ui-effects-wrapper"))return c.parent();var a={width:c.outerWidth(true),height:c.outerHeight(true),"float":c.css("float")},b=f("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),
d=document.activeElement;c.wrap(b);if(c[0]===d||f.contains(c[0],d))f(d).focus();b=c.parent();if(c.css("position")=="static"){b.css({position:"relative"});c.css({position:"relative"})}else{f.extend(a,{position:c.css("position"),zIndex:c.css("z-index")});f.each(["top","left","bottom","right"],function(e,g){a[g]=c.css(g);if(isNaN(parseInt(a[g],10)))a[g]="auto"});c.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})}return b.css(a).show()},removeWrapper:function(c){var a,b=document.activeElement;
if(c.parent().is(".ui-effects-wrapper")){a=c.parent().replaceWith(c);if(c[0]===b||f.contains(c[0],b))f(b).focus();return a}return c},setTransition:function(c,a,b,d){d=d||{};f.each(a,function(e,g){unit=c.cssUnit(g);if(unit[0]>0)d[g]=unit[0]*b+unit[1]});return d}});f.fn.extend({effect:function(c){var a=k.apply(this,arguments),b={options:a[1],duration:a[2],callback:a[3]};a=b.options.mode;var d=f.effects[c];if(f.fx.off||!d)return a?this[a](b.duration,b.callback):this.each(function(){b.callback&&b.callback.call(this)});
return d.call(this,b)},_show:f.fn.show,show:function(c){if(l(c))return this._show.apply(this,arguments);else{var a=k.apply(this,arguments);a[1].mode="show";return this.effect.apply(this,a)}},_hide:f.fn.hide,hide:function(c){if(l(c))return this._hide.apply(this,arguments);else{var a=k.apply(this,arguments);a[1].mode="hide";return this.effect.apply(this,a)}},__toggle:f.fn.toggle,toggle:function(c){if(l(c)||typeof c==="boolean"||f.isFunction(c))return this.__toggle.apply(this,arguments);else{var a=k.apply(this,
arguments);a[1].mode="toggle";return this.effect.apply(this,a)}},cssUnit:function(c){var a=this.css(c),b=[];f.each(["em","px","%","pt"],function(d,e){if(a.indexOf(e)>0)b=[parseFloat(a),e]});return b}});f.easing.jswing=f.easing.swing;f.extend(f.easing,{def:"easeOutQuad",swing:function(c,a,b,d,e){return f.easing[f.easing.def](c,a,b,d,e)},easeInQuad:function(c,a,b,d,e){return d*(a/=e)*a+b},easeOutQuad:function(c,a,b,d,e){return-d*(a/=e)*(a-2)+b},easeInOutQuad:function(c,a,b,d,e){if((a/=e/2)<1)return d/
2*a*a+b;return-d/2*(--a*(a-2)-1)+b},easeInCubic:function(c,a,b,d,e){return d*(a/=e)*a*a+b},easeOutCubic:function(c,a,b,d,e){return d*((a=a/e-1)*a*a+1)+b},easeInOutCubic:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a+b;return d/2*((a-=2)*a*a+2)+b},easeInQuart:function(c,a,b,d,e){return d*(a/=e)*a*a*a+b},easeOutQuart:function(c,a,b,d,e){return-d*((a=a/e-1)*a*a*a-1)+b},easeInOutQuart:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a*a+b;return-d/2*((a-=2)*a*a*a-2)+b},easeInQuint:function(c,a,b,
d,e){return d*(a/=e)*a*a*a*a+b},easeOutQuint:function(c,a,b,d,e){return d*((a=a/e-1)*a*a*a*a+1)+b},easeInOutQuint:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a*a*a+b;return d/2*((a-=2)*a*a*a*a+2)+b},easeInSine:function(c,a,b,d,e){return-d*Math.cos(a/e*(Math.PI/2))+d+b},easeOutSine:function(c,a,b,d,e){return d*Math.sin(a/e*(Math.PI/2))+b},easeInOutSine:function(c,a,b,d,e){return-d/2*(Math.cos(Math.PI*a/e)-1)+b},easeInExpo:function(c,a,b,d,e){return a==0?b:d*Math.pow(2,10*(a/e-1))+b},easeOutExpo:function(c,
a,b,d,e){return a==e?b+d:d*(-Math.pow(2,-10*a/e)+1)+b},easeInOutExpo:function(c,a,b,d,e){if(a==0)return b;if(a==e)return b+d;if((a/=e/2)<1)return d/2*Math.pow(2,10*(a-1))+b;return d/2*(-Math.pow(2,-10*--a)+2)+b},easeInCirc:function(c,a,b,d,e){return-d*(Math.sqrt(1-(a/=e)*a)-1)+b},easeOutCirc:function(c,a,b,d,e){return d*Math.sqrt(1-(a=a/e-1)*a)+b},easeInOutCirc:function(c,a,b,d,e){if((a/=e/2)<1)return-d/2*(Math.sqrt(1-a*a)-1)+b;return d/2*(Math.sqrt(1-(a-=2)*a)+1)+b},easeInElastic:function(c,a,b,
d,e){c=1.70158;var g=0,h=d;if(a==0)return b;if((a/=e)==1)return b+d;g||(g=e*0.3);if(h<Math.abs(d)){h=d;c=g/4}else c=g/(2*Math.PI)*Math.asin(d/h);return-(h*Math.pow(2,10*(a-=1))*Math.sin((a*e-c)*2*Math.PI/g))+b},easeOutElastic:function(c,a,b,d,e){c=1.70158;var g=0,h=d;if(a==0)return b;if((a/=e)==1)return b+d;g||(g=e*0.3);if(h<Math.abs(d)){h=d;c=g/4}else c=g/(2*Math.PI)*Math.asin(d/h);return h*Math.pow(2,-10*a)*Math.sin((a*e-c)*2*Math.PI/g)+d+b},easeInOutElastic:function(c,a,b,d,e){c=1.70158;var g=
0,h=d;if(a==0)return b;if((a/=e/2)==2)return b+d;g||(g=e*0.3*1.5);if(h<Math.abs(d)){h=d;c=g/4}else c=g/(2*Math.PI)*Math.asin(d/h);if(a<1)return-0.5*h*Math.pow(2,10*(a-=1))*Math.sin((a*e-c)*2*Math.PI/g)+b;return h*Math.pow(2,-10*(a-=1))*Math.sin((a*e-c)*2*Math.PI/g)*0.5+d+b},easeInBack:function(c,a,b,d,e,g){if(g==j)g=1.70158;return d*(a/=e)*a*((g+1)*a-g)+b},easeOutBack:function(c,a,b,d,e,g){if(g==j)g=1.70158;return d*((a=a/e-1)*a*((g+1)*a+g)+1)+b},easeInOutBack:function(c,a,b,d,e,g){if(g==j)g=1.70158;
if((a/=e/2)<1)return d/2*a*a*(((g*=1.525)+1)*a-g)+b;return d/2*((a-=2)*a*(((g*=1.525)+1)*a+g)+2)+b},easeInBounce:function(c,a,b,d,e){return d-f.easing.easeOutBounce(c,e-a,0,d,e)+b},easeOutBounce:function(c,a,b,d,e){return(a/=e)<1/2.75?d*7.5625*a*a+b:a<2/2.75?d*(7.5625*(a-=1.5/2.75)*a+0.75)+b:a<2.5/2.75?d*(7.5625*(a-=2.25/2.75)*a+0.9375)+b:d*(7.5625*(a-=2.625/2.75)*a+0.984375)+b},easeInOutBounce:function(c,a,b,d,e){if(a<e/2)return f.easing.easeInBounce(c,a*2,0,d,e)*0.5+b;return f.easing.easeOutBounce(c,
a*2-e,0,d,e)*0.5+d*0.5+b}})}(jQuery);
;/*
 * jQuery UI Effects Blind 1.8.16
 *
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Effects/Blind
 *
 * Depends:
 *	jquery.effects.core.js
 */
(function(b){b.effects.blind=function(c){return this.queue(function(){var a=b(this),g=["position","top","bottom","left","right"],f=b.effects.setMode(a,c.options.mode||"hide"),d=c.options.direction||"vertical";b.effects.save(a,g);a.show();var e=b.effects.createWrapper(a).css({overflow:"hidden"}),h=d=="vertical"?"height":"width";d=d=="vertical"?e.height():e.width();f=="show"&&e.css(h,0);var i={};i[h]=f=="show"?d:0;e.animate(i,c.duration,c.options.easing,function(){f=="hide"&&a.hide();b.effects.restore(a,
g);b.effects.removeWrapper(a);c.callback&&c.callback.apply(a[0],arguments);a.dequeue()})})}})(jQuery);
;/*
 * jQuery UI Effects Bounce 1.8.16
 *
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Effects/Bounce
 *
 * Depends:
 *	jquery.effects.core.js
 */
(function(e){e.effects.bounce=function(b){return this.queue(function(){var a=e(this),l=["position","top","bottom","left","right"],h=e.effects.setMode(a,b.options.mode||"effect"),d=b.options.direction||"up",c=b.options.distance||20,m=b.options.times||5,i=b.duration||250;/show|hide/.test(h)&&l.push("opacity");e.effects.save(a,l);a.show();e.effects.createWrapper(a);var f=d=="up"||d=="down"?"top":"left";d=d=="up"||d=="left"?"pos":"neg";c=b.options.distance||(f=="top"?a.outerHeight({margin:true})/3:a.outerWidth({margin:true})/
3);if(h=="show")a.css("opacity",0).css(f,d=="pos"?-c:c);if(h=="hide")c/=m*2;h!="hide"&&m--;if(h=="show"){var g={opacity:1};g[f]=(d=="pos"?"+=":"-=")+c;a.animate(g,i/2,b.options.easing);c/=2;m--}for(g=0;g<m;g++){var j={},k={};j[f]=(d=="pos"?"-=":"+=")+c;k[f]=(d=="pos"?"+=":"-=")+c;a.animate(j,i/2,b.options.easing).animate(k,i/2,b.options.easing);c=h=="hide"?c*2:c/2}if(h=="hide"){g={opacity:0};g[f]=(d=="pos"?"-=":"+=")+c;a.animate(g,i/2,b.options.easing,function(){a.hide();e.effects.restore(a,l);e.effects.removeWrapper(a);
b.callback&&b.callback.apply(this,arguments)})}else{j={};k={};j[f]=(d=="pos"?"-=":"+=")+c;k[f]=(d=="pos"?"+=":"-=")+c;a.animate(j,i/2,b.options.easing).animate(k,i/2,b.options.easing,function(){e.effects.restore(a,l);e.effects.removeWrapper(a);b.callback&&b.callback.apply(this,arguments)})}a.queue("fx",function(){a.dequeue()});a.dequeue()})}})(jQuery);
;/*
 * jQuery UI Effects Clip 1.8.16
 *
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Effects/Clip
 *
 * Depends:
 *	jquery.effects.core.js
 */
(function(b){b.effects.clip=function(e){return this.queue(function(){var a=b(this),i=["position","top","bottom","left","right","height","width"],f=b.effects.setMode(a,e.options.mode||"hide"),c=e.options.direction||"vertical";b.effects.save(a,i);a.show();var d=b.effects.createWrapper(a).css({overflow:"hidden"});d=a[0].tagName=="IMG"?d:a;var g={size:c=="vertical"?"height":"width",position:c=="vertical"?"top":"left"};c=c=="vertical"?d.height():d.width();if(f=="show"){d.css(g.size,0);d.css(g.position,
c/2)}var h={};h[g.size]=f=="show"?c:0;h[g.position]=f=="show"?0:c/2;d.animate(h,{queue:false,duration:e.duration,easing:e.options.easing,complete:function(){f=="hide"&&a.hide();b.effects.restore(a,i);b.effects.removeWrapper(a);e.callback&&e.callback.apply(a[0],arguments);a.dequeue()}})})}})(jQuery);
;/*
 * jQuery UI Effects Drop 1.8.16
 *
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Effects/Drop
 *
 * Depends:
 *	jquery.effects.core.js
 */
(function(c){c.effects.drop=function(d){return this.queue(function(){var a=c(this),h=["position","top","bottom","left","right","opacity"],e=c.effects.setMode(a,d.options.mode||"hide"),b=d.options.direction||"left";c.effects.save(a,h);a.show();c.effects.createWrapper(a);var f=b=="up"||b=="down"?"top":"left";b=b=="up"||b=="left"?"pos":"neg";var g=d.options.distance||(f=="top"?a.outerHeight({margin:true})/2:a.outerWidth({margin:true})/2);if(e=="show")a.css("opacity",0).css(f,b=="pos"?-g:g);var i={opacity:e==
"show"?1:0};i[f]=(e=="show"?b=="pos"?"+=":"-=":b=="pos"?"-=":"+=")+g;a.animate(i,{queue:false,duration:d.duration,easing:d.options.easing,complete:function(){e=="hide"&&a.hide();c.effects.restore(a,h);c.effects.removeWrapper(a);d.callback&&d.callback.apply(this,arguments);a.dequeue()}})})}})(jQuery);
;/*
 * jQuery UI Effects Explode 1.8.16
 *
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Effects/Explode
 *
 * Depends:
 *	jquery.effects.core.js
 */
(function(j){j.effects.explode=function(a){return this.queue(function(){var c=a.options.pieces?Math.round(Math.sqrt(a.options.pieces)):3,d=a.options.pieces?Math.round(Math.sqrt(a.options.pieces)):3;a.options.mode=a.options.mode=="toggle"?j(this).is(":visible")?"hide":"show":a.options.mode;var b=j(this).show().css("visibility","hidden"),g=b.offset();g.top-=parseInt(b.css("marginTop"),10)||0;g.left-=parseInt(b.css("marginLeft"),10)||0;for(var h=b.outerWidth(true),i=b.outerHeight(true),e=0;e<c;e++)for(var f=
0;f<d;f++)b.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-f*(h/d),top:-e*(i/c)}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:h/d,height:i/c,left:g.left+f*(h/d)+(a.options.mode=="show"?(f-Math.floor(d/2))*(h/d):0),top:g.top+e*(i/c)+(a.options.mode=="show"?(e-Math.floor(c/2))*(i/c):0),opacity:a.options.mode=="show"?0:1}).animate({left:g.left+f*(h/d)+(a.options.mode=="show"?0:(f-Math.floor(d/2))*(h/d)),top:g.top+
e*(i/c)+(a.options.mode=="show"?0:(e-Math.floor(c/2))*(i/c)),opacity:a.options.mode=="show"?1:0},a.duration||500);setTimeout(function(){a.options.mode=="show"?b.css({visibility:"visible"}):b.css({visibility:"visible"}).hide();a.callback&&a.callback.apply(b[0]);b.dequeue();j("div.ui-effects-explode").remove()},a.duration||500)})}})(jQuery);
;/*
 * jQuery UI Effects Fade 1.8.16
 *
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Effects/Fade
 *
 * Depends:
 *	jquery.effects.core.js
 */
(function(b){b.effects.fade=function(a){return this.queue(function(){var c=b(this),d=b.effects.setMode(c,a.options.mode||"hide");c.animate({opacity:d},{queue:false,duration:a.duration,easing:a.options.easing,complete:function(){a.callback&&a.callback.apply(this,arguments);c.dequeue()}})})}})(jQuery);
;/*
 * jQuery UI Effects Fold 1.8.16
 *
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Effects/Fold
 *
 * Depends:
 *	jquery.effects.core.js
 */
(function(c){c.effects.fold=function(a){return this.queue(function(){var b=c(this),j=["position","top","bottom","left","right"],d=c.effects.setMode(b,a.options.mode||"hide"),g=a.options.size||15,h=!!a.options.horizFirst,k=a.duration?a.duration/2:c.fx.speeds._default/2;c.effects.save(b,j);b.show();var e=c.effects.createWrapper(b).css({overflow:"hidden"}),f=d=="show"!=h,l=f?["width","height"]:["height","width"];f=f?[e.width(),e.height()]:[e.height(),e.width()];var i=/([0-9]+)%/.exec(g);if(i)g=parseInt(i[1],
10)/100*f[d=="hide"?0:1];if(d=="show")e.css(h?{height:0,width:g}:{height:g,width:0});h={};i={};h[l[0]]=d=="show"?f[0]:g;i[l[1]]=d=="show"?f[1]:0;e.animate(h,k,a.options.easing).animate(i,k,a.options.easing,function(){d=="hide"&&b.hide();c.effects.restore(b,j);c.effects.removeWrapper(b);a.callback&&a.callback.apply(b[0],arguments);b.dequeue()})})}})(jQuery);
;/*
 * jQuery UI Effects Highlight 1.8.16
 *
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Effects/Highlight
 *
 * Depends:
 *	jquery.effects.core.js
 */
(function(b){b.effects.highlight=function(c){return this.queue(function(){var a=b(this),e=["backgroundImage","backgroundColor","opacity"],d=b.effects.setMode(a,c.options.mode||"show"),f={backgroundColor:a.css("backgroundColor")};if(d=="hide")f.opacity=0;b.effects.save(a,e);a.show().css({backgroundImage:"none",backgroundColor:c.options.color||"#ffff99"}).animate(f,{queue:false,duration:c.duration,easing:c.options.easing,complete:function(){d=="hide"&&a.hide();b.effects.restore(a,e);d=="show"&&!b.support.opacity&&
this.style.removeAttribute("filter");c.callback&&c.callback.apply(this,arguments);a.dequeue()}})})}})(jQuery);
;/*
 * jQuery UI Effects Pulsate 1.8.16
 *
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Effects/Pulsate
 *
 * Depends:
 *	jquery.effects.core.js
 */
(function(d){d.effects.pulsate=function(a){return this.queue(function(){var b=d(this),c=d.effects.setMode(b,a.options.mode||"show");times=(a.options.times||5)*2-1;duration=a.duration?a.duration/2:d.fx.speeds._default/2;isVisible=b.is(":visible");animateTo=0;if(!isVisible){b.css("opacity",0).show();animateTo=1}if(c=="hide"&&isVisible||c=="show"&&!isVisible)times--;for(c=0;c<times;c++){b.animate({opacity:animateTo},duration,a.options.easing);animateTo=(animateTo+1)%2}b.animate({opacity:animateTo},duration,
a.options.easing,function(){animateTo==0&&b.hide();a.callback&&a.callback.apply(this,arguments)});b.queue("fx",function(){b.dequeue()}).dequeue()})}})(jQuery);
;/*
 * jQuery UI Effects Scale 1.8.16
 *
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Effects/Scale
 *
 * Depends:
 *	jquery.effects.core.js
 */
(function(c){c.effects.puff=function(b){return this.queue(function(){var a=c(this),e=c.effects.setMode(a,b.options.mode||"hide"),g=parseInt(b.options.percent,10)||150,h=g/100,i={height:a.height(),width:a.width()};c.extend(b.options,{fade:true,mode:e,percent:e=="hide"?g:100,from:e=="hide"?i:{height:i.height*h,width:i.width*h}});a.effect("scale",b.options,b.duration,b.callback);a.dequeue()})};c.effects.scale=function(b){return this.queue(function(){var a=c(this),e=c.extend(true,{},b.options),g=c.effects.setMode(a,
b.options.mode||"effect"),h=parseInt(b.options.percent,10)||(parseInt(b.options.percent,10)==0?0:g=="hide"?0:100),i=b.options.direction||"both",f=b.options.origin;if(g!="effect"){e.origin=f||["middle","center"];e.restore=true}f={height:a.height(),width:a.width()};a.from=b.options.from||(g=="show"?{height:0,width:0}:f);h={y:i!="horizontal"?h/100:1,x:i!="vertical"?h/100:1};a.to={height:f.height*h.y,width:f.width*h.x};if(b.options.fade){if(g=="show"){a.from.opacity=0;a.to.opacity=1}if(g=="hide"){a.from.opacity=
1;a.to.opacity=0}}e.from=a.from;e.to=a.to;e.mode=g;a.effect("size",e,b.duration,b.callback);a.dequeue()})};c.effects.size=function(b){return this.queue(function(){var a=c(this),e=["position","top","bottom","left","right","width","height","overflow","opacity"],g=["position","top","bottom","left","right","overflow","opacity"],h=["width","height","overflow"],i=["fontSize"],f=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],k=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],
p=c.effects.setMode(a,b.options.mode||"effect"),n=b.options.restore||false,m=b.options.scale||"both",l=b.options.origin,j={height:a.height(),width:a.width()};a.from=b.options.from||j;a.to=b.options.to||j;if(l){l=c.effects.getBaseline(l,j);a.from.top=(j.height-a.from.height)*l.y;a.from.left=(j.width-a.from.width)*l.x;a.to.top=(j.height-a.to.height)*l.y;a.to.left=(j.width-a.to.width)*l.x}var d={from:{y:a.from.height/j.height,x:a.from.width/j.width},to:{y:a.to.height/j.height,x:a.to.width/j.width}};
if(m=="box"||m=="both"){if(d.from.y!=d.to.y){e=e.concat(f);a.from=c.effects.setTransition(a,f,d.from.y,a.from);a.to=c.effects.setTransition(a,f,d.to.y,a.to)}if(d.from.x!=d.to.x){e=e.concat(k);a.from=c.effects.setTransition(a,k,d.from.x,a.from);a.to=c.effects.setTransition(a,k,d.to.x,a.to)}}if(m=="content"||m=="both")if(d.from.y!=d.to.y){e=e.concat(i);a.from=c.effects.setTransition(a,i,d.from.y,a.from);a.to=c.effects.setTransition(a,i,d.to.y,a.to)}c.effects.save(a,n?e:g);a.show();c.effects.createWrapper(a);
a.css("overflow","hidden").css(a.from);if(m=="content"||m=="both"){f=f.concat(["marginTop","marginBottom"]).concat(i);k=k.concat(["marginLeft","marginRight"]);h=e.concat(f).concat(k);a.find("*[width]").each(function(){child=c(this);n&&c.effects.save(child,h);var o={height:child.height(),width:child.width()};child.from={height:o.height*d.from.y,width:o.width*d.from.x};child.to={height:o.height*d.to.y,width:o.width*d.to.x};if(d.from.y!=d.to.y){child.from=c.effects.setTransition(child,f,d.from.y,child.from);
child.to=c.effects.setTransition(child,f,d.to.y,child.to)}if(d.from.x!=d.to.x){child.from=c.effects.setTransition(child,k,d.from.x,child.from);child.to=c.effects.setTransition(child,k,d.to.x,child.to)}child.css(child.from);child.animate(child.to,b.duration,b.options.easing,function(){n&&c.effects.restore(child,h)})})}a.animate(a.to,{queue:false,duration:b.duration,easing:b.options.easing,complete:function(){a.to.opacity===0&&a.css("opacity",a.from.opacity);p=="hide"&&a.hide();c.effects.restore(a,
n?e:g);c.effects.removeWrapper(a);b.callback&&b.callback.apply(this,arguments);a.dequeue()}})})}})(jQuery);
;/*
 * jQuery UI Effects Shake 1.8.16
 *
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Effects/Shake
 *
 * Depends:
 *	jquery.effects.core.js
 */
(function(d){d.effects.shake=function(a){return this.queue(function(){var b=d(this),j=["position","top","bottom","left","right"];d.effects.setMode(b,a.options.mode||"effect");var c=a.options.direction||"left",e=a.options.distance||20,l=a.options.times||3,f=a.duration||a.options.duration||140;d.effects.save(b,j);b.show();d.effects.createWrapper(b);var g=c=="up"||c=="down"?"top":"left",h=c=="up"||c=="left"?"pos":"neg";c={};var i={},k={};c[g]=(h=="pos"?"-=":"+=")+e;i[g]=(h=="pos"?"+=":"-=")+e*2;k[g]=
(h=="pos"?"-=":"+=")+e*2;b.animate(c,f,a.options.easing);for(e=1;e<l;e++)b.animate(i,f,a.options.easing).animate(k,f,a.options.easing);b.animate(i,f,a.options.easing).animate(c,f/2,a.options.easing,function(){d.effects.restore(b,j);d.effects.removeWrapper(b);a.callback&&a.callback.apply(this,arguments)});b.queue("fx",function(){b.dequeue()});b.dequeue()})}})(jQuery);
;/*
 * jQuery UI Effects Slide 1.8.16
 *
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Effects/Slide
 *
 * Depends:
 *	jquery.effects.core.js
 */
(function(c){c.effects.slide=function(d){return this.queue(function(){var a=c(this),h=["position","top","bottom","left","right"],f=c.effects.setMode(a,d.options.mode||"show"),b=d.options.direction||"left";c.effects.save(a,h);a.show();c.effects.createWrapper(a).css({overflow:"hidden"});var g=b=="up"||b=="down"?"top":"left";b=b=="up"||b=="left"?"pos":"neg";var e=d.options.distance||(g=="top"?a.outerHeight({margin:true}):a.outerWidth({margin:true}));if(f=="show")a.css(g,b=="pos"?isNaN(e)?"-"+e:-e:e);
var i={};i[g]=(f=="show"?b=="pos"?"+=":"-=":b=="pos"?"-=":"+=")+e;a.animate(i,{queue:false,duration:d.duration,easing:d.options.easing,complete:function(){f=="hide"&&a.hide();c.effects.restore(a,h);c.effects.removeWrapper(a);d.callback&&d.callback.apply(this,arguments);a.dequeue()}})})}})(jQuery);
;/*
 * jQuery UI Effects Transfer 1.8.16
 *
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Effects/Transfer
 *
 * Depends:
 *	jquery.effects.core.js
 */
(function(e){e.effects.transfer=function(a){return this.queue(function(){var b=e(this),c=e(a.options.to),d=c.offset();c={top:d.top,left:d.left,height:c.innerHeight(),width:c.innerWidth()};d=b.offset();var f=e('<div class="ui-effects-transfer"></div>').appendTo(document.body).addClass(a.options.className).css({top:d.top,left:d.left,height:b.innerHeight(),width:b.innerWidth(),position:"absolute"}).animate(c,a.duration,a.options.easing,function(){f.remove();a.callback&&a.callback.apply(b[0],arguments);
b.dequeue()})})}})(jQuery);
;/*
 * jQuery Tools 1.2.5 - The missing UI library for the Web
 * 
 * [tabs, tooltip, tooltip.slide, scrollable, overlay]
 * 
 * NO COPYRIGHTS OR LICENSES. DO WHAT YOU LIKE.
 * 
 * http://flowplayer.org/tools/
 * 
 * File generated: Wed Feb 23 13:49:07 GMT 2011
 */
(function(c){function p(d,b,a){var e=this,l=d.add(this),h=d.find(a.tabs),i=b.jquery?b:d.children(b),j;h.length||(h=d.children());i.length||(i=d.parent().find(b));i.length||(i=c(b));c.extend(this,{click:function(f,g){var k=h.eq(f);if(typeof f=="string"&&f.replace("#","")){k=h.filter("[href*="+f.replace("#","")+"]");f=Math.max(h.index(k),0)}if(a.rotate){var n=h.length-1;if(f<0)return e.click(n,g);if(f>n)return e.click(0,g)}if(!k.length){if(j>=0)return e;f=a.initialIndex;k=h.eq(f)}if(f===j)return e;
g=g||c.Event();g.type="onBeforeClick";l.trigger(g,[f]);if(!g.isDefaultPrevented()){o[a.effect].call(e,f,function(){g.type="onClick";l.trigger(g,[f])});j=f;h.removeClass(a.current);k.addClass(a.current);return e}},getConf:function(){return a},getTabs:function(){return h},getPanes:function(){return i},getCurrentPane:function(){return i.eq(j)},getCurrentTab:function(){return h.eq(j)},getIndex:function(){return j},next:function(){return e.click(j+1)},prev:function(){return e.click(j-1)},destroy:function(){h.unbind(a.event).removeClass(a.current);
i.find("a[href^=#]").unbind("click.T");return e}});c.each("onBeforeClick,onClick".split(","),function(f,g){c.isFunction(a[g])&&c(e).bind(g,a[g]);e[g]=function(k){k&&c(e).bind(g,k);return e}});if(a.history&&c.fn.history){c.tools.history.init(h);a.event="history"}h.each(function(f){c(this).bind(a.event,function(g){e.click(f,g);return g.preventDefault()})});i.find("a[href^=#]").bind("click.T",function(f){e.click(c(this).attr("href"),f)});if(location.hash&&a.tabs=="a"&&d.find("[href="+location.hash+"]").length)e.click(location.hash);
else if(a.initialIndex===0||a.initialIndex>0)e.click(a.initialIndex)}c.tools=c.tools||{version:"1.2.5"};c.tools.tabs={conf:{tabs:"a",current:"current",onBeforeClick:null,onClick:null,effect:"default",initialIndex:0,event:"click",rotate:false,history:false},addEffect:function(d,b){o[d]=b}};var o={"default":function(d,b){this.getPanes().hide().eq(d).show();b.call()},fade:function(d,b){var a=this.getConf(),e=a.fadeOutSpeed,l=this.getPanes();e?l.fadeOut(e):l.hide();l.eq(d).fadeIn(a.fadeInSpeed,b)},slide:function(d,
b){this.getPanes().slideUp(200);this.getPanes().eq(d).slideDown(400,b)},ajax:function(d,b){this.getPanes().eq(0).load(this.getTabs().eq(d).attr("href"),b)}},m;c.tools.tabs.addEffect("horizontal",function(d,b){m||(m=this.getPanes().eq(0).width());this.getCurrentPane().animate({width:0},function(){c(this).hide()});this.getPanes().eq(d).animate({width:m},function(){c(this).show();b.call()})});c.fn.tabs=function(d,b){var a=this.data("tabs");if(a){a.destroy();this.removeData("tabs")}if(c.isFunction(b))b=
{onBeforeClick:b};b=c.extend({},c.tools.tabs.conf,b);this.each(function(){a=new p(c(this),d,b);c(this).data("tabs",a)});return b.api?a:this}})(jQuery);
(function(f){function p(a,b,c){var h=c.relative?a.position().top:a.offset().top,d=c.relative?a.position().left:a.offset().left,i=c.position[0];h-=b.outerHeight()-c.offset[0];d+=a.outerWidth()+c.offset[1];if(/iPad/i.test(navigator.userAgent))h-=f(window).scrollTop();var j=b.outerHeight()+a.outerHeight();if(i=="center")h+=j/2;if(i=="bottom")h+=j;i=c.position[1];a=b.outerWidth()+a.outerWidth();if(i=="center")d-=a/2;if(i=="left")d-=a;return{top:h,left:d}}function u(a,b){var c=this,h=a.add(c),d,i=0,j=
0,m=a.attr("title"),q=a.attr("data-tooltip"),r=o[b.effect],l,s=a.is(":input"),v=s&&a.is(":checkbox, :radio, select, :button, :submit"),t=a.attr("type"),k=b.events[t]||b.events[s?v?"widget":"input":"def"];if(!r)throw'Nonexistent effect "'+b.effect+'"';k=k.split(/,\s*/);if(k.length!=2)throw"Tooltip: bad events configuration for "+t;a.bind(k[0],function(e){clearTimeout(i);if(b.predelay)j=setTimeout(function(){c.show(e)},b.predelay);else c.show(e)}).bind(k[1],function(e){clearTimeout(j);if(b.delay)i=
setTimeout(function(){c.hide(e)},b.delay);else c.hide(e)});if(m&&b.cancelDefault){a.removeAttr("title");a.data("title",m)}f.extend(c,{show:function(e){if(!d){if(q)d=f(q);else if(b.tip)d=f(b.tip).eq(0);else if(m)d=f(b.layout).addClass(b.tipClass).appendTo(document.body).hide().append(m);else{d=a.next();d.length||(d=a.parent().next())}if(!d.length)throw"Cannot find tooltip for "+a;}if(c.isShown())return c;d.stop(true,true);var g=p(a,d,b);b.tip&&d.html(a.data("title"));e=e||f.Event();e.type="onBeforeShow";
h.trigger(e,[g]);if(e.isDefaultPrevented())return c;g=p(a,d,b);d.css({position:"absolute",top:g.top,left:g.left});l=true;r[0].call(c,function(){e.type="onShow";l="full";h.trigger(e)});g=b.events.tooltip.split(/,\s*/);if(!d.data("__set")){d.bind(g[0],function(){clearTimeout(i);clearTimeout(j)});g[1]&&!a.is("input:not(:checkbox, :radio), textarea")&&d.bind(g[1],function(n){n.relatedTarget!=a[0]&&a.trigger(k[1].split(" ")[0])});d.data("__set",true)}return c},hide:function(e){if(!d||!c.isShown())return c;
e=e||f.Event();e.type="onBeforeHide";h.trigger(e);if(!e.isDefaultPrevented()){l=false;o[b.effect][1].call(c,function(){e.type="onHide";h.trigger(e)});return c}},isShown:function(e){return e?l=="full":l},getConf:function(){return b},getTip:function(){return d},getTrigger:function(){return a}});f.each("onHide,onBeforeShow,onShow,onBeforeHide".split(","),function(e,g){f.isFunction(b[g])&&f(c).bind(g,b[g]);c[g]=function(n){n&&f(c).bind(g,n);return c}})}f.tools=f.tools||{version:"1.2.5"};f.tools.tooltip=
{conf:{effect:"toggle",fadeOutSpeed:"fast",predelay:0,delay:30,opacity:1,tip:0,position:["top","center"],offset:[0,0],relative:false,cancelDefault:true,events:{def:"mouseenter,mouseleave",input:"focus,blur",widget:"focus mouseenter,blur mouseleave",tooltip:"mouseenter,mouseleave"},layout:"<div/>",tipClass:"tooltip"},addEffect:function(a,b,c){o[a]=[b,c]}};var o={toggle:[function(a){var b=this.getConf(),c=this.getTip();b=b.opacity;b<1&&c.css({opacity:b});c.show();a.call()},function(a){this.getTip().hide();
a.call()}],fade:[function(a){var b=this.getConf();this.getTip().fadeTo(b.fadeInSpeed,b.opacity,a)},function(a){this.getTip().fadeOut(this.getConf().fadeOutSpeed,a)}]};f.fn.tooltip=function(a){var b=this.data("tooltip");if(b)return b;a=f.extend(true,{},f.tools.tooltip.conf,a);if(typeof a.position=="string")a.position=a.position.split(/,?\s/);this.each(function(){b=new u(f(this),a);f(this).data("tooltip",b)});return a.api?b:this}})(jQuery);
(function(d){var i=d.tools.tooltip;d.extend(i.conf,{direction:"up",bounce:false,slideOffset:10,slideInSpeed:200,slideOutSpeed:200,slideFade:!d.browser.msie});var e={up:["-","top"],down:["+","top"],left:["-","left"],right:["+","left"]};i.addEffect("slide",function(g){var a=this.getConf(),f=this.getTip(),b=a.slideFade?{opacity:a.opacity}:{},c=e[a.direction]||e.up;b[c[1]]=c[0]+"="+a.slideOffset;a.slideFade&&f.css({opacity:0});f.show().animate(b,a.slideInSpeed,g)},function(g){var a=this.getConf(),f=a.slideOffset,
b=a.slideFade?{opacity:0}:{},c=e[a.direction]||e.up,h=""+c[0];if(a.bounce)h=h=="+"?"-":"+";b[c[1]]=h+"="+f;this.getTip().animate(b,a.slideOutSpeed,function(){d(this).hide();g.call()})})})(jQuery);
(function(e){function p(f,c){var b=e(c);return b.length<2?b:f.parent().find(c)}function u(f,c){var b=this,n=f.add(b),g=f.children(),l=0,j=c.vertical;k||(k=b);if(g.length>1)g=e(c.items,f);e.extend(b,{getConf:function(){return c},getIndex:function(){return l},getSize:function(){return b.getItems().size()},getNaviButtons:function(){return o.add(q)},getRoot:function(){return f},getItemWrap:function(){return g},getItems:function(){return g.children(c.item).not("."+c.clonedClass)},move:function(a,d){return b.seekTo(l+
a,d)},next:function(a){return b.move(1,a)},prev:function(a){return b.move(-1,a)},begin:function(a){return b.seekTo(0,a)},end:function(a){return b.seekTo(b.getSize()-1,a)},focus:function(){return k=b},addItem:function(a){a=e(a);if(c.circular){g.children("."+c.clonedClass+":last").before(a);g.children("."+c.clonedClass+":first").replaceWith(a.clone().addClass(c.clonedClass))}else g.append(a);n.trigger("onAddItem",[a]);return b},seekTo:function(a,d,h){a.jquery||(a*=1);if(c.circular&&a===0&&l==-1&&d!==
0)return b;if(!c.circular&&a<0||a>b.getSize()||a<-1)return b;var i=a;if(a.jquery)a=b.getItems().index(a);else i=b.getItems().eq(a);var r=e.Event("onBeforeSeek");if(!h){n.trigger(r,[a,d]);if(r.isDefaultPrevented()||!i.length)return b}i=j?{top:-i.position().top}:{left:-i.position().left};l=a;k=b;if(d===undefined)d=c.speed;g.animate(i,d,c.easing,h||function(){n.trigger("onSeek",[a])});return b}});e.each(["onBeforeSeek","onSeek","onAddItem"],function(a,d){e.isFunction(c[d])&&e(b).bind(d,c[d]);b[d]=function(h){h&&
e(b).bind(d,h);return b}});if(c.circular){var s=b.getItems().slice(-1).clone().prependTo(g),t=b.getItems().eq(1).clone().appendTo(g);s.add(t).addClass(c.clonedClass);b.onBeforeSeek(function(a,d,h){if(!a.isDefaultPrevented())if(d==-1){b.seekTo(s,h,function(){b.end(0)});return a.preventDefault()}else d==b.getSize()&&b.seekTo(t,h,function(){b.begin(0)})});b.seekTo(0,0,function(){})}var o=p(f,c.prev).click(function(){b.prev()}),q=p(f,c.next).click(function(){b.next()});if(!c.circular&&b.getSize()>1){b.onBeforeSeek(function(a,
d){setTimeout(function(){if(!a.isDefaultPrevented()){o.toggleClass(c.disabledClass,d<=0);q.toggleClass(c.disabledClass,d>=b.getSize()-1)}},1)});c.initialIndex||o.addClass(c.disabledClass)}c.mousewheel&&e.fn.mousewheel&&f.mousewheel(function(a,d){if(c.mousewheel){b.move(d<0?1:-1,c.wheelSpeed||50);return false}});if(c.touch){var m={};g[0].ontouchstart=function(a){a=a.touches[0];m.x=a.clientX;m.y=a.clientY};g[0].ontouchmove=function(a){if(a.touches.length==1&&!g.is(":animated")){var d=a.touches[0],h=
m.x-d.clientX;d=m.y-d.clientY;b[j&&d>0||!j&&h>0?"next":"prev"]();a.preventDefault()}}}c.keyboard&&e(document).bind("keydown.scrollable",function(a){if(!(!c.keyboard||a.altKey||a.ctrlKey||e(a.target).is(":input")))if(!(c.keyboard!="static"&&k!=b)){var d=a.keyCode;if(j&&(d==38||d==40)){b.move(d==38?-1:1);return a.preventDefault()}if(!j&&(d==37||d==39)){b.move(d==37?-1:1);return a.preventDefault()}}});c.initialIndex&&b.seekTo(c.initialIndex,0,function(){})}e.tools=e.tools||{version:"1.2.5"};e.tools.scrollable=
{conf:{activeClass:"active",circular:false,clonedClass:"cloned",disabledClass:"disabled",easing:"swing",initialIndex:0,item:null,items:".items",keyboard:true,mousewheel:false,next:".next",prev:".prev",speed:400,vertical:false,touch:true,wheelSpeed:0}};var k;e.fn.scrollable=function(f){var c=this.data("scrollable");if(c)return c;f=e.extend({},e.tools.scrollable.conf,f);this.each(function(){c=new u(e(this),f);e(this).data("scrollable",c)});return f.api?c:this}})(jQuery);
(function(a){function t(d,b){var c=this,j=d.add(c),o=a(window),k,f,m,g=a.tools.expose&&(b.mask||b.expose),n=Math.random().toString().slice(10);if(g){if(typeof g=="string")g={color:g};g.closeOnClick=g.closeOnEsc=false}var p=b.target||d.attr("rel");f=p?a(p):d;if(!f.length)throw"Could not find Overlay: "+p;d&&d.index(f)==-1&&d.click(function(e){c.load(e);return e.preventDefault()});a.extend(c,{load:function(e){if(c.isOpened())return c;var h=q[b.effect];if(!h)throw'Overlay: cannot find effect : "'+b.effect+
'"';b.oneInstance&&a.each(s,function(){this.close(e)});e=e||a.Event();e.type="onBeforeLoad";j.trigger(e);if(e.isDefaultPrevented())return c;m=true;g&&a(f).expose(g);var i=b.top,r=b.left,u=f.outerWidth({margin:true}),v=f.outerHeight({margin:true});if(typeof i=="string")i=i=="center"?Math.max((o.height()-v)/2,0):parseInt(i,10)/100*o.height();if(r=="center")r=Math.max((o.width()-u)/2,0);h[0].call(c,{top:i,left:r},function(){if(m){e.type="onLoad";j.trigger(e)}});g&&b.closeOnClick&&a.mask.getMask().one("click",
c.close);b.closeOnClick&&a(document).bind("click."+n,function(l){a(l.target).parents(f).length||c.close(l)});b.closeOnEsc&&a(document).bind("keydown."+n,function(l){l.keyCode==27&&c.close(l)});return c},close:function(e){if(!c.isOpened())return c;e=e||a.Event();e.type="onBeforeClose";j.trigger(e);if(!e.isDefaultPrevented()){m=false;q[b.effect][1].call(c,function(){e.type="onClose";j.trigger(e)});a(document).unbind("click."+n).unbind("keydown."+n);g&&a.mask.close();return c}},getOverlay:function(){return f},
getTrigger:function(){return d},getClosers:function(){return k},isOpened:function(){return m},getConf:function(){return b}});a.each("onBeforeLoad,onStart,onLoad,onBeforeClose,onClose".split(","),function(e,h){a.isFunction(b[h])&&a(c).bind(h,b[h]);c[h]=function(i){i&&a(c).bind(h,i);return c}});k=f.find(b.close||".close");if(!k.length&&!b.close){k=a('<a class="close"></a>');f.prepend(k)}k.click(function(e){c.close(e)});b.load&&c.load()}a.tools=a.tools||{version:"1.2.5"};a.tools.overlay={addEffect:function(d,
b,c){q[d]=[b,c]},conf:{close:null,closeOnClick:true,closeOnEsc:true,closeSpeed:"fast",effect:"default",fixed:!a.browser.msie||a.browser.version>6,left:"center",load:false,mask:null,oneInstance:true,speed:"normal",target:null,top:"10%"}};var s=[],q={};a.tools.overlay.addEffect("default",function(d,b){var c=this.getConf(),j=a(window);if(!c.fixed){d.top+=j.scrollTop();d.left+=j.scrollLeft()}d.position=c.fixed?"fixed":"absolute";this.getOverlay().css(d).fadeIn(c.speed,b)},function(d){this.getOverlay().fadeOut(this.getConf().closeSpeed,
d)});a.fn.overlay=function(d){var b=this.data("overlay");if(b)return b;if(a.isFunction(d))d={onBeforeLoad:d};d=a.extend(true,{},a.tools.overlay.conf,d);this.each(function(){b=new t(a(this),d);s.push(b);a(this).data("overlay",b)});return d.api?b:this}})(jQuery);

/*

 jQuery Tools Validator 1.2.5 - HTML5 is here. Now use it.

 NO COPYRIGHTS OR LICENSES. DO WHAT YOU LIKE.

 http://flowplayer.org/tools/form/validator/

 Since: Mar 2010
 Date:    Wed Sep 22 06:02:10 2010 +0000
*/
(function(e){function t(a,b,c){var k=a.offset().top,f=a.offset().left,l=c.position.split(/,?\s+/),p=l[0];l=l[1];k-=b.outerHeight()-c.offset[0];f+=a.outerWidth()+c.offset[1];if(/iPad/i.test(navigator.userAgent))k-=e(window).scrollTop();c=b.outerHeight()+a.outerHeight();if(p=="center")k+=c/2;if(p=="bottom")k+=c;a=a.outerWidth();if(l=="center")f-=(a+b.outerWidth())/2;if(l=="left")f-=a;return{top:k,left:f}}function y(a){function b(){return this.getAttribute("type")==a}b.key="[type="+a+"]";return b}function u(a,
b,c){function k(g,d,i){if(!(!c.grouped&&g.length)){var j;if(i===false||e.isArray(i)){j=h.messages[d.key||d]||h.messages["*"];j=j[c.lang]||h.messages["*"].en;(d=j.match(/\$\d/g))&&e.isArray(i)&&e.each(d,function(m){j=j.replace(this,i[m])})}else j=i[c.lang]||i;g.push(j)}}var f=this,l=b.add(f);a=a.not(":button, :image, :reset, :submit");e.extend(f,{getConf:function(){return c},getForm:function(){return b},getInputs:function(){return a},reflow:function(){a.each(function(){var g=e(this),d=g.data("msg.el");
if(d){g=t(g,d,c);d.css({top:g.top,left:g.left})}});return f},invalidate:function(g,d){if(!d){var i=[];e.each(g,function(j,m){j=a.filter("[name='"+j+"']");if(j.length){j.trigger("OI",[m]);i.push({input:j,messages:[m]})}});g=i;d=e.Event()}d.type="onFail";l.trigger(d,[g]);d.isDefaultPrevented()||q[c.effect][0].call(f,g,d);return f},reset:function(g){g=g||a;g.removeClass(c.errorClass).each(function(){var d=e(this).data("msg.el");if(d){d.remove();e(this).data("msg.el",null)}}).unbind(c.errorInputEvent||
"");return f},destroy:function(){b.unbind(c.formEvent+".V").unbind("reset.V");a.unbind(c.inputEvent+".V").unbind("change.V");return f.reset()},checkValidity:function(g,d){g=g||a;g=g.not(":disabled");if(!g.length)return true;d=d||e.Event();d.type="onBeforeValidate";l.trigger(d,[g]);if(d.isDefaultPrevented())return d.result;var i=[];g.not(":radio:not(:checked)").each(function(){var m=[],n=e(this).data("messages",m),v=r&&n.is(":date")?"onHide.v":c.errorInputEvent+".v";n.unbind(v);e.each(w,function(){var o=
this,s=o[0];if(n.filter(s).length){o=o[1].call(f,n,n.val());if(o!==true){d.type="onBeforeFail";l.trigger(d,[n,s]);if(d.isDefaultPrevented())return false;var x=n.attr(c.messageAttr);if(x){m=[x];return false}else k(m,s,o)}}});if(m.length){i.push({input:n,messages:m});n.trigger("OI",[m]);c.errorInputEvent&&n.bind(v,function(o){f.checkValidity(n,o)})}if(c.singleError&&i.length)return false});var j=q[c.effect];if(!j)throw'Validator: cannot find effect "'+c.effect+'"';if(i.length){f.invalidate(i,d);return false}else{j[1].call(f,
g,d);d.type="onSuccess";l.trigger(d,[g]);g.unbind(c.errorInputEvent+".v")}return true}});e.each("onBeforeValidate,onBeforeFail,onFail,onSuccess".split(","),function(g,d){e.isFunction(c[d])&&e(f).bind(d,c[d]);f[d]=function(i){i&&e(f).bind(d,i);return f}});c.formEvent&&b.bind(c.formEvent+".V",function(g){if(!f.checkValidity(null,g))return g.preventDefault()});b.bind("reset.V",function(){f.reset()});a[0]&&a[0].validity&&a.each(function(){this.oninvalid=function(){return false}});if(b[0])b[0].checkValidity=
f.checkValidity;c.inputEvent&&a.bind(c.inputEvent+".V",function(g){f.checkValidity(e(this),g)});a.filter(":checkbox, select").filter("[required]").bind("change.V",function(g){var d=e(this);if(this.checked||d.is("select")&&e(this).val())q[c.effect][1].call(f,d,g)});var p=a.filter(":radio").change(function(g){f.checkValidity(p,g)});e(window).resize(function(){f.reflow()})}e.tools=e.tools||{version:"1.2.5"};var z=/\[type=([a-z]+)\]/,A=/^-?[0-9]*(\.[0-9]+)?$/,r=e.tools.dateinput,B=/^([a-z0-9_\.\-\+]+)@([\da-z\.\-]+)\.([a-z\.]{2,6})$/i,
C=/^(https?:\/\/)?[\da-z\.\-]+\.[a-z\.]{2,6}[#&+_\?\/\w \.\-=]*$/i,h;h=e.tools.validator={conf:{grouped:false,effect:"default",errorClass:"invalid",inputEvent:null,errorInputEvent:"keyup",formEvent:"submit",lang:"en",message:"<div/>",messageAttr:"data-message",messageClass:"error",offset:[0,0],position:"center right",singleError:false,speed:"normal"},messages:{"*":{en:"Please correct this value"}},localize:function(a,b){e.each(b,function(c,k){h.messages[c]=h.messages[c]||{};h.messages[c][a]=k})},
localizeFn:function(a,b){h.messages[a]=h.messages[a]||{};e.extend(h.messages[a],b)},fn:function(a,b,c){if(e.isFunction(b))c=b;else{if(typeof b=="string")b={en:b};this.messages[a.key||a]=b}if(b=z.exec(a))a=y(b[1]);w.push([a,c])},addEffect:function(a,b,c){q[a]=[b,c]}};var w=[],q={"default":[function(a){var b=this.getConf();e.each(a,function(c,k){c=k.input;c.addClass(b.errorClass);var f=c.data("msg.el");if(!f){f=e(b.message).addClass(b.messageClass).appendTo(document.body);c.data("msg.el",f)}f.css({visibility:"hidden"}).find("p").remove();
e.each(k.messages,function(l,p){e("<p/>").html(p).appendTo(f)});f.outerWidth()==f.parent().width()&&f.add(f.find("p")).css({display:"inline"});k=t(c,f,b);f.css({visibility:"visible",position:"absolute",top:k.top,left:k.left}).fadeIn(b.speed)})},function(a){var b=this.getConf();a.removeClass(b.errorClass).each(function(){var c=e(this).data("msg.el");c&&c.css({visibility:"hidden"})})}]};e.each("email,url,number".split(","),function(a,b){e.expr[":"][b]=function(c){return c.getAttribute("type")===b}});
e.fn.oninvalid=function(a){return this[a?"bind":"trigger"]("OI",a)};h.fn(":email","Please enter a valid email address",function(a,b){return!b||B.test(b)});h.fn(":url","Please enter a valid URL",function(a,b){return!b||C.test(b)});h.fn(":number","Please enter a numeric value.",function(a,b){return A.test(b)});h.fn("[max]","Please enter a value smaller than $1",function(a,b){if(b===""||r&&a.is(":date"))return true;a=a.attr("max");return parseFloat(b)<=parseFloat(a)?true:[a]});h.fn("[min]","Please enter a value larger than $1",
function(a,b){if(b===""||r&&a.is(":date"))return true;a=a.attr("min");return parseFloat(b)>=parseFloat(a)?true:[a]});h.fn("[required]","Please complete this mandatory field.",function(a,b){if(a.is(":checkbox"))return a.is(":checked");return!!b});h.fn("[pattern]",function(a){var b=new RegExp("^"+a.attr("pattern")+"$");return b.test(a.val())});e.fn.validator=function(a){var b=this.data("validator");if(b){b.destroy();this.removeData("validator")}a=e.extend(true,{},h.conf,a);if(this.is("form"))return this.each(function(){var c=
e(this);b=new u(c.find(":input"),c,a);c.data("validator",b)});else{b=new u(this,this.eq(0).closest("form"),a);return this.data("validator",b)}}})(jQuery);

/*
                                     
 jQuery Tools 1.2.5 Dateinput - <input type="date" /> for humans

 NO COPYRIGHTS OR LICENSES. DO WHAT YOU LIKE.

 http://flowplayer.org/tools/form/dateinput/

 Since: Mar 2010
 Date:    Wed Sep 22 06:02:10 2010 +0000 
*/
(function(d){function R(a,c){return 32-(new Date(a,c,32)).getDate()}function S(a,c){a=""+a;for(c=c||2;a.length<c;)a="0"+a;return a}function T(a,c,j){var q=a.getDate(),h=a.getDay(),r=a.getMonth();a=a.getFullYear();var f={d:q,dd:S(q),ddd:B[j].shortDays[h],dddd:B[j].days[h],m:r+1,mm:S(r+1),mmm:B[j].shortMonths[r],mmmm:B[j].months[r],yy:String(a).slice(2),yyyy:a};c=c.replace(X,function(s){return s in f?f[s]:s.slice(1,s.length-1)});return Y.html(c).html()}function v(a){return parseInt(a,10)}function U(a,
c){return a.getFullYear()===c.getFullYear()&&a.getMonth()==c.getMonth()&&a.getDate()==c.getDate()}function C(a){if(a){if(a.constructor==Date)return a;if(typeof a=="string"){var c=a.split("-");if(c.length==3)return new Date(v(c[0]),v(c[1])-1,v(c[2]));if(!/^-?\d+$/.test(a))return;a=v(a)}c=new Date;c.setDate(c.getDate()+a);return c}}function Z(a,c){function j(b,e,g){n=b;D=b.getFullYear();E=b.getMonth();G=b.getDate();g=g||d.Event("api");g.type="change";H.trigger(g,[b]);if(!g.isDefaultPrevented()){a.val(T(b,
e.format,e.lang));a.data("date",b);h.hide(g)}}function q(b){b.type="onShow";H.trigger(b);d(document).bind("keydown.d",function(e){if(e.ctrlKey)return true;var g=e.keyCode;if(g==8){a.val("");return h.hide(e)}if(g==27)return h.hide(e);if(d(V).index(g)>=0){if(!w){h.show(e);return e.preventDefault()}var i=d("#"+f.weeks+" a"),t=d("."+f.focus),o=i.index(t);t.removeClass(f.focus);if(g==74||g==40)o+=7;else if(g==75||g==38)o-=7;else if(g==76||g==39)o+=1;else if(g==72||g==37)o-=1;if(o>41){h.addMonth();t=d("#"+
f.weeks+" a:eq("+(o-42)+")")}else if(o<0){h.addMonth(-1);t=d("#"+f.weeks+" a:eq("+(o+42)+")")}else t=i.eq(o);t.addClass(f.focus);return e.preventDefault()}if(g==34)return h.addMonth();if(g==33)return h.addMonth(-1);if(g==36)return h.today();if(g==13)d(e.target).is("select")||d("."+f.focus).click();return d([16,17,18,9]).index(g)>=0});d(document).bind("click.d",function(e){var g=e.target;if(!d(g).parents("#"+f.root).length&&g!=a[0]&&(!L||g!=L[0]))h.hide(e)})}var h=this,r=new Date,f=c.css,s=B[c.lang],
k=d("#"+f.root),M=k.find("#"+f.title),L,I,J,D,E,G,n=a.attr("data-value")||c.value||a.val(),m=a.attr("min")||c.min,p=a.attr("max")||c.max,w;if(m===0)m="0";n=C(n)||r;m=C(m||c.yearRange[0]*365);p=C(p||c.yearRange[1]*365);if(!s)throw"Dateinput: invalid language: "+c.lang;if(a.attr("type")=="date"){var N=d("<input/>");d.each("class,disabled,id,maxlength,name,readonly,required,size,style,tabindex,title,value".split(","),function(b,e){N.attr(e,a.attr(e))});a.replaceWith(N);a=N}a.addClass(f.input);var H=
a.add(h);if(!k.length){k=d("<div><div><a/><div/><a/></div><div><div/><div/></div></div>").hide().css({position:"absolute"}).attr("id",f.root);k.children().eq(0).attr("id",f.head).end().eq(1).attr("id",f.body).children().eq(0).attr("id",f.days).end().eq(1).attr("id",f.weeks).end().end().end().find("a").eq(0).attr("id",f.prev).end().eq(1).attr("id",f.next);M=k.find("#"+f.head).find("div").attr("id",f.title);if(c.selectors){var z=d("<select/>").attr("id",f.month),A=d("<select/>").attr("id",f.year);M.html(z.add(A))}for(var $=
k.find("#"+f.days),O=0;O<7;O++)$.append(d("<span/>").text(s.shortDays[(O+c.firstDay)%7]));d("body").append(k)}if(c.trigger)L=d("<a/>").attr("href","#").addClass(f.trigger).click(function(b){h.show();return b.preventDefault()}).insertAfter(a);var K=k.find("#"+f.weeks);A=k.find("#"+f.year);z=k.find("#"+f.month);d.extend(h,{show:function(b){if(!(a.attr("readonly")||a.attr("disabled")||w)){b=b||d.Event();b.type="onBeforeShow";H.trigger(b);if(!b.isDefaultPrevented()){d.each(W,function(){this.hide()});
w=true;z.unbind("change").change(function(){h.setValue(A.val(),d(this).val())});A.unbind("change").change(function(){h.setValue(d(this).val(),z.val())});I=k.find("#"+f.prev).unbind("click").click(function(){I.hasClass(f.disabled)||h.addMonth(-1);return false});J=k.find("#"+f.next).unbind("click").click(function(){J.hasClass(f.disabled)||h.addMonth();return false});h.setValue(n);var e=a.offset();if(/iPad/i.test(navigator.userAgent))e.top-=d(window).scrollTop();k.css({top:e.top+a.outerHeight({margins:true})+
c.offset[0],left:e.left+c.offset[1]});if(c.speed)k.show(c.speed,function(){q(b)});else{k.show();q(b)}return h}}},setValue:function(b,e,g){var i=v(e)>=-1?new Date(v(b),v(e),v(g||1)):b||n;if(i<m)i=m;else if(i>p)i=p;b=i.getFullYear();e=i.getMonth();g=i.getDate();if(e==-1){e=11;b--}else if(e==12){e=0;b++}if(!w){j(i,c);return h}E=e;D=b;g=new Date(b,e,1-c.firstDay);g=g.getDay();var t=R(b,e),o=R(b,e-1),P;if(c.selectors){z.empty();d.each(s.months,function(x,F){m<new Date(b,x+1,-1)&&p>new Date(b,x,0)&&z.append(d("<option/>").html(F).attr("value",
x))});A.empty();i=r.getFullYear();for(var l=i+c.yearRange[0];l<i+c.yearRange[1];l++)m<=new Date(l+1,-1,1)&&p>new Date(l,0,0)&&A.append(d("<option/>").text(l));z.val(e);A.val(b)}else M.html(s.months[e]+" "+b);K.empty();I.add(J).removeClass(f.disabled);l=!g?-7:0;for(var u,y;l<(!g?35:42);l++){u=d("<a/>");if(l%7===0){P=d("<div/>").addClass(f.week);K.append(P)}if(l<g){u.addClass(f.off);y=o-g+l+1;i=new Date(b,e-1,y)}else if(l>=g+t){u.addClass(f.off);y=l-t-g+1;i=new Date(b,e+1,y)}else{y=l-g+1;i=new Date(b,
e,y);if(U(n,i))u.attr("id",f.current).addClass(f.focus);else U(r,i)&&u.attr("id",f.today)}m&&i<m&&u.add(I).addClass(f.disabled);p&&i>p&&u.add(J).addClass(f.disabled);u.attr("href","#"+y).text(y).data("date",i);P.append(u)}K.find("a").click(function(x){var F=d(this);if(!F.hasClass(f.disabled)){d("#"+f.current).removeAttr("id");F.attr("id",f.current);j(F.data("date"),c,x)}return false});f.sunday&&K.find(f.week).each(function(){var x=c.firstDay?7-c.firstDay:0;d(this).children().slice(x,x+1).addClass(f.sunday)});
return h},setMin:function(b,e){m=C(b);e&&n<m&&h.setValue(m);return h},setMax:function(b,e){p=C(b);e&&n>p&&h.setValue(p);return h},today:function(){return h.setValue(r)},addDay:function(b){return this.setValue(D,E,G+(b||1))},addMonth:function(b){return this.setValue(D,E+(b||1),G)},addYear:function(b){return this.setValue(D+(b||1),E,G)},hide:function(b){if(w){b=d.Event();b.type="onHide";H.trigger(b);d(document).unbind("click.d").unbind("keydown.d");if(b.isDefaultPrevented())return;k.hide();w=false}return h},
getConf:function(){return c},getInput:function(){return a},getCalendar:function(){return k},getValue:function(b){return b?T(n,b,c.lang):n},isOpen:function(){return w}});d.each(["onBeforeShow","onShow","change","onHide"],function(b,e){d.isFunction(c[e])&&d(h).bind(e,c[e]);h[e]=function(g){g&&d(h).bind(e,g);return h}});a.bind("focus click",h.show).keydown(function(b){var e=b.keyCode;if(!w&&d(V).index(e)>=0){h.show(b);return b.preventDefault()}return b.shiftKey||b.ctrlKey||b.altKey||e==9?true:b.preventDefault()});
C(a.val())&&j(n,c)}d.tools=d.tools||{version:"1.2.5"};var W=[],Q,V=[75,76,38,39,74,72,40,37],B={};Q=d.tools.dateinput={conf:{format:"mm/dd/yy",selectors:false,yearRange:[-5,5],lang:"en",offset:[0,0],speed:0,firstDay:0,min:undefined,max:undefined,trigger:false,css:{prefix:"cal",input:"date",root:0,head:0,title:0,prev:0,next:0,month:0,year:0,days:0,body:0,weeks:0,today:0,current:0,week:0,off:0,sunday:0,focus:0,disabled:0,trigger:0}},localize:function(a,c){d.each(c,function(j,q){c[j]=q.split(",")});
B[a]=c}};Q.localize("en",{months:"January,February,March,April,May,June,July,August,September,October,November,December",shortMonths:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec",days:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday",shortDays:"Sun,Mon,Tue,Wed,Thu,Fri,Sat"});var X=/d{1,4}|m{1,4}|yy(?:yy)?|"[^"]*"|'[^']*'/g,Y=d("<a/>");d.expr[":"].date=function(a){var c=a.getAttribute("type");return c&&c=="date"||!!d(a).data("dateinput")};d.fn.dateinput=function(a){if(this.data("dateinput"))return this;
a=d.extend(true,{},Q.conf,a);d.each(a.css,function(j,q){if(!q&&j!="prefix")a.css[j]=(a.css.prefix||"")+(q||j)});var c;this.each(function(){var j=new Z(d(this),a);W.push(j);j=j.getInput().data("dateinput",j);c=c?c.add(j):j});return c?c:this}})(jQuery);

/*
 
 jQuery Tools 1.2.5 / Expose - Dim the lights

 NO COPYRIGHTS OR LICENSES. DO WHAT YOU LIKE.

 http://flowplayer.org/tools/toolbox/expose.html

 Since: Mar 2010
 Date:    Wed Sep 22 06:02:10 2010 +0000 
*/
(function(b){function k(){if(b.browser.msie){var a=b(document).height(),d=b(window).height();return[window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,a-d<20?d:a]}return[b(document).width(),b(document).height()]}function h(a){if(a)return a.call(b.mask)}b.tools=b.tools||{version:"1.2.5"};var l;l=b.tools.expose={conf:{maskId:"exposeMask",loadSpeed:"slow",closeSpeed:"fast",closeOnClick:true,closeOnEsc:true,zIndex:9998,opacity:0.8,startOpacity:0,color:"#fff",onLoad:null,
onClose:null}};var c,i,e,g,j;b.mask={load:function(a,d){if(e)return this;if(typeof a=="string")a={color:a};a=a||g;g=a=b.extend(b.extend({},l.conf),a);c=b("#"+a.maskId);if(!c.length){c=b("<div/>").attr("id",a.maskId);b("body").append(c)}var m=k();c.css({position:"absolute",top:0,left:0,width:m[0],height:m[1],display:"none",opacity:a.startOpacity,zIndex:a.zIndex});a.color&&c.css("backgroundColor",a.color);if(h(a.onBeforeLoad)===false)return this;a.closeOnEsc&&b(document).bind("keydown.mask",function(f){f.keyCode==
27&&b.mask.close(f)});a.closeOnClick&&c.bind("click.mask",function(f){b.mask.close(f)});b(window).bind("resize.mask",function(){b.mask.fit()});if(d&&d.length){j=d.eq(0).css("zIndex");b.each(d,function(){var f=b(this);/relative|absolute|fixed/i.test(f.css("position"))||f.css("position","relative")});i=d.css({zIndex:Math.max(a.zIndex+1,j=="auto"?0:j)})}c.css({display:"block"}).fadeTo(a.loadSpeed,a.opacity,function(){b.mask.fit();h(a.onLoad);e="full"});e=true;return this},close:function(){if(e){if(h(g.onBeforeClose)===
false)return this;c.fadeOut(g.closeSpeed,function(){h(g.onClose);i&&i.css({zIndex:j});e=false});b(document).unbind("keydown.mask");c.unbind("click.mask");b(window).unbind("resize.mask")}return this},fit:function(){if(e){var a=k();c.css({width:a[0],height:a[1]})}},getMask:function(){return c},isLoaded:function(a){return a?e=="full":e},getConf:function(){return g},getExposed:function(){return i}};b.fn.mask=function(a){b.mask.load(a);return this};b.fn.expose=function(a){b.mask.load(a,this);return this}})(jQuery);(function(){jQuery.color={};jQuery.color.make=function(G,H,J,I){var A={};A.r=G||0;A.g=H||0;A.b=J||0;A.a=I!=null?I:1;A.add=function(C,D){for(var E=0;E<C.length;++E){A[C.charAt(E)]+=D}return A.normalize()};A.scale=function(C,D){for(var E=0;E<C.length;++E){A[C.charAt(E)]*=D}return A.normalize()};A.toString=function(){if(A.a>=1){return"rgb("+[A.r,A.g,A.b].join(",")+")"}else{return"rgba("+[A.r,A.g,A.b,A.a].join(",")+")"}};A.normalize=function(){function C(E,D,F){return D<E?E:(D>F?F:D)}A.r=C(0,parseInt(A.r),255);A.g=C(0,parseInt(A.g),255);A.b=C(0,parseInt(A.b),255);A.a=C(0,A.a,1);return A};A.clone=function(){return jQuery.color.make(A.r,A.b,A.g,A.a)};return A.normalize()};jQuery.color.extract=function(E,F){var A;do{A=E.css(F).toLowerCase();if(A!=""&&A!="transparent"){break}E=E.parent()}while(!jQuery.nodeName(E.get(0),"body"));if(A=="rgba(0, 0, 0, 0)"){A="transparent"}return jQuery.color.parse(A)};jQuery.color.parse=function(A){var F,H=jQuery.color.make;if(F=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(A)){return H(parseInt(F[1],10),parseInt(F[2],10),parseInt(F[3],10))}if(F=/rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(A)){return H(parseInt(F[1],10),parseInt(F[2],10),parseInt(F[3],10),parseFloat(F[4]))}if(F=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(A)){return H(parseFloat(F[1])*2.55,parseFloat(F[2])*2.55,parseFloat(F[3])*2.55)}if(F=/rgba\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(A)){return H(parseFloat(F[1])*2.55,parseFloat(F[2])*2.55,parseFloat(F[3])*2.55,parseFloat(F[4]))}if(F=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(A)){return H(parseInt(F[1],16),parseInt(F[2],16),parseInt(F[3],16))}if(F=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(A)){return H(parseInt(F[1]+F[1],16),parseInt(F[2]+F[2],16),parseInt(F[3]+F[3],16))}var G=jQuery.trim(A).toLowerCase();if(G=="transparent"){return H(255,255,255,0)}else{F=B[G];return H(F[0],F[1],F[2])}};var B={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0]}})();(function(C){function B(l,W,X,E){var O=[],g={colors:["#edc240","#afd8f8","#cb4b4b","#4da74d","#9440ed"],legend:{show:true,noColumns:1,labelFormatter:null,labelBoxBorderColor:"#ccc",container:null,position:"ne",margin:5,backgroundColor:null,backgroundOpacity:0.85},xaxis:{mode:null,transform:null,inverseTransform:null,min:null,max:null,autoscaleMargin:null,ticks:null,tickFormatter:null,labelWidth:null,labelHeight:null,tickDecimals:null,tickSize:null,minTickSize:null,monthNames:null,timeformat:null,twelveHourClock:false},yaxis:{autoscaleMargin:0.02},x2axis:{autoscaleMargin:null},y2axis:{autoscaleMargin:0.02},series:{points:{show:false,radius:3,lineWidth:2,fill:true,fillColor:"#ffffff"},lines:{lineWidth:2,fill:false,fillColor:null,steps:false},bars:{show:false,lineWidth:2,barWidth:1,fill:true,fillColor:null,align:"left",horizontal:false},shadowSize:3},grid:{show:true,aboveData:false,color:"#545454",backgroundColor:null,tickColor:"rgba(0,0,0,0.15)",labelMargin:5,borderWidth:2,borderColor:null,markings:null,markingsColor:"#f4f4f4",markingsLineWidth:2,clickable:false,hoverable:false,autoHighlight:true,mouseActiveRadius:10},hooks:{}},P=null,AC=null,AD=null,Y=null,AJ=null,s={xaxis:{},yaxis:{},x2axis:{},y2axis:{}},e={left:0,right:0,top:0,bottom:0},y=0,Q=0,I=0,t=0,L={processOptions:[],processRawData:[],processDatapoints:[],draw:[],bindEvents:[],drawOverlay:[]},G=this;G.setData=f;G.setupGrid=k;G.draw=AH;G.getPlaceholder=function(){return l};G.getCanvas=function(){return P};G.getPlotOffset=function(){return e};G.width=function(){return I};G.height=function(){return t};G.offset=function(){var AK=AD.offset();AK.left+=e.left;AK.top+=e.top;return AK};G.getData=function(){return O};G.getAxes=function(){return s};G.getOptions=function(){return g};G.highlight=AE;G.unhighlight=x;G.triggerRedrawOverlay=q;G.pointOffset=function(AK){return{left:parseInt(T(AK,"xaxis").p2c(+AK.x)+e.left),top:parseInt(T(AK,"yaxis").p2c(+AK.y)+e.top)}};G.hooks=L;b(G);r(X);c();f(W);k();AH();AG();function Z(AM,AK){AK=[G].concat(AK);for(var AL=0;AL<AM.length;++AL){AM[AL].apply(this,AK)}}function b(){for(var AK=0;AK<E.length;++AK){var AL=E[AK];AL.init(G);if(AL.options){C.extend(true,g,AL.options)}}}function r(AK){C.extend(true,g,AK);if(g.grid.borderColor==null){g.grid.borderColor=g.grid.color}if(g.xaxis.noTicks&&g.xaxis.ticks==null){g.xaxis.ticks=g.xaxis.noTicks}if(g.yaxis.noTicks&&g.yaxis.ticks==null){g.yaxis.ticks=g.yaxis.noTicks}if(g.grid.coloredAreas){g.grid.markings=g.grid.coloredAreas}if(g.grid.coloredAreasColor){g.grid.markingsColor=g.grid.coloredAreasColor}if(g.lines){C.extend(true,g.series.lines,g.lines)}if(g.points){C.extend(true,g.series.points,g.points)}if(g.bars){C.extend(true,g.series.bars,g.bars)}if(g.shadowSize){g.series.shadowSize=g.shadowSize}for(var AL in L){if(g.hooks[AL]&&g.hooks[AL].length){L[AL]=L[AL].concat(g.hooks[AL])}}Z(L.processOptions,[g])}function f(AK){O=M(AK);U();m()}function M(AN){var AL=[];for(var AK=0;AK<AN.length;++AK){var AM=C.extend(true,{},g.series);if(AN[AK].data){AM.data=AN[AK].data;delete AN[AK].data;C.extend(true,AM,AN[AK]);AN[AK].data=AM.data}else{AM.data=AN[AK]}AL.push(AM)}return AL}function T(AM,AK){var AL=AM[AK];if(!AL||AL==1){return s[AK]}if(typeof AL=="number"){return s[AK.charAt(0)+AL+AK.slice(1)]}return AL}function U(){var AP;var AV=O.length,AK=[],AN=[];for(AP=0;AP<O.length;++AP){var AS=O[AP].color;if(AS!=null){--AV;if(typeof AS=="number"){AN.push(AS)}else{AK.push(C.color.parse(O[AP].color))}}}for(AP=0;AP<AN.length;++AP){AV=Math.max(AV,AN[AP]+1)}var AL=[],AO=0;AP=0;while(AL.length<AV){var AR;if(g.colors.length==AP){AR=C.color.make(100,100,100)}else{AR=C.color.parse(g.colors[AP])}var AM=AO%2==1?-1:1;AR.scale("rgb",1+AM*Math.ceil(AO/2)*0.2);AL.push(AR);++AP;if(AP>=g.colors.length){AP=0;++AO}}var AQ=0,AW;for(AP=0;AP<O.length;++AP){AW=O[AP];if(AW.color==null){AW.color=AL[AQ].toString();++AQ}else{if(typeof AW.color=="number"){AW.color=AL[AW.color].toString()}}if(AW.lines.show==null){var AU,AT=true;for(AU in AW){if(AW[AU].show){AT=false;break}}if(AT){AW.lines.show=true}}AW.xaxis=T(AW,"xaxis");AW.yaxis=T(AW,"yaxis")}}function m(){var AW=Number.POSITIVE_INFINITY,AQ=Number.NEGATIVE_INFINITY,Ac,Aa,AZ,AV,AL,AR,Ab,AX,AP,AO,AK,Ai,Af,AT;for(AK in s){s[AK].datamin=AW;s[AK].datamax=AQ;s[AK].used=false}function AN(Al,Ak,Aj){if(Ak<Al.datamin){Al.datamin=Ak}if(Aj>Al.datamax){Al.datamax=Aj}}for(Ac=0;Ac<O.length;++Ac){AR=O[Ac];AR.datapoints={points:[]};Z(L.processRawData,[AR,AR.data,AR.datapoints])}for(Ac=0;Ac<O.length;++Ac){AR=O[Ac];var Ah=AR.data,Ae=AR.datapoints.format;if(!Ae){Ae=[];Ae.push({x:true,number:true,required:true});Ae.push({y:true,number:true,required:true});if(AR.bars.show){Ae.push({y:true,number:true,required:false,defaultValue:0})}AR.datapoints.format=Ae}if(AR.datapoints.pointsize!=null){continue}if(AR.datapoints.pointsize==null){AR.datapoints.pointsize=Ae.length}AX=AR.datapoints.pointsize;Ab=AR.datapoints.points;insertSteps=AR.lines.show&&AR.lines.steps;AR.xaxis.used=AR.yaxis.used=true;for(Aa=AZ=0;Aa<Ah.length;++Aa,AZ+=AX){AT=Ah[Aa];var AM=AT==null;if(!AM){for(AV=0;AV<AX;++AV){Ai=AT[AV];Af=Ae[AV];if(Af){if(Af.number&&Ai!=null){Ai=+Ai;if(isNaN(Ai)){Ai=null}}if(Ai==null){if(Af.required){AM=true}if(Af.defaultValue!=null){Ai=Af.defaultValue}}}Ab[AZ+AV]=Ai}}if(AM){for(AV=0;AV<AX;++AV){Ai=Ab[AZ+AV];if(Ai!=null){Af=Ae[AV];if(Af.x){AN(AR.xaxis,Ai,Ai)}if(Af.y){AN(AR.yaxis,Ai,Ai)}}Ab[AZ+AV]=null}}else{if(insertSteps&&AZ>0&&Ab[AZ-AX]!=null&&Ab[AZ-AX]!=Ab[AZ]&&Ab[AZ-AX+1]!=Ab[AZ+1]){for(AV=0;AV<AX;++AV){Ab[AZ+AX+AV]=Ab[AZ+AV]}Ab[AZ+1]=Ab[AZ-AX+1];AZ+=AX}}}}for(Ac=0;Ac<O.length;++Ac){AR=O[Ac];Z(L.processDatapoints,[AR,AR.datapoints])}for(Ac=0;Ac<O.length;++Ac){AR=O[Ac];Ab=AR.datapoints.points,AX=AR.datapoints.pointsize;var AS=AW,AY=AW,AU=AQ,Ad=AQ;for(Aa=0;Aa<Ab.length;Aa+=AX){if(Ab[Aa]==null){continue}for(AV=0;AV<AX;++AV){Ai=Ab[Aa+AV];Af=Ae[AV];if(!Af){continue}if(Af.x){if(Ai<AS){AS=Ai}if(Ai>AU){AU=Ai}}if(Af.y){if(Ai<AY){AY=Ai}if(Ai>Ad){Ad=Ai}}}}if(AR.bars.show){var Ag=AR.bars.align=="left"?0:-AR.bars.barWidth/2;if(AR.bars.horizontal){AY+=Ag;Ad+=Ag+AR.bars.barWidth}else{AS+=Ag;AU+=Ag+AR.bars.barWidth}}AN(AR.xaxis,AS,AU);AN(AR.yaxis,AY,Ad)}for(AK in s){if(s[AK].datamin==AW){s[AK].datamin=null}if(s[AK].datamax==AQ){s[AK].datamax=null}}}function c(){function AK(AM,AL){var AN=document.createElement("canvas");AN.width=AM;AN.height=AL;if(C.browser.msie){AN=window.G_vmlCanvasManager.initElement(AN)}return AN}y=l.width();Q=l.height();l.html("");if(l.css("position")=="static"){l.css("position","relative")}if(y<=0||Q<=0){throw"Invalid dimensions for plot, width = "+y+", height = "+Q}if(C.browser.msie){window.G_vmlCanvasManager.init_(document)}P=C(AK(y,Q)).appendTo(l).get(0);Y=P.getContext("2d");AC=C(AK(y,Q)).css({position:"absolute",left:0,top:0}).appendTo(l).get(0);AJ=AC.getContext("2d");AJ.stroke()}function AG(){AD=C([AC,P]);if(g.grid.hoverable){AD.mousemove(D)}if(g.grid.clickable){AD.click(d)}Z(L.bindEvents,[AD])}function k(){function AL(AT,AU){function AP(AV){return AV}var AS,AO,AQ=AU.transform||AP,AR=AU.inverseTransform;if(AT==s.xaxis||AT==s.x2axis){AS=AT.scale=I/(AQ(AT.max)-AQ(AT.min));AO=AQ(AT.min);if(AQ==AP){AT.p2c=function(AV){return(AV-AO)*AS}}else{AT.p2c=function(AV){return(AQ(AV)-AO)*AS}}if(!AR){AT.c2p=function(AV){return AO+AV/AS}}else{AT.c2p=function(AV){return AR(AO+AV/AS)}}}else{AS=AT.scale=t/(AQ(AT.max)-AQ(AT.min));AO=AQ(AT.max);if(AQ==AP){AT.p2c=function(AV){return(AO-AV)*AS}}else{AT.p2c=function(AV){return(AO-AQ(AV))*AS}}if(!AR){AT.c2p=function(AV){return AO-AV/AS}}else{AT.c2p=function(AV){return AR(AO-AV/AS)}}}}function AN(AR,AT){var AQ,AS=[],AP;AR.labelWidth=AT.labelWidth;AR.labelHeight=AT.labelHeight;if(AR==s.xaxis||AR==s.x2axis){if(AR.labelWidth==null){AR.labelWidth=y/(AR.ticks.length>0?AR.ticks.length:1)}if(AR.labelHeight==null){AS=[];for(AQ=0;AQ<AR.ticks.length;++AQ){AP=AR.ticks[AQ].label;if(AP){AS.push('<div class="tickLabel" style="float:left;width:'+AR.labelWidth+'px">'+AP+"</div>")}}if(AS.length>0){var AO=C('<div style="position:absolute;top:-10000px;width:10000px;font-size:smaller">'+AS.join("")+'<div style="clear:left"></div></div>').appendTo(l);AR.labelHeight=AO.height();AO.remove()}}}else{if(AR.labelWidth==null||AR.labelHeight==null){for(AQ=0;AQ<AR.ticks.length;++AQ){AP=AR.ticks[AQ].label;if(AP){AS.push('<div class="tickLabel">'+AP+"</div>")}}if(AS.length>0){var AO=C('<div style="position:absolute;top:-10000px;font-size:smaller">'+AS.join("")+"</div>").appendTo(l);if(AR.labelWidth==null){AR.labelWidth=AO.width()}if(AR.labelHeight==null){AR.labelHeight=AO.find("div").height()}AO.remove()}}}if(AR.labelWidth==null){AR.labelWidth=0}if(AR.labelHeight==null){AR.labelHeight=0}}function AM(){var AP=g.grid.borderWidth;for(i=0;i<O.length;++i){AP=Math.max(AP,2*(O[i].points.radius+O[i].points.lineWidth/2))}e.left=e.right=e.top=e.bottom=AP;var AO=g.grid.labelMargin+g.grid.borderWidth;if(s.xaxis.labelHeight>0){e.bottom=Math.max(AP,s.xaxis.labelHeight+AO)}if(s.yaxis.labelWidth>0){e.left=Math.max(AP,s.yaxis.labelWidth+AO)}if(s.x2axis.labelHeight>0){e.top=Math.max(AP,s.x2axis.labelHeight+AO)}if(s.y2axis.labelWidth>0){e.right=Math.max(AP,s.y2axis.labelWidth+AO)}I=y-e.left-e.right;t=Q-e.bottom-e.top}var AK;for(AK in s){K(s[AK],g[AK])}if(g.grid.show){for(AK in s){F(s[AK],g[AK]);p(s[AK],g[AK]);AN(s[AK],g[AK])}AM()}else{e.left=e.right=e.top=e.bottom=0;I=y;t=Q}for(AK in s){AL(s[AK],g[AK])}if(g.grid.show){h()}AI()}function K(AN,AQ){var AM=+(AQ.min!=null?AQ.min:AN.datamin),AK=+(AQ.max!=null?AQ.max:AN.datamax),AP=AK-AM;if(AP==0){var AL=AK==0?1:0.01;if(AQ.min==null){AM-=AL}if(AQ.max==null||AQ.min!=null){AK+=AL}}else{var AO=AQ.autoscaleMargin;if(AO!=null){if(AQ.min==null){AM-=AP*AO;if(AM<0&&AN.datamin!=null&&AN.datamin>=0){AM=0}}if(AQ.max==null){AK+=AP*AO;if(AK>0&&AN.datamax!=null&&AN.datamax<=0){AK=0}}}}AN.min=AM;AN.max=AK}function F(AP,AS){var AO;if(typeof AS.ticks=="number"&&AS.ticks>0){AO=AS.ticks}else{if(AP==s.xaxis||AP==s.x2axis){AO=0.3*Math.sqrt(y)}else{AO=0.3*Math.sqrt(Q)}}var AX=(AP.max-AP.min)/AO,AZ,AT,AV,AW,AR,AM,AL;if(AS.mode=="time"){var AU={second:1000,minute:60*1000,hour:60*60*1000,day:24*60*60*1000,month:30*24*60*60*1000,year:365.2425*24*60*60*1000};var AY=[[1,"second"],[2,"second"],[5,"second"],[10,"second"],[30,"second"],[1,"minute"],[2,"minute"],[5,"minute"],[10,"minute"],[30,"minute"],[1,"hour"],[2,"hour"],[4,"hour"],[8,"hour"],[12,"hour"],[1,"day"],[2,"day"],[3,"day"],[0.25,"month"],[0.5,"month"],[1,"month"],[2,"month"],[3,"month"],[6,"month"],[1,"year"]];var AN=0;if(AS.minTickSize!=null){if(typeof AS.tickSize=="number"){AN=AS.tickSize}else{AN=AS.minTickSize[0]*AU[AS.minTickSize[1]]}}for(AR=0;AR<AY.length-1;++AR){if(AX<(AY[AR][0]*AU[AY[AR][1]]+AY[AR+1][0]*AU[AY[AR+1][1]])/2&&AY[AR][0]*AU[AY[AR][1]]>=AN){break}}AZ=AY[AR][0];AV=AY[AR][1];if(AV=="year"){AM=Math.pow(10,Math.floor(Math.log(AX/AU.year)/Math.LN10));AL=(AX/AU.year)/AM;if(AL<1.5){AZ=1}else{if(AL<3){AZ=2}else{if(AL<7.5){AZ=5}else{AZ=10}}}AZ*=AM}if(AS.tickSize){AZ=AS.tickSize[0];AV=AS.tickSize[1]}AT=function(Ac){var Ah=[],Af=Ac.tickSize[0],Ai=Ac.tickSize[1],Ag=new Date(Ac.min);var Ab=Af*AU[Ai];if(Ai=="second"){Ag.setUTCSeconds(A(Ag.getUTCSeconds(),Af))}if(Ai=="minute"){Ag.setUTCMinutes(A(Ag.getUTCMinutes(),Af))}if(Ai=="hour"){Ag.setUTCHours(A(Ag.getUTCHours(),Af))}if(Ai=="month"){Ag.setUTCMonth(A(Ag.getUTCMonth(),Af))}if(Ai=="year"){Ag.setUTCFullYear(A(Ag.getUTCFullYear(),Af))}Ag.setUTCMilliseconds(0);if(Ab>=AU.minute){Ag.setUTCSeconds(0)}if(Ab>=AU.hour){Ag.setUTCMinutes(0)}if(Ab>=AU.day){Ag.setUTCHours(0)}if(Ab>=AU.day*4){Ag.setUTCDate(1)}if(Ab>=AU.year){Ag.setUTCMonth(0)}var Ak=0,Aj=Number.NaN,Ad;do{Ad=Aj;Aj=Ag.getTime();Ah.push({v:Aj,label:Ac.tickFormatter(Aj,Ac)});if(Ai=="month"){if(Af<1){Ag.setUTCDate(1);var Aa=Ag.getTime();Ag.setUTCMonth(Ag.getUTCMonth()+1);var Ae=Ag.getTime();Ag.setTime(Aj+Ak*AU.hour+(Ae-Aa)*Af);Ak=Ag.getUTCHours();Ag.setUTCHours(0)}else{Ag.setUTCMonth(Ag.getUTCMonth()+Af)}}else{if(Ai=="year"){Ag.setUTCFullYear(Ag.getUTCFullYear()+Af)}else{Ag.setTime(Aj+Ab)}}}while(Aj<Ac.max&&Aj!=Ad);return Ah};AW=function(Aa,Ad){var Af=new Date(Aa);if(AS.timeformat!=null){return C.plot.formatDate(Af,AS.timeformat,AS.monthNames)}var Ab=Ad.tickSize[0]*AU[Ad.tickSize[1]];var Ac=Ad.max-Ad.min;var Ae=(AS.twelveHourClock)?" %p":"";if(Ab<AU.minute){fmt="%h:%M:%S"+Ae}else{if(Ab<AU.day){if(Ac<2*AU.day){fmt="%h:%M"+Ae}else{fmt="%b %d %h:%M"+Ae}}else{if(Ab<AU.month){fmt="%b %d"}else{if(Ab<AU.year){if(Ac<AU.year){fmt="%b"}else{fmt="%b %y"}}else{fmt="%y"}}}}return C.plot.formatDate(Af,fmt,AS.monthNames)}}else{var AK=AS.tickDecimals;var AQ=-Math.floor(Math.log(AX)/Math.LN10);if(AK!=null&&AQ>AK){AQ=AK}AM=Math.pow(10,-AQ);AL=AX/AM;if(AL<1.5){AZ=1}else{if(AL<3){AZ=2;if(AL>2.25&&(AK==null||AQ+1<=AK)){AZ=2.5;++AQ}}else{if(AL<7.5){AZ=5}else{AZ=10}}}AZ*=AM;if(AS.minTickSize!=null&&AZ<AS.minTickSize){AZ=AS.minTickSize}if(AS.tickSize!=null){AZ=AS.tickSize}AP.tickDecimals=Math.max(0,(AK!=null)?AK:AQ);AT=function(Ac){var Ae=[];var Af=A(Ac.min,Ac.tickSize),Ab=0,Aa=Number.NaN,Ad;do{Ad=Aa;Aa=Af+Ab*Ac.tickSize;Ae.push({v:Aa,label:Ac.tickFormatter(Aa,Ac)});++Ab}while(Aa<Ac.max&&Aa!=Ad);return Ae};AW=function(Aa,Ab){return Aa.toFixed(Ab.tickDecimals)}}AP.tickSize=AV?[AZ,AV]:AZ;AP.tickGenerator=AT;if(C.isFunction(AS.tickFormatter)){AP.tickFormatter=function(Aa,Ab){return""+AS.tickFormatter(Aa,Ab)}}else{AP.tickFormatter=AW}}function p(AO,AQ){AO.ticks=[];if(!AO.used){return }if(AQ.ticks==null){AO.ticks=AO.tickGenerator(AO)}else{if(typeof AQ.ticks=="number"){if(AQ.ticks>0){AO.ticks=AO.tickGenerator(AO)}}else{if(AQ.ticks){var AP=AQ.ticks;if(C.isFunction(AP)){AP=AP({min:AO.min,max:AO.max})}var AN,AK;for(AN=0;AN<AP.length;++AN){var AL=null;var AM=AP[AN];if(typeof AM=="object"){AK=AM[0];if(AM.length>1){AL=AM[1]}}else{AK=AM}if(AL==null){AL=AO.tickFormatter(AK,AO)}AO.ticks[AN]={v:AK,label:AL}}}}}if(AQ.autoscaleMargin!=null&&AO.ticks.length>0){if(AQ.min==null){AO.min=Math.min(AO.min,AO.ticks[0].v)}if(AQ.max==null&&AO.ticks.length>1){AO.max=Math.max(AO.max,AO.ticks[AO.ticks.length-1].v)}}}function AH(){Y.clearRect(0,0,y,Q);var AL=g.grid;if(AL.show&&!AL.aboveData){S()}for(var AK=0;AK<O.length;++AK){AA(O[AK])}Z(L.draw,[Y]);if(AL.show&&AL.aboveData){S()}}function N(AL,AR){var AO=AR+"axis",AK=AR+"2axis",AN,AQ,AP,AM;if(AL[AO]){AN=s[AO];AQ=AL[AO].from;AP=AL[AO].to}else{if(AL[AK]){AN=s[AK];AQ=AL[AK].from;AP=AL[AK].to}else{AN=s[AO];AQ=AL[AR+"1"];AP=AL[AR+"2"]}}if(AQ!=null&&AP!=null&&AQ>AP){return{from:AP,to:AQ,axis:AN}}return{from:AQ,to:AP,axis:AN}}function S(){var AO;Y.save();Y.translate(e.left,e.top);if(g.grid.backgroundColor){Y.fillStyle=R(g.grid.backgroundColor,t,0,"rgba(255, 255, 255, 0)");Y.fillRect(0,0,I,t)}var AL=g.grid.markings;if(AL){if(C.isFunction(AL)){AL=AL({xmin:s.xaxis.min,xmax:s.xaxis.max,ymin:s.yaxis.min,ymax:s.yaxis.max,xaxis:s.xaxis,yaxis:s.yaxis,x2axis:s.x2axis,y2axis:s.y2axis})}for(AO=0;AO<AL.length;++AO){var AK=AL[AO],AQ=N(AK,"x"),AN=N(AK,"y");if(AQ.from==null){AQ.from=AQ.axis.min}if(AQ.to==null){AQ.to=AQ.axis.max}if(AN.from==null){AN.from=AN.axis.min}if(AN.to==null){AN.to=AN.axis.max}if(AQ.to<AQ.axis.min||AQ.from>AQ.axis.max||AN.to<AN.axis.min||AN.from>AN.axis.max){continue}AQ.from=Math.max(AQ.from,AQ.axis.min);AQ.to=Math.min(AQ.to,AQ.axis.max);AN.from=Math.max(AN.from,AN.axis.min);AN.to=Math.min(AN.to,AN.axis.max);if(AQ.from==AQ.to&&AN.from==AN.to){continue}AQ.from=AQ.axis.p2c(AQ.from);AQ.to=AQ.axis.p2c(AQ.to);AN.from=AN.axis.p2c(AN.from);AN.to=AN.axis.p2c(AN.to);if(AQ.from==AQ.to||AN.from==AN.to){Y.beginPath();Y.strokeStyle=AK.color||g.grid.markingsColor;Y.lineWidth=AK.lineWidth||g.grid.markingsLineWidth;Y.moveTo(AQ.from,AN.from);Y.lineTo(AQ.to,AN.to);Y.stroke()}else{Y.fillStyle=AK.color||g.grid.markingsColor;Y.fillRect(AQ.from,AN.to,AQ.to-AQ.from,AN.from-AN.to)}}}Y.lineWidth=1;Y.strokeStyle=g.grid.tickColor;Y.beginPath();var AM,AP=s.xaxis;for(AO=0;AO<AP.ticks.length;++AO){AM=AP.ticks[AO].v;if(AM<=AP.min||AM>=s.xaxis.max){continue}Y.moveTo(Math.floor(AP.p2c(AM))+Y.lineWidth/2,0);Y.lineTo(Math.floor(AP.p2c(AM))+Y.lineWidth/2,t)}AP=s.yaxis;for(AO=0;AO<AP.ticks.length;++AO){AM=AP.ticks[AO].v;if(AM<=AP.min||AM>=AP.max){continue}Y.moveTo(0,Math.floor(AP.p2c(AM))+Y.lineWidth/2);Y.lineTo(I,Math.floor(AP.p2c(AM))+Y.lineWidth/2)}AP=s.x2axis;for(AO=0;AO<AP.ticks.length;++AO){AM=AP.ticks[AO].v;if(AM<=AP.min||AM>=AP.max){continue}Y.moveTo(Math.floor(AP.p2c(AM))+Y.lineWidth/2,-5);Y.lineTo(Math.floor(AP.p2c(AM))+Y.lineWidth/2,5)}AP=s.y2axis;for(AO=0;AO<AP.ticks.length;++AO){AM=AP.ticks[AO].v;if(AM<=AP.min||AM>=AP.max){continue}Y.moveTo(I-5,Math.floor(AP.p2c(AM))+Y.lineWidth/2);Y.lineTo(I+5,Math.floor(AP.p2c(AM))+Y.lineWidth/2)}Y.stroke();if(g.grid.borderWidth){var AR=g.grid.borderWidth;Y.lineWidth=AR;Y.strokeStyle=g.grid.borderColor;Y.strokeRect(-AR/2,-AR/2,I+AR,t+AR)}Y.restore()}function h(){l.find(".tickLabels").remove();var AK=['<div class="tickLabels" style="font-size:smaller;color:'+g.grid.color+'">'];function AM(AP,AQ){for(var AO=0;AO<AP.ticks.length;++AO){var AN=AP.ticks[AO];if(!AN.label||AN.v<AP.min||AN.v>AP.max){continue}AK.push(AQ(AN,AP))}}var AL=g.grid.labelMargin+g.grid.borderWidth;AM(s.xaxis,function(AN,AO){return'<div style="position:absolute;top:'+(e.top+t+AL)+"px;left:"+Math.round(e.left+AO.p2c(AN.v)-AO.labelWidth/2)+"px;width:"+AO.labelWidth+'px;text-align:center" class="tickLabel">'+AN.label+"</div>"});AM(s.yaxis,function(AN,AO){return'<div style="position:absolute;top:'+Math.round(e.top+AO.p2c(AN.v)-AO.labelHeight/2)+"px;right:"+(e.right+I+AL)+"px;width:"+AO.labelWidth+'px;text-align:right" class="tickLabel">'+AN.label+"</div>"});AM(s.x2axis,function(AN,AO){return'<div style="position:absolute;bottom:'+(e.bottom+t+AL)+"px;left:"+Math.round(e.left+AO.p2c(AN.v)-AO.labelWidth/2)+"px;width:"+AO.labelWidth+'px;text-align:center" class="tickLabel">'+AN.label+"</div>"});AM(s.y2axis,function(AN,AO){return'<div style="position:absolute;top:'+Math.round(e.top+AO.p2c(AN.v)-AO.labelHeight/2)+"px;left:"+(e.left+I+AL)+"px;width:"+AO.labelWidth+'px;text-align:left" class="tickLabel">'+AN.label+"</div>"});AK.push("</div>");l.append(AK.join(""))}function AA(AK){if(AK.lines.show){a(AK)}if(AK.bars.show){n(AK)}if(AK.points.show){o(AK)}}function a(AN){function AM(AY,AZ,AR,Ad,Ac){var Ae=AY.points,AS=AY.pointsize,AW=null,AV=null;Y.beginPath();for(var AX=AS;AX<Ae.length;AX+=AS){var AU=Ae[AX-AS],Ab=Ae[AX-AS+1],AT=Ae[AX],Aa=Ae[AX+1];if(AU==null||AT==null){continue}if(Ab<=Aa&&Ab<Ac.min){if(Aa<Ac.min){continue}AU=(Ac.min-Ab)/(Aa-Ab)*(AT-AU)+AU;Ab=Ac.min}else{if(Aa<=Ab&&Aa<Ac.min){if(Ab<Ac.min){continue}AT=(Ac.min-Ab)/(Aa-Ab)*(AT-AU)+AU;Aa=Ac.min}}if(Ab>=Aa&&Ab>Ac.max){if(Aa>Ac.max){continue}AU=(Ac.max-Ab)/(Aa-Ab)*(AT-AU)+AU;Ab=Ac.max}else{if(Aa>=Ab&&Aa>Ac.max){if(Ab>Ac.max){continue}AT=(Ac.max-Ab)/(Aa-Ab)*(AT-AU)+AU;Aa=Ac.max}}if(AU<=AT&&AU<Ad.min){if(AT<Ad.min){continue}Ab=(Ad.min-AU)/(AT-AU)*(Aa-Ab)+Ab;AU=Ad.min}else{if(AT<=AU&&AT<Ad.min){if(AU<Ad.min){continue}Aa=(Ad.min-AU)/(AT-AU)*(Aa-Ab)+Ab;AT=Ad.min}}if(AU>=AT&&AU>Ad.max){if(AT>Ad.max){continue}Ab=(Ad.max-AU)/(AT-AU)*(Aa-Ab)+Ab;AU=Ad.max}else{if(AT>=AU&&AT>Ad.max){if(AU>Ad.max){continue}Aa=(Ad.max-AU)/(AT-AU)*(Aa-Ab)+Ab;AT=Ad.max}}if(AU!=AW||Ab!=AV){Y.moveTo(Ad.p2c(AU)+AZ,Ac.p2c(Ab)+AR)}AW=AT;AV=Aa;Y.lineTo(Ad.p2c(AT)+AZ,Ac.p2c(Aa)+AR)}Y.stroke()}function AO(AX,Ae,Ac){var Af=AX.points,AR=AX.pointsize,AS=Math.min(Math.max(0,Ac.min),Ac.max),Aa,AV=0,Ad=false;for(var AW=AR;AW<Af.length;AW+=AR){var AU=Af[AW-AR],Ab=Af[AW-AR+1],AT=Af[AW],AZ=Af[AW+1];if(Ad&&AU!=null&&AT==null){Y.lineTo(Ae.p2c(AV),Ac.p2c(AS));Y.fill();Ad=false;continue}if(AU==null||AT==null){continue}if(AU<=AT&&AU<Ae.min){if(AT<Ae.min){continue}Ab=(Ae.min-AU)/(AT-AU)*(AZ-Ab)+Ab;AU=Ae.min}else{if(AT<=AU&&AT<Ae.min){if(AU<Ae.min){continue}AZ=(Ae.min-AU)/(AT-AU)*(AZ-Ab)+Ab;AT=Ae.min}}if(AU>=AT&&AU>Ae.max){if(AT>Ae.max){continue}Ab=(Ae.max-AU)/(AT-AU)*(AZ-Ab)+Ab;AU=Ae.max}else{if(AT>=AU&&AT>Ae.max){if(AU>Ae.max){continue}AZ=(Ae.max-AU)/(AT-AU)*(AZ-Ab)+Ab;AT=Ae.max}}if(!Ad){Y.beginPath();Y.moveTo(Ae.p2c(AU),Ac.p2c(AS));Ad=true}if(Ab>=Ac.max&&AZ>=Ac.max){Y.lineTo(Ae.p2c(AU),Ac.p2c(Ac.max));Y.lineTo(Ae.p2c(AT),Ac.p2c(Ac.max));AV=AT;continue}else{if(Ab<=Ac.min&&AZ<=Ac.min){Y.lineTo(Ae.p2c(AU),Ac.p2c(Ac.min));Y.lineTo(Ae.p2c(AT),Ac.p2c(Ac.min));AV=AT;continue}}var Ag=AU,AY=AT;if(Ab<=AZ&&Ab<Ac.min&&AZ>=Ac.min){AU=(Ac.min-Ab)/(AZ-Ab)*(AT-AU)+AU;Ab=Ac.min}else{if(AZ<=Ab&&AZ<Ac.min&&Ab>=Ac.min){AT=(Ac.min-Ab)/(AZ-Ab)*(AT-AU)+AU;AZ=Ac.min}}if(Ab>=AZ&&Ab>Ac.max&&AZ<=Ac.max){AU=(Ac.max-Ab)/(AZ-Ab)*(AT-AU)+AU;Ab=Ac.max}else{if(AZ>=Ab&&AZ>Ac.max&&Ab<=Ac.max){AT=(Ac.max-Ab)/(AZ-Ab)*(AT-AU)+AU;AZ=Ac.max}}if(AU!=Ag){if(Ab<=Ac.min){Aa=Ac.min}else{Aa=Ac.max}Y.lineTo(Ae.p2c(Ag),Ac.p2c(Aa));Y.lineTo(Ae.p2c(AU),Ac.p2c(Aa))}Y.lineTo(Ae.p2c(AU),Ac.p2c(Ab));Y.lineTo(Ae.p2c(AT),Ac.p2c(AZ));if(AT!=AY){if(AZ<=Ac.min){Aa=Ac.min}else{Aa=Ac.max}Y.lineTo(Ae.p2c(AT),Ac.p2c(Aa));Y.lineTo(Ae.p2c(AY),Ac.p2c(Aa))}AV=Math.max(AT,AY)}if(Ad){Y.lineTo(Ae.p2c(AV),Ac.p2c(AS));Y.fill()}}Y.save();Y.translate(e.left,e.top);Y.lineJoin="round";var AP=AN.lines.lineWidth,AK=AN.shadowSize;if(AP>0&&AK>0){Y.lineWidth=AK;Y.strokeStyle="rgba(0,0,0,0.1)";var AQ=Math.PI/18;AM(AN.datapoints,Math.sin(AQ)*(AP/2+AK/2),Math.cos(AQ)*(AP/2+AK/2),AN.xaxis,AN.yaxis);Y.lineWidth=AK/2;AM(AN.datapoints,Math.sin(AQ)*(AP/2+AK/4),Math.cos(AQ)*(AP/2+AK/4),AN.xaxis,AN.yaxis)}Y.lineWidth=AP;Y.strokeStyle=AN.color;var AL=V(AN.lines,AN.color,0,t);if(AL){Y.fillStyle=AL;AO(AN.datapoints,AN.xaxis,AN.yaxis)}if(AP>0){AM(AN.datapoints,0,0,AN.xaxis,AN.yaxis)}Y.restore()}function o(AN){function AP(AU,AT,Ab,AR,AV,AZ,AY){var Aa=AU.points,AQ=AU.pointsize;for(var AS=0;AS<Aa.length;AS+=AQ){var AX=Aa[AS],AW=Aa[AS+1];if(AX==null||AX<AZ.min||AX>AZ.max||AW<AY.min||AW>AY.max){continue}Y.beginPath();Y.arc(AZ.p2c(AX),AY.p2c(AW)+AR,AT,0,AV,false);if(Ab){Y.fillStyle=Ab;Y.fill()}Y.stroke()}}Y.save();Y.translate(e.left,e.top);var AO=AN.lines.lineWidth,AL=AN.shadowSize,AK=AN.points.radius;if(AO>0&&AL>0){var AM=AL/2;Y.lineWidth=AM;Y.strokeStyle="rgba(0,0,0,0.1)";AP(AN.datapoints,AK,null,AM+AM/2,Math.PI,AN.xaxis,AN.yaxis);Y.strokeStyle="rgba(0,0,0,0.2)";AP(AN.datapoints,AK,null,AM/2,Math.PI,AN.xaxis,AN.yaxis)}Y.lineWidth=AO;Y.strokeStyle=AN.color;AP(AN.datapoints,AK,V(AN.points,AN.color),0,2*Math.PI,AN.xaxis,AN.yaxis);Y.restore()}function AB(AV,AU,Ad,AQ,AY,AN,AL,AT,AS,Ac,AZ){var AM,Ab,AR,AX,AO,AK,AW,AP,Aa;if(AZ){AP=AK=AW=true;AO=false;AM=Ad;Ab=AV;AX=AU+AQ;AR=AU+AY;if(Ab<AM){Aa=Ab;Ab=AM;AM=Aa;AO=true;AK=false}}else{AO=AK=AW=true;AP=false;AM=AV+AQ;Ab=AV+AY;AR=Ad;AX=AU;if(AX<AR){Aa=AX;AX=AR;AR=Aa;AP=true;AW=false}}if(Ab<AT.min||AM>AT.max||AX<AS.min||AR>AS.max){return }if(AM<AT.min){AM=AT.min;AO=false}if(Ab>AT.max){Ab=AT.max;AK=false}if(AR<AS.min){AR=AS.min;AP=false}if(AX>AS.max){AX=AS.max;AW=false}AM=AT.p2c(AM);AR=AS.p2c(AR);Ab=AT.p2c(Ab);AX=AS.p2c(AX);if(AL){Ac.beginPath();Ac.moveTo(AM,AR);Ac.lineTo(AM,AX);Ac.lineTo(Ab,AX);Ac.lineTo(Ab,AR);Ac.fillStyle=AL(AR,AX);Ac.fill()}if(AO||AK||AW||AP){Ac.beginPath();Ac.moveTo(AM,AR+AN);if(AO){Ac.lineTo(AM,AX+AN)}else{Ac.moveTo(AM,AX+AN)}if(AW){Ac.lineTo(Ab,AX+AN)}else{Ac.moveTo(Ab,AX+AN)}if(AK){Ac.lineTo(Ab,AR+AN)}else{Ac.moveTo(Ab,AR+AN)}if(AP){Ac.lineTo(AM,AR+AN)}else{Ac.moveTo(AM,AR+AN)}Ac.stroke()}}function n(AM){function AL(AS,AR,AU,AP,AT,AW,AV){var AX=AS.points,AO=AS.pointsize;for(var AQ=0;AQ<AX.length;AQ+=AO){if(AX[AQ]==null){continue}AB(AX[AQ],AX[AQ+1],AX[AQ+2],AR,AU,AP,AT,AW,AV,Y,AM.bars.horizontal)}}Y.save();Y.translate(e.left,e.top);Y.lineWidth=AM.bars.lineWidth;Y.strokeStyle=AM.color;var AK=AM.bars.align=="left"?0:-AM.bars.barWidth/2;var AN=AM.bars.fill?function(AO,AP){return V(AM.bars,AM.color,AO,AP)}:null;AL(AM.datapoints,AK,AK+AM.bars.barWidth,0,AN,AM.xaxis,AM.yaxis);Y.restore()}function V(AM,AK,AL,AO){var AN=AM.fill;if(!AN){return null}if(AM.fillColor){return R(AM.fillColor,AL,AO,AK)}var AP=C.color.parse(AK);AP.a=typeof AN=="number"?AN:0.4;AP.normalize();return AP.toString()}function AI(){l.find(".legend").remove();if(!g.legend.show){return }var AP=[],AN=false,AV=g.legend.labelFormatter,AU,AR;for(i=0;i<O.length;++i){AU=O[i];AR=AU.label;if(!AR){continue}if(i%g.legend.noColumns==0){if(AN){AP.push("</tr>")}AP.push("<tr>");AN=true}if(AV){AR=AV(AR,AU)}AP.push('<td class="legendColorBox"><div style="border:1px solid '+g.legend.labelBoxBorderColor+';padding:1px"><div style="width:4px;height:0;border:5px solid '+AU.color+';overflow:hidden"></div></div></td><td class="legendLabel">'+AR+"</td>")}if(AN){AP.push("</tr>")}if(AP.length==0){return }var AT='<table style="font-size:smaller;color:'+g.grid.color+'">'+AP.join("")+"</table>";if(g.legend.container!=null){C(g.legend.container).html(AT)}else{var AQ="",AL=g.legend.position,AM=g.legend.margin;if(AM[0]==null){AM=[AM,AM]}if(AL.charAt(0)=="n"){AQ+="top:"+(AM[1]+e.top)+"px;"}else{if(AL.charAt(0)=="s"){AQ+="bottom:"+(AM[1]+e.bottom)+"px;"}}if(AL.charAt(1)=="e"){AQ+="right:"+(AM[0]+e.right)+"px;"}else{if(AL.charAt(1)=="w"){AQ+="left:"+(AM[0]+e.left)+"px;"}}var AS=C('<div class="legend">'+AT.replace('style="','style="position:absolute;'+AQ+";")+"</div>").appendTo(l);if(g.legend.backgroundOpacity!=0){var AO=g.legend.backgroundColor;if(AO==null){AO=g.grid.backgroundColor;if(AO&&typeof AO=="string"){AO=C.color.parse(AO)}else{AO=C.color.extract(AS,"background-color")}AO.a=1;AO=AO.toString()}var AK=AS.children();C('<div style="position:absolute;width:'+AK.width()+"px;height:"+AK.height()+"px;"+AQ+"background-color:"+AO+';"> </div>').prependTo(AS).css("opacity",g.legend.backgroundOpacity)}}}var w=[],J=null;function AF(AR,AP,AM){var AX=g.grid.mouseActiveRadius,Aj=AX*AX+1,Ah=null,Aa=false,Af,Ad;for(Af=0;Af<O.length;++Af){if(!AM(O[Af])){continue}var AY=O[Af],AQ=AY.xaxis,AO=AY.yaxis,Ae=AY.datapoints.points,Ac=AY.datapoints.pointsize,AZ=AQ.c2p(AR),AW=AO.c2p(AP),AL=AX/AQ.scale,AK=AX/AO.scale;if(AY.lines.show||AY.points.show){for(Ad=0;Ad<Ae.length;Ad+=Ac){var AT=Ae[Ad],AS=Ae[Ad+1];if(AT==null){continue}if(AT-AZ>AL||AT-AZ<-AL||AS-AW>AK||AS-AW<-AK){continue}var AV=Math.abs(AQ.p2c(AT)-AR),AU=Math.abs(AO.p2c(AS)-AP),Ab=AV*AV+AU*AU;if(Ab<=Aj){Aj=Ab;Ah=[Af,Ad/Ac]}}}if(AY.bars.show&&!Ah){var AN=AY.bars.align=="left"?0:-AY.bars.barWidth/2,Ag=AN+AY.bars.barWidth;for(Ad=0;Ad<Ae.length;Ad+=Ac){var AT=Ae[Ad],AS=Ae[Ad+1],Ai=Ae[Ad+2];if(AT==null){continue}if(O[Af].bars.horizontal?(AZ<=Math.max(Ai,AT)&&AZ>=Math.min(Ai,AT)&&AW>=AS+AN&&AW<=AS+Ag):(AZ>=AT+AN&&AZ<=AT+Ag&&AW>=Math.min(Ai,AS)&&AW<=Math.max(Ai,AS))){Ah=[Af,Ad/Ac]}}}}if(Ah){Af=Ah[0];Ad=Ah[1];Ac=O[Af].datapoints.pointsize;return{datapoint:O[Af].datapoints.points.slice(Ad*Ac,(Ad+1)*Ac),dataIndex:Ad,series:O[Af],seriesIndex:Af}}return null}function D(AK){if(g.grid.hoverable){H("plothover",AK,function(AL){return AL.hoverable!=false})}}function d(AK){H("plotclick",AK,function(AL){return AL.clickable!=false})}function H(AL,AK,AM){var AN=AD.offset(),AS={pageX:AK.pageX,pageY:AK.pageY},AQ=AK.pageX-AN.left-e.left,AO=AK.pageY-AN.top-e.top;if(s.xaxis.used){AS.x=s.xaxis.c2p(AQ)}if(s.yaxis.used){AS.y=s.yaxis.c2p(AO)}if(s.x2axis.used){AS.x2=s.x2axis.c2p(AQ)}if(s.y2axis.used){AS.y2=s.y2axis.c2p(AO)}var AT=AF(AQ,AO,AM);if(AT){AT.pageX=parseInt(AT.series.xaxis.p2c(AT.datapoint[0])+AN.left+e.left);AT.pageY=parseInt(AT.series.yaxis.p2c(AT.datapoint[1])+AN.top+e.top)}if(g.grid.autoHighlight){for(var AP=0;AP<w.length;++AP){var AR=w[AP];if(AR.auto==AL&&!(AT&&AR.series==AT.series&&AR.point==AT.datapoint)){x(AR.series,AR.point)}}if(AT){AE(AT.series,AT.datapoint,AL)}}l.trigger(AL,[AS,AT])}function q(){if(!J){J=setTimeout(v,30)}}function v(){J=null;AJ.save();AJ.clearRect(0,0,y,Q);AJ.translate(e.left,e.top);var AL,AK;for(AL=0;AL<w.length;++AL){AK=w[AL];if(AK.series.bars.show){z(AK.series,AK.point)}else{u(AK.series,AK.point)}}AJ.restore();Z(L.drawOverlay,[AJ])}function AE(AM,AK,AN){if(typeof AM=="number"){AM=O[AM]}if(typeof AK=="number"){AK=AM.data[AK]}var AL=j(AM,AK);if(AL==-1){w.push({series:AM,point:AK,auto:AN});q()}else{if(!AN){w[AL].auto=false}}}function x(AM,AK){if(AM==null&&AK==null){w=[];q()}if(typeof AM=="number"){AM=O[AM]}if(typeof AK=="number"){AK=AM.data[AK]}var AL=j(AM,AK);if(AL!=-1){w.splice(AL,1);q()}}function j(AM,AN){for(var AK=0;AK<w.length;++AK){var AL=w[AK];if(AL.series==AM&&AL.point[0]==AN[0]&&AL.point[1]==AN[1]){return AK}}return -1}function u(AN,AM){var AL=AM[0],AR=AM[1],AQ=AN.xaxis,AP=AN.yaxis;if(AL<AQ.min||AL>AQ.max||AR<AP.min||AR>AP.max){return }var AO=AN.points.radius+AN.points.lineWidth/2;AJ.lineWidth=AO;AJ.strokeStyle=C.color.parse(AN.color).scale("a",0.5).toString();var AK=1.5*AO;AJ.beginPath();AJ.arc(AQ.p2c(AL),AP.p2c(AR),AK,0,2*Math.PI,false);AJ.stroke()}function z(AN,AK){AJ.lineWidth=AN.bars.lineWidth;AJ.strokeStyle=C.color.parse(AN.color).scale("a",0.5).toString();var AM=C.color.parse(AN.color).scale("a",0.5).toString();var AL=AN.bars.align=="left"?0:-AN.bars.barWidth/2;AB(AK[0],AK[1],AK[2]||0,AL,AL+AN.bars.barWidth,0,function(){return AM},AN.xaxis,AN.yaxis,AJ,AN.bars.horizontal)}function R(AM,AL,AQ,AO){if(typeof AM=="string"){return AM}else{var AP=Y.createLinearGradient(0,AQ,0,AL);for(var AN=0,AK=AM.colors.length;AN<AK;++AN){var AR=AM.colors[AN];if(typeof AR!="string"){AR=C.color.parse(AO).scale("rgb",AR.brightness);AR.a*=AR.opacity;AR=AR.toString()}AP.addColorStop(AN/(AK-1),AR)}return AP}}}C.plot=function(G,E,D){var F=new B(C(G),E,D,C.plot.plugins);return F};C.plot.plugins=[];C.plot.formatDate=function(H,E,G){var L=function(N){N=""+N;return N.length==1?"0"+N:N};var D=[];var M=false;var K=H.getUTCHours();var I=K<12;if(G==null){G=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}if(E.search(/%p|%P/)!=-1){if(K>12){K=K-12}else{if(K==0){K=12}}}for(var F=0;F<E.length;++F){var J=E.charAt(F);if(M){switch(J){case"h":J=""+K;break;case"H":J=L(K);break;case"M":J=L(H.getUTCMinutes());break;case"S":J=L(H.getUTCSeconds());break;case"d":J=""+H.getUTCDate();break;case"m":J=""+(H.getUTCMonth()+1);break;case"y":J=""+H.getUTCFullYear();break;case"b":J=""+G[H.getUTCMonth()];break;case"p":J=(I)?("am"):("pm");break;case"P":J=(I)?("AM"):("PM");break}D.push(J);M=false}else{if(J=="%"){M=true}else{D.push(J)}}}return D.join("")};function A(E,D){return D*Math.floor(E/D)}})(jQuery);/*!
 * liScroll 1.0
 * Examples and documentation at: 
 * http://www.gcmingati.net/wordpress/wp-content/lab/jquery/newsticker/jq-liscroll/scrollanimate.html
 * 2007-2010 Gian Carlo Mingati
 * Version: 1.0.2 (30-MARCH-2009)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 * Requires:
 * jQuery v1.2.x or later
 * 
 */
jQuery.fn.liScroll=function(settings){settings=jQuery.extend({travelocity:0.07},settings);return this.each(function(){var $strip=jQuery(this);var width=$strip.attr("data-width");var height=$strip.attr("data-height");var color=$strip.attr("data-color");$strip.addClass("newsticker").css("left",width+"px");var stripWidth=0;var $mask=$strip.wrap("<div class='mask'></div>");var $tickercontainer=$strip.parent().wrap("<div class='tickercontainer'></div>");$strip.parent().parent().css("width",width+"px").css("height",height+"px");var containerWidth=$strip.parent().parent().width();$strip.find("li").each(function(i){$(this).find("a, span").each(function(){$(this).css("color",color);});stripWidth+=jQuery(this,i).outerWidth(true);});$strip.width(stripWidth);var totalTravel=stripWidth+containerWidth;var defTiming=totalTravel/settings.travelocity;function scrollnews(spazio,tempo){$strip.animate({left:'-='+spazio},tempo,"linear",function(){$strip.css("left",containerWidth);scrollnews(totalTravel,defTiming);});}scrollnews(totalTravel,defTiming);$strip.hover(function(){jQuery(this).stop();},function(){var offset=jQuery(this).offset();var residualSpace=offset.left+stripWidth;var residualTime=residualSpace/settings.travelocity;scrollnews(residualSpace,residualTime);});});};/**
 * jQuery lightBox plugin
 * This jQuery plugin was inspired and based on Lightbox 2 by Lokesh Dhakar (http://www.huddletogether.com/projects/lightbox2/)
 * and adapted to me for use like a plugin from jQuery.
 * @name jquery-lightbox-0.5.js
 * @author Leandro Vieira Pinho - http://leandrovieira.com
 * @version 0.5
 * @date April 11, 2008
 * @category jQuery plugin
 * @copyright (c) 2008 Leandro Vieira Pinho (leandrovieira.com)
 * @license CCAttribution-ShareAlike 2.5 Brazil - http://creativecommons.org/licenses/by-sa/2.5/br/deed.en_US
 * @example Visit http://leandrovieira.com/projects/jquery/lightbox/ for more informations about this jQuery plugin
 */
(function($){$.fn.lightBox=function(settings){settings=jQuery.extend({overlayBgColor:'#000',overlayOpacity:0.8,fixedNavigation:false,imageLoading:'images/lightbox-ico-loading.gif',imageBtnPrev:'images/lightbox-btn-prev.gif',imageBtnNext:'images/lightbox-btn-next.gif',imageBtnClose:'images/lightbox-btn-close.gif',imageBlank:'images/lightbox-blank.gif',containerBorderSize:10,containerResizeSpeed:400,txtImage:'Image',txtOf:'of',keyToClose:'c',keyToPrev:'p',keyToNext:'n',imageArray:[],activeImage:0},settings);var jQueryMatchedObj=this;function _initialize(){_start(this,jQueryMatchedObj);return false;}
function _start(objClicked,jQueryMatchedObj){$('embed, object, select').css({'visibility':'hidden'});_set_interface();settings.imageArray.length=0;settings.activeImage=0;if(jQueryMatchedObj.length==1){settings.imageArray.push(new Array(objClicked.getAttribute('href'),objClicked.getAttribute('title')));}else{for(var i=0;i<jQueryMatchedObj.length;i++){settings.imageArray.push(new Array(jQueryMatchedObj[i].getAttribute('href'),jQueryMatchedObj[i].getAttribute('title')));}}
while(settings.imageArray[settings.activeImage][0]!=objClicked.getAttribute('href')){settings.activeImage++;}
_set_image_to_view();}
function _set_interface(){$('body').append('<div id="jquery-overlay"></div><div id="jquery-lightbox"><div id="lightbox-container-image-box"><div id="lightbox-container-image"><img id="lightbox-image"><div style="" id="lightbox-nav"><a href="#" id="lightbox-nav-btnPrev"></a><a href="#" id="lightbox-nav-btnNext"></a></div><div id="lightbox-loading"><a href="#" id="lightbox-loading-link"><img src="'+settings.imageLoading+'"></a></div></div></div><div id="lightbox-container-image-data-box"><div id="lightbox-container-image-data"><div id="lightbox-image-details"><span id="lightbox-image-details-caption"></span><span id="lightbox-image-details-currentNumber"></span></div><div id="lightbox-secNav"><a href="#" id="lightbox-secNav-btnClose"><img src="'+settings.imageBtnClose+'"></a></div></div></div></div>');var arrPageSizes=___getPageSize();$('#jquery-overlay').css({backgroundColor:settings.overlayBgColor,opacity:settings.overlayOpacity,width:arrPageSizes[0],height:arrPageSizes[1]}).fadeIn();var arrPageScroll=___getPageScroll();$('#jquery-lightbox').css({top:arrPageScroll[1]+(arrPageSizes[3]/10),left:arrPageScroll[0]}).show();$('#jquery-overlay,#jquery-lightbox').click(function(){_finish();});$('#lightbox-loading-link,#lightbox-secNav-btnClose').click(function(){_finish();return false;});$(window).resize(function(){var arrPageSizes=___getPageSize();$('#jquery-overlay').css({width:arrPageSizes[0],height:arrPageSizes[1]});var arrPageScroll=___getPageScroll();$('#jquery-lightbox').css({top:arrPageScroll[1]+(arrPageSizes[3]/10),left:arrPageScroll[0]});});}
function _set_image_to_view(){$('#lightbox-loading').show();if(settings.fixedNavigation){$('#lightbox-image,#lightbox-container-image-data-box,#lightbox-image-details-currentNumber').hide();}else{$('#lightbox-image,#lightbox-nav,#lightbox-nav-btnPrev,#lightbox-nav-btnNext,#lightbox-container-image-data-box,#lightbox-image-details-currentNumber').hide();}
var objImagePreloader=new Image();objImagePreloader.onload=function(){$('#lightbox-image').attr('src',settings.imageArray[settings.activeImage][0]);_resize_container_image_box(objImagePreloader.width,objImagePreloader.height);objImagePreloader.onload=function(){};};objImagePreloader.src=settings.imageArray[settings.activeImage][0];};function _resize_container_image_box(intImageWidth,intImageHeight){var intCurrentWidth=$('#lightbox-container-image-box').width();var intCurrentHeight=$('#lightbox-container-image-box').height();var intWidth=(intImageWidth+(settings.containerBorderSize*2));var intHeight=(intImageHeight+(settings.containerBorderSize*2));var intDiffW=intCurrentWidth-intWidth;var intDiffH=intCurrentHeight-intHeight;$('#lightbox-container-image-box').animate({width:intWidth,height:intHeight},settings.containerResizeSpeed,function(){_show_image();});if((intDiffW==0)&&(intDiffH==0)){if($.browser.msie){___pause(250);}else{___pause(100);}}
$('#lightbox-container-image-data-box').css({width:intImageWidth});$('#lightbox-nav-btnPrev,#lightbox-nav-btnNext').css({height:intImageHeight+(settings.containerBorderSize*2)});};function _show_image(){$('#lightbox-loading').hide();$('#lightbox-image').fadeIn(function(){_show_image_data();_set_navigation();});_preload_neighbor_images();};function _show_image_data(){$('#lightbox-container-image-data-box').slideDown('fast');$('#lightbox-image-details-caption').hide();if(settings.imageArray[settings.activeImage][1]){$('#lightbox-image-details-caption').text(settings.imageArray[settings.activeImage][1]).show();}
if(settings.imageArray.length>1){$('#lightbox-image-details-currentNumber').html(settings.txtImage+' '+(settings.activeImage+1)+' '+settings.txtOf+' '+settings.imageArray.length).show();}}
function _set_navigation(){$('#lightbox-nav').show();$('#lightbox-nav-btnPrev,#lightbox-nav-btnNext').css({'background':'transparent url('+settings.imageBlank+') no-repeat'});if(settings.activeImage!=0){if(settings.fixedNavigation){$('#lightbox-nav-btnPrev').css({'background':'url('+settings.imageBtnPrev+') left 15% no-repeat'}).unbind().bind('click',function(){settings.activeImage=settings.activeImage-1;_set_image_to_view();return false;});}else{$('#lightbox-nav-btnPrev').unbind().hover(function(){$(this).css({'background':'url('+settings.imageBtnPrev+') left 15% no-repeat'});},function(){$(this).css({'background':'transparent url('+settings.imageBlank+') no-repeat'});}).show().bind('click',function(){settings.activeImage=settings.activeImage-1;_set_image_to_view();return false;});}}
if(settings.activeImage!=(settings.imageArray.length-1)){if(settings.fixedNavigation){$('#lightbox-nav-btnNext').css({'background':'url('+settings.imageBtnNext+') right 15% no-repeat'}).unbind().bind('click',function(){settings.activeImage=settings.activeImage+1;_set_image_to_view();return false;});}else{$('#lightbox-nav-btnNext').unbind().hover(function(){$(this).css({'background':'url('+settings.imageBtnNext+') right 15% no-repeat'});},function(){$(this).css({'background':'transparent url('+settings.imageBlank+') no-repeat'});}).show().bind('click',function(){settings.activeImage=settings.activeImage+1;_set_image_to_view();return false;});}}
_enable_keyboard_navigation();}
function _enable_keyboard_navigation(){$(document).keydown(function(objEvent){_keyboard_action(objEvent);});}
function _disable_keyboard_navigation(){$(document).unbind();}
function _keyboard_action(objEvent){if(objEvent==null){keycode=event.keyCode;escapeKey=27;}else{keycode=objEvent.keyCode;escapeKey=objEvent.DOM_VK_ESCAPE;}
key=String.fromCharCode(keycode).toLowerCase();if((key==settings.keyToClose)||(key=='x')||(keycode==escapeKey)){_finish();}
if((key==settings.keyToPrev)||(keycode==37)){if(settings.activeImage!=0){settings.activeImage=settings.activeImage-1;_set_image_to_view();_disable_keyboard_navigation();}}
if((key==settings.keyToNext)||(keycode==39)){if(settings.activeImage!=(settings.imageArray.length-1)){settings.activeImage=settings.activeImage+1;_set_image_to_view();_disable_keyboard_navigation();}}}
function _preload_neighbor_images(){if((settings.imageArray.length-1)>settings.activeImage){objNext=new Image();objNext.src=settings.imageArray[settings.activeImage+1][0];}
if(settings.activeImage>0){objPrev=new Image();objPrev.src=settings.imageArray[settings.activeImage-1][0];}}
function _finish(){$('#jquery-lightbox').remove();$('#jquery-overlay').fadeOut(function(){$('#jquery-overlay').remove();});$('embed, object, select').css({'visibility':'visible'});}
function ___getPageSize(){var xScroll,yScroll;if(window.innerHeight&&window.scrollMaxY){xScroll=window.innerWidth+window.scrollMaxX;yScroll=window.innerHeight+window.scrollMaxY;}else if(document.body.scrollHeight>document.body.offsetHeight){xScroll=document.body.scrollWidth;yScroll=document.body.scrollHeight;}else{xScroll=document.body.offsetWidth;yScroll=document.body.offsetHeight;}
var windowWidth,windowHeight;if(self.innerHeight){if(document.documentElement.clientWidth){windowWidth=document.documentElement.clientWidth;}else{windowWidth=self.innerWidth;}
windowHeight=self.innerHeight;}else if(document.documentElement&&document.documentElement.clientHeight){windowWidth=document.documentElement.clientWidth;windowHeight=document.documentElement.clientHeight;}else if(document.body){windowWidth=document.body.clientWidth;windowHeight=document.body.clientHeight;}
if(yScroll<windowHeight){pageHeight=windowHeight;}else{pageHeight=yScroll;}
if(xScroll<windowWidth){pageWidth=xScroll;}else{pageWidth=windowWidth;}
arrayPageSize=new Array(pageWidth,pageHeight,windowWidth,windowHeight);return arrayPageSize;};function ___getPageScroll(){var xScroll,yScroll;if(self.pageYOffset){yScroll=self.pageYOffset;xScroll=self.pageXOffset;}else if(document.documentElement&&document.documentElement.scrollTop){yScroll=document.documentElement.scrollTop;xScroll=document.documentElement.scrollLeft;}else if(document.body){yScroll=document.body.scrollTop;xScroll=document.body.scrollLeft;}
arrayPageScroll=new Array(xScroll,yScroll);return arrayPageScroll;};function ___pause(ms){var date=new Date();curDate=null;do{var curDate=new Date();}
while(curDate-date<ms);};return this.unbind('click').click(_initialize);};})(jQuery);
// ----------------------------------------------------------------------------
// markItUp! Universal MarkUp Engine, JQuery plugin
// v 1.1.x
// Dual licensed under the MIT and GPL licenses.
// ----------------------------------------------------------------------------
// Copyright (C) 2007-2011 Jay Salvat
// http://markitup.jaysalvat.com/
// ----------------------------------------------------------------------------
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// 
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
// 
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
// ----------------------------------------------------------------------------
(function($) {
	$.fn.markItUp = function(settings, extraSettings) {
		var options, ctrlKey, shiftKey, altKey;
		ctrlKey = shiftKey = altKey = false;
	
		options = {	id:						'',
					nameSpace:				'',
					root:					'',
					previewInWindow:		'', // 'width=800, height=600, resizable=yes, scrollbars=yes'
					previewAutoRefresh:		true,
					previewPosition:		'after',
					previewTemplatePath:	'~/templates/preview.html',
					previewParser:			false,
					previewParserPath:		'',
					previewParserVar:		'data',
					resizeHandle:			true,
					beforeInsert:			'',
					afterInsert:			'',
					onEnter:				{},
					onShiftEnter:			{},
					onCtrlEnter:			{},
					onTab:					{},
					markupSet:			[	{ /* set */ } ]
				};
		$.extend(options, settings, extraSettings);

		// compute markItUp! path
		if (!options.root) {
			$('script').each(function(a, tag) {
				miuScript = $(tag).get(0).src.match(/(.*)jquery\.markitup(\.pack)?\.js$/);
				if (miuScript !== null) {
					options.root = miuScript[1];
				}
			});
		}

		return this.each(function() {
			var $$, textarea, levels, scrollPosition, caretPosition, caretOffset,
				clicked, hash, header, footer, previewWindow, template, iFrame, abort;
			$$ = $(this);
			textarea = this;
			levels = [];
			abort = false;
			scrollPosition = caretPosition = 0;
			caretOffset = -1;

			options.previewParserPath = localize(options.previewParserPath);
			options.previewTemplatePath = localize(options.previewTemplatePath);

			// apply the computed path to ~/
			function localize(data, inText) {
				if (inText) {
					return 	data.replace(/("|')~\//g, "$1"+options.root);
				}
				return 	data.replace(/^~\//, options.root);
			}

			// init and build editor
			function init() {
				id = ''; nameSpace = '';
				if (options.id) {
					id = 'id="'+options.id+'"';
				} else if ($$.attr("id")) {
					id = 'id="markItUp'+($$.attr("id").substr(0, 1).toUpperCase())+($$.attr("id").substr(1))+'"';

				}
				if (options.nameSpace) {
					nameSpace = 'class="'+options.nameSpace+'"';
				}
				$$.wrap('<div '+nameSpace+'></div>');
				$$.wrap('<div '+id+' class="markItUp"></div>');
				$$.wrap('<div class="markItUpContainer"></div>');
				$$.addClass("markItUpEditor");

				// add the header before the textarea
				header = $('<div class="markItUpHeader"></div>').insertBefore($$);
				$(dropMenus(options.markupSet)).appendTo(header);

				// add the footer after the textarea
				footer = $('<div class="markItUpFooter"></div>').insertAfter($$);

				// add the resize handle after textarea
				if (options.resizeHandle === true && $.browser.safari !== true) {
					resizeHandle = $('<div class="markItUpResizeHandle"></div>')
						.insertAfter($$)
						.bind("mousedown", function(e) {
							var h = $$.height(), y = e.clientY, mouseMove, mouseUp;
							mouseMove = function(e) {
								$$.css("height", Math.max(20, e.clientY+h-y)+"px");
								return false;
							};
							mouseUp = function(e) {
								$("html").unbind("mousemove", mouseMove).unbind("mouseup", mouseUp);
								return false;
							};
							$("html").bind("mousemove", mouseMove).bind("mouseup", mouseUp);
					});
					footer.append(resizeHandle);
				}

				// listen key events
				$$.keydown(keyPressed).keyup(keyPressed);
				
				// bind an event to catch external calls
				$$.bind("insertion", function(e, settings) {
					if (settings.target !== false) {
						get();
					}
					if (textarea === $.markItUp.focused) {
						markup(settings);
					}
				});

				// remember the last focus
				$$.focus(function() {
					$.markItUp.focused = this;
				});
			}

			// recursively build header with dropMenus from markupset
			function dropMenus(markupSet) {
				var ul = $('<ul></ul>'), i = 0;
				$('li:hover > ul', ul).css('display', 'block');
				$.each(markupSet, function() {
					var button = this, t = '', title, li, j;
					title = (button.key) ? (button.name||'')+' [Ctrl+'+button.key+']' : (button.name||'');
					key   = (button.key) ? 'accesskey="'+button.key+'"' : '';
					if (button.separator) {
						li = $('<li class="markItUpSeparator">'+(button.separator||'')+'</li>').appendTo(ul);
					} else {
						i++;
						for (j = levels.length -1; j >= 0; j--) {
							t += levels[j]+"-";
						}
						li = $('<li class="markItUpButton markItUpButton'+t+(i)+' '+(button.className||'')+'"><a href="" '+key+' title="'+title+'">'+(button.name||'')+'</a></li>')
						.bind("contextmenu", function() { // prevent contextmenu on mac and allow ctrl+click
							return false;
						}).click(function() {
							return false;
						}).bind("focusin", function(){
                            $$.focus();
						}).mouseup(function() {
							if (button.call) {
								eval(button.call)();
							}
							setTimeout(function() { markup(button) },1);
							return false;
						}).hover(function() {
								$('> ul', this).show();
								$(document).one('click', function() { // close dropmenu if click outside
										$('ul ul', header).hide();
									}
								);
							}, function() {
								$('> ul', this).hide();
							}
						).appendTo(ul);
						if (button.dropMenu) {
							levels.push(i);
							$(li).addClass('markItUpDropMenu').append(dropMenus(button.dropMenu));
						}
					}
				}); 
				levels.pop();
				return ul;
			}

			// markItUp! markups
			function magicMarkups(string) {
				if (string) {
					string = string.toString();
					string = string.replace(/\(\!\(([\s\S]*?)\)\!\)/g,
						function(x, a) {
							var b = a.split('|!|');
							if (altKey === true) {
								return (b[1] !== undefined) ? b[1] : b[0];
							} else {
								return (b[1] === undefined) ? "" : b[0];
							}
						}
					);
					// [![prompt]!], [![prompt:!:value]!]
					string = string.replace(/\[\!\[([\s\S]*?)\]\!\]/g,
						function(x, a) {
							var b = a.split(':!:');
							if (abort === true) {
								return false;
							}
							value = prompt(b[0], (b[1]) ? b[1] : '');
							if (value === null) {
								abort = true;
							}
							return value;
						}
					);
					return string;
				}
				return "";
			}

			// prepare action
			function prepare(action) {
				if ($.isFunction(action)) {
					action = action(hash);
				}
				return magicMarkups(action);
			}

			// build block to insert
			function build(string) {
				var openWith 			= prepare(clicked.openWith);
				var placeHolder 		= prepare(clicked.placeHolder);
				var replaceWith 		= prepare(clicked.replaceWith);
				var closeWith 			= prepare(clicked.closeWith);
				var openBlockWith 		= prepare(clicked.openBlockWith);
				var closeBlockWith 		= prepare(clicked.closeBlockWith);
				var multiline 			= clicked.multiline;
				
				if (replaceWith !== "") {
					block = openWith + replaceWith + closeWith;
				} else if (selection === '' && placeHolder !== '') {
					block = openWith + placeHolder + closeWith;
				} else {
					string = string || selection;

					var lines = selection.split(/\r?\n/), blocks = [];
					
					for (var l=0; l < lines.length; l++) {
						line = lines[l];
						var trailingSpaces;
						if (trailingSpaces = line.match(/ *$/)) {
							blocks.push(openWith + line.replace(/ *$/g, '') + closeWith + trailingSpaces);
						} else {
							blocks.push(openWith + line + closeWith);
						}
					}
					
					block = blocks.join("\n");
				}

				block = openBlockWith + block + closeBlockWith;

				return {	block:block, 
							openWith:openWith, 
							replaceWith:replaceWith, 
							placeHolder:placeHolder,
							closeWith:closeWith
					};
			}

			// define markup to insert
			function markup(button) {
				var len, j, n, i;
				hash = clicked = button;
				get();
				$.extend(hash, {	line:"", 
						 			root:options.root,
									textarea:textarea, 
									selection:(selection||''), 
									caretPosition:caretPosition,
									ctrlKey:ctrlKey, 
									shiftKey:shiftKey, 
									altKey:altKey
								}
							);
				// callbacks before insertion
				prepare(options.beforeInsert);
				prepare(clicked.beforeInsert);
				if ((ctrlKey === true && shiftKey === true) || button.multiline === true) {
					prepare(clicked.beforeMultiInsert);
				}			
				$.extend(hash, { line:1 });

				if ((ctrlKey === true && shiftKey === true)) {
					lines = selection.split(/\r?\n/);
					for (j = 0, n = lines.length, i = 0; i < n; i++) {
						if ($.trim(lines[i]) !== '') {
							$.extend(hash, { line:++j, selection:lines[i] } );
							lines[i] = build(lines[i]).block;
						} else {
							lines[i] = "";
						}
					}
					string = { block:lines.join('\n')};
					start = caretPosition;
					len = string.block.length + (($.browser.opera) ? n-1 : 0);
				} else if (ctrlKey === true) {
					string = build(selection);
					start = caretPosition + string.openWith.length;
					len = string.block.length - string.openWith.length - string.closeWith.length;
					len = len - (string.block.match(/ $/) ? 1 : 0);
					len -= fixIeBug(string.block);
				} else if (shiftKey === true) {
					string = build(selection);
					start = caretPosition;
					len = string.block.length;
					len -= fixIeBug(string.block);
				} else {
					string = build(selection);
					start = caretPosition + string.block.length ;
					len = 0;
					start -= fixIeBug(string.block);
				}
				if ((selection === '' && string.replaceWith === '')) {
					caretOffset += fixOperaBug(string.block);
					
					start = caretPosition + string.openWith.length;
					len = string.block.length - string.openWith.length - string.closeWith.length;

					caretOffset = $$.val().substring(caretPosition,  $$.val().length).length;
					caretOffset -= fixOperaBug($$.val().substring(0, caretPosition));
				}
				$.extend(hash, { caretPosition:caretPosition, scrollPosition:scrollPosition } );

				if (string.block !== selection && abort === false) {
					insert(string.block);
					set(start, len);
				} else {
					caretOffset = -1;
				}
				get();

				$.extend(hash, { line:'', selection:selection });

				// callbacks after insertion
				if ((ctrlKey === true && shiftKey === true) || button.multiline === true) {
					prepare(clicked.afterMultiInsert);
				}
				prepare(clicked.afterInsert);
				prepare(options.afterInsert);

				// refresh preview if opened
				if (previewWindow && options.previewAutoRefresh) {
					refreshPreview(); 
				}
																									
				// reinit keyevent
				shiftKey = altKey = ctrlKey = abort = false;
			}

			// Substract linefeed in Opera
			function fixOperaBug(string) {
				if ($.browser.opera) {
					return string.length - string.replace(/\n*/g, '').length;
				}
				return 0;
			}
			// Substract linefeed in IE
			function fixIeBug(string) {
				if ($.browser.msie) {
					return string.length - string.replace(/\r*/g, '').length;
				}
				return 0;
			}
				
			// add markup
			function insert(block) {	
				if (document.selection) {
					var newSelection = document.selection.createRange();
					newSelection.text = block;
				} else {
					textarea.value =  textarea.value.substring(0, caretPosition)  + block + textarea.value.substring(caretPosition + selection.length, textarea.value.length);
				}
			}

			// set a selection
			function set(start, len) {
				if (textarea.createTextRange){
					// quick fix to make it work on Opera 9.5
					if ($.browser.opera && $.browser.version >= 9.5 && len == 0) {
						return false;
					}
					range = textarea.createTextRange();
					range.collapse(true);
					range.moveStart('character', start); 
					range.moveEnd('character', len); 
					range.select();
				} else if (textarea.setSelectionRange ){
					textarea.setSelectionRange(start, start + len);
				}
				textarea.scrollTop = scrollPosition;
				textarea.focus();
			}

			// get the selection
			function get() {
				textarea.focus();

				scrollPosition = textarea.scrollTop;
				if (document.selection) {
					selection = document.selection.createRange().text;
					if ($.browser.msie) { // ie
						var range = document.selection.createRange(), rangeCopy = range.duplicate();
						rangeCopy.moveToElementText(textarea);
						caretPosition = -1;
						while(rangeCopy.inRange(range)) {
							rangeCopy.moveStart('character');
							caretPosition ++;
						}
					} else { // opera
						caretPosition = textarea.selectionStart;
					}
				} else { // gecko & webkit
					caretPosition = textarea.selectionStart;

					selection = textarea.value.substring(caretPosition, textarea.selectionEnd);
				} 
				return selection;
			}

			// open preview window
			function preview() {
				if (!previewWindow || previewWindow.closed) {
					if (options.previewInWindow) {
						previewWindow = window.open('', 'preview', options.previewInWindow);
						$(window).unload(function() {
							previewWindow.close();
						});
					} else {
						iFrame = $('<iframe class="markItUpPreviewFrame"></iframe>');
						if (options.previewPosition == 'after') {
							iFrame.insertAfter(footer);
						} else {
							iFrame.insertBefore(header);
						}	
						previewWindow = iFrame[iFrame.length - 1].contentWindow || frame[iFrame.length - 1];
					}
				} else if (altKey === true) {
					if (iFrame) {
						iFrame.remove();
					} else {
						previewWindow.close();
					}
					previewWindow = iFrame = false;
				}
				if (!options.previewAutoRefresh) {
					refreshPreview(); 
				}
				if (options.previewInWindow) {
					previewWindow.focus();
				}
			}

			// refresh Preview window
			function refreshPreview() {
 				renderPreview();
			}

			function renderPreview() {		
				var phtml;
				if (options.previewParser && typeof options.previewParser === 'function') {
					var data = options.previewParser( $$.val() );
					writeInPreview( localize(data, 1) ); 
				} else if (options.previewParserPath !== '') {
					$.ajax({
						type: 'POST',
						dataType: 'text',
						global: false,
						url: options.previewParserPath,
						data: options.previewParserVar+'='+encodeURIComponent($$.val()),
						success: function(data) {
							writeInPreview( localize(data, 1) ); 
						}
					});
				} else {
					if (!template) {
						$.ajax({
							url: options.previewTemplatePath,
							dataType: 'text',
							global: false,
							success: function(data) {
								writeInPreview( localize(data, 1).replace(/<!-- content -->/g, $$.val()) );
							}
						});
					}
				}
				return false;
			}
			
			function writeInPreview(data) {
				if (previewWindow.document) {			
					try {
						sp = previewWindow.document.documentElement.scrollTop
					} catch(e) {
						sp = 0;
					}	
					previewWindow.document.open();
					previewWindow.document.write(data);
					previewWindow.document.close();
					previewWindow.document.documentElement.scrollTop = sp;
				}
			}
			
			// set keys pressed
			function keyPressed(e) { 
				shiftKey = e.shiftKey;
				altKey = e.altKey;
				ctrlKey = (!(e.altKey && e.ctrlKey)) ? (e.ctrlKey || e.metaKey) : false;

				if (e.type === 'keydown') {
					if (ctrlKey === true) {
						li = $('a[accesskey="'+String.fromCharCode(e.keyCode)+'"]', header).parent('li');
						if (li.length !== 0) {
							ctrlKey = false;
							setTimeout(function() {
								li.triggerHandler('mouseup');
							},1);
							return false;
						}
					}
					if (e.keyCode === 13 || e.keyCode === 10) { // Enter key
						if (ctrlKey === true) {  // Enter + Ctrl
							ctrlKey = false;
							markup(options.onCtrlEnter);
							return options.onCtrlEnter.keepDefault;
						} else if (shiftKey === true) { // Enter + Shift
							shiftKey = false;
							markup(options.onShiftEnter);
							return options.onShiftEnter.keepDefault;
						} else { // only Enter
							markup(options.onEnter);
							return options.onEnter.keepDefault;
						}
					}
					if (e.keyCode === 9) { // Tab key
						if (shiftKey == true || ctrlKey == true || altKey == true) {
							return false; 
						}
						if (caretOffset !== -1) {
							get();
							caretOffset = $$.val().length - caretOffset;
							set(caretOffset, 0);
							caretOffset = -1;
							return false;
						} else {
							markup(options.onTab);
							return options.onTab.keepDefault;
						}
					}
				}
			}

			init();
		});
	};

	$.fn.markItUpRemove = function() {
		return this.each(function() {
				var $$ = $(this).unbind().removeClass('markItUpEditor');
				$$.parent('div').parent('div.markItUp').parent('div').replaceWith($$);
			}
		);
	};

	$.markItUp = function(settings) {
		var options = { target:false };
		$.extend(options, settings);
		if (options.target) {
			return $(options.target).each(function() {
				$(this).focus();
				$(this).trigger('insertion', [options]);
			});
		} else {
			$('textarea').trigger('insertion', [options]);
		}
	};
})(jQuery);
/*
 * jquery.socialshareprivacy.js | 2 Klicks fuer mehr Datenschutz
 *
 * http://www.heise.de/extras/socialshareprivacy/
 * http://www.heise.de/ct/artikel/2-Klicks-fuer-mehr-Datenschutz-1333879.html
 *
 * Copyright (c) 2011 Hilko Holweg, Sebastian Hilbig, Nicolas Heiringhoff, Juergen Schmidt,
 * Heise Zeitschriften Verlag GmbH & Co. KG, http://www.heise.de
 *
 * is released under the MIT License http://www.opensource.org/licenses/mit-license.php
 *
 * Spread the word, link to us if you can.
 */
(function ($) {

    "use strict";

	/*
	 * helper functions
	 */ 

    // abbreviate at last blank before length and add "\u2026" (horizontal ellipsis)
    function abbreviateText(text, length) {
        var abbreviated = decodeURIComponent(text);
        if (abbreviated.length <= length) {
            return text;
        }

        var lastWhitespaceIndex = abbreviated.substring(0, length - 1).lastIndexOf(' ');
        abbreviated = encodeURIComponent(abbreviated.substring(0, lastWhitespaceIndex)) + "\u2026";

        return abbreviated;
    }

    // returns content of <meta name="" content=""> tags or '' if empty/non existant
    function getMeta(name) {
        var metaContent = $('meta[name="' + name + '"]').attr('content');
        return metaContent || '';
    }
    
    // create tweet text from content of <meta name="DC.title"> and <meta name="DC.creator">
    // fallback to content of <title> tag
    function getTweetText() {
        var title = getMeta('DC.title');
        var creator = getMeta('DC.creator');

        if (title.length > 0 && creator.length > 0) {
            title += ' - ' + creator;
        } else {
            title = $('title').text();
        }

        return encodeURIComponent(title);
    }

    // build URI from rel="canonical" or document.location
    function getURI() {
        var uri = document.location.href;
        var canonical = $("link[rel=canonical]").attr("href");

        if (canonical && canonical.length > 0) {
            if (canonical.indexOf("http") < 0) {
                canonical = document.location.protocol + "//" + document.location.host + canonical;
            }
            uri = canonical;
        }

        return uri;
    }

    function cookieSet(name, value, days, path, domain) {
        //expires.setTime(expires.getTime() + (days * 24 * 60 * 60 * 1000));
        //document.cookie = name + '=' + value + '; expires=' + expires.toUTCString() + '; path=' + path + '; domain=' + domain;
        document.cookie = name + '=' + value;
    }
    function cookieDel(name, value, path, domain) {
        //var expires = new Date();
        //expires.setTime(expires.getTime() - 100);
        //document.cookie += name + '=' + value + '; expires=' + expires.toUTCString() + '; path=' + path + '; domain=' + domain;
        document.cookie = name + '= perma_off';
    }

    // extend jquery with our plugin function
    $.fn.socialSharePrivacy = function (settings) {
        var defaults = {
            'services' : {
                'facebook' : {
                    'status'            : 'on',
                    'dummy_img'         : 'socialshareprivacy/images/dummy_facebook.png',
                    'txt_info'          : '2 Klicks f&uuml;r mehr Datenschutz: Erst wenn Sie hier klicken, wird der Button aktiv und Sie k&ouml;nnen Ihre Empfehlung an Facebook senden. Schon beim Aktivieren werden Daten an Dritte &uuml;bertragen &ndash; siehe <em>i</em>.',
                    'txt_fb_off'        : 'nicht mit Facebook verbunden',
                    'txt_fb_on'         : 'mit Facebook verbunden',
                    'perma_option'      : 'on',
                    'display_name'      : 'Facebook',
                    'referrer_track'    : '',
                    'language'          : 'de_DE',
                    'action'            : 'recommend'
                }, 
                'twitter' : {
                    'status'            : 'on', 
                    'dummy_img'         : 'socialshareprivacy/images/dummy_twitter.png',
                    'txt_info'          : '2 Klicks f&uuml;r mehr Datenschutz: Erst wenn Sie hier klicken, wird der Button aktiv und Sie k&ouml;nnen Ihre Empfehlung an Twitter senden. Schon beim Aktivieren werden Daten an Dritte &uuml;bertragen &ndash; siehe <em>i</em>.',
                    'txt_twitter_off'   : 'nicht mit Twitter verbunden',
                    'txt_twitter_on'    : 'mit Twitter verbunden',
                    'perma_option'      : 'on',
                    'display_name'      : 'Twitter',
                    'referrer_track'    : '', 
                    'tweet_text'        : getTweetText,
                    'language'          : 'en'
                },
                'gplus' : {
                    'status'            : 'on',
                    'dummy_img'         : 'socialshareprivacy/images/dummy_gplus.png',
                    'txt_info'          : '2 Klicks f&uuml;r mehr Datenschutz: Erst wenn Sie hier klicken, wird der Button aktiv und Sie k&ouml;nnen Ihre Empfehlung an Google+ senden. Schon beim Aktivieren werden Daten an Dritte &uuml;bertragen &ndash; siehe <em>i</em>.',
                    'txt_gplus_off'     : 'nicht mit Google+ verbunden',
                    'txt_gplus_on'      : 'mit Google+ verbunden',
                    'perma_option'      : 'on',
                    'display_name'      : 'Google+',
                    'referrer_track'    : '',
                    'language'          : 'de'
                }
            },
            'info_link'         : 'http://www.heise.de/ct/artikel/2-Klicks-fuer-mehr-Datenschutz-1333879.html',
            'txt_help'          : 'Wenn Sie diese Felder durch einen Klick aktivieren, werden Informationen an Facebook, Twitter oder Google in die USA &uuml;bertragen und unter Umst&auml;nden auch dort gespeichert. N&auml;heres erfahren Sie durch einen Klick auf das <em>i</em>.',
            'settings_perma'    : 'Dauerhaft aktivieren und Daten&uuml;ber&shy;tragung zustimmen:',
            'cookie_path'       : '/',
            'cookie_domain'     : document.location.host,
            'cookie_expires'    : '365',
            'css_path'          : 'socialshareprivacy/socialshareprivacy.css',
            'uri'               : getURI
        };

        // Standardwerte des Plug-Ings mit den vom User angegebenen Optionen ueberschreiben
        var options = $.extend(true, defaults, settings);

        var facebook_on = (options.services.facebook.status === 'on');
        var twitter_on  = (options.services.twitter.status  === 'on');
        var gplus_on    = (options.services.gplus.status    === 'on');

        // check if at least one service is "on"
        if (!facebook_on && !twitter_on && !gplus_on) {
            return;
        }

        // insert stylesheet into document and prepend target element
        if (options.css_path.length > 0) {
            // IE fix (noetig fuer IE < 9 - wird hier aber fuer alle IE gemacht)
            if (document.createStyleSheet) {
                document.createStyleSheet(options.css_path);
            } else {
                $('head').append('<link rel="stylesheet" type="text/css" href="' + options.css_path + '" />');
            }
        }

        return this.each(function () {

            $(this).prepend('<ul class="social_share_privacy_area"></ul>');
            var context = $('.social_share_privacy_area', this);

            // canonical uri that will be shared
            var uri = options.uri;
            if (typeof uri === 'function') {
                uri = uri(context);
            }

            //
            // Facebook
            //
            if (facebook_on) {
                var fb_enc_uri = encodeURIComponent(uri + options.services.facebook.referrer_track);
                var fb_code = '<iframe src="http://www.facebook.com/plugins/like.php?locale=' + options.services.facebook.language + '&amp;href=' + fb_enc_uri + '&amp;send=false&amp;layout=button_count&amp;width=120&amp;show_faces=false&amp;action=' + options.services.facebook.action + '&amp;colorscheme=light&amp;font&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:145px; height:21px;" allowTransparency="true"></iframe>';
                var fb_dummy_btn = '<img src="' + options.services.facebook.dummy_img + '" alt="Facebook &quot;Like&quot;-Dummy" class="fb_like_privacy_dummy" />';

                context.append('<li class="facebook help_info"><span class="info">' + options.services.facebook.txt_info + '</span><span class="switch off">' + options.services.facebook.txt_fb_off + '</span><div class="fb_like dummy_btn">' + fb_dummy_btn + '</div></li>');

                var $container_fb = $('li.facebook', context);

                $('li.facebook div.fb_like img.fb_like_privacy_dummy,li.facebook span.switch', context).live('click', function () {
                    if ($container_fb.find('span.switch').hasClass('off')) {
                        $container_fb.addClass('info_off');
                        $container_fb.find('span.switch').addClass('on').removeClass('off').html(options.services.facebook.txt_fb_on);
                        $container_fb.find('img.fb_like_privacy_dummy').replaceWith(fb_code);
                    } else {
                        $container_fb.removeClass('info_off');
                        $container_fb.find('span.switch').addClass('off').removeClass('on').html(options.services.facebook.txt_fb_off);
                        $container_fb.find('.fb_like').html(fb_dummy_btn);
                    }
                });
            }

            //
            // Twitter
            //
            if (twitter_on) {
                var text = options.services.twitter.tweet_text;
                if (typeof text === 'function') {
                    text = text();
                }
                // 120 is the max character count left after twitters automatic url shortening with t.co
                text = abbreviateText(text, '120');

                var twitter_enc_uri = encodeURIComponent(uri + options.services.twitter.referrer_track);
                var twitter_count_url = encodeURIComponent(uri);
                var twitter_code = '<iframe allowtransparency="true" frameborder="0" scrolling="no" src="http://platform.twitter.com/widgets/tweet_button.html?url=' + twitter_enc_uri + '&amp;counturl=' + twitter_count_url + '&amp;text=' + text + '&amp;count=horizontal&amp;lang=' + options.services.twitter.language + '" style="width:130px; height:25px;"></iframe>';
                var twitter_dummy_btn = '<img src="' + options.services.twitter.dummy_img + '" alt="&quot;Tweet this&quot;-Dummy" class="tweet_this_dummy" />';

                context.append('<li class="twitter help_info"><span class="info">' + options.services.twitter.txt_info + '</span><span class="switch off">' + options.services.twitter.txt_twitter_off + '</span><div class="tweet dummy_btn">' + twitter_dummy_btn + '</div></li>');

                var $container_tw = $('li.twitter', context);

                $('li.twitter div.tweet img,li.twitter span.switch', context).live('click', function () {
                    if ($container_tw.find('span.switch').hasClass('off')) {
                        $container_tw.addClass('info_off');
                        $container_tw.find('span.switch').addClass('on').removeClass('off').html(options.services.twitter.txt_twitter_on);
                        $container_tw.find('img.tweet_this_dummy').replaceWith(twitter_code);
                    } else {
                        $container_tw.removeClass('info_off');
                        $container_tw.find('span.switch').addClass('off').removeClass('on').html(options.services.twitter.txt_twitter_off);
                        $container_tw.find('.tweet').html(twitter_dummy_btn);
                    }
                });
            }

            //
            // Google+
            //
            if (gplus_on) {
                // fuer G+ wird die URL nicht encoded, da das zu einem Fehler fuehrt
                var gplus_uri = uri + options.services.gplus.referrer_track;
                
                // we use the Google+ "asynchronous" code, standard code is flaky if inserted into dom after load
                var gplus_code = '<div class="g-plusone" data-size="medium" data-href="' + gplus_uri + '"></div><script type="text/javascript">window.___gcfg = {lang: "' + options.services.gplus.language + '"}; (function() { var po = document.createElement("script"); po.type = "text/javascript"; po.async = true; po.src = "https://apis.google.com/js/plusone.js"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(po, s); })(); </script>';
                var gplus_dummy_btn = '<img src="' + options.services.gplus.dummy_img + '" alt="&quot;Google+1&quot;-Dummy" class="gplus_one_dummy" />';

                context.append('<li class="gplus help_info"><span class="info">' + options.services.gplus.txt_info + '</span><span class="switch off">' + options.services.gplus.txt_gplus_off + '</span><div class="gplusone dummy_btn">' + gplus_dummy_btn + '</div></li>');

                var $container_gplus = $('li.gplus', context);

                $('li.gplus div.gplusone img,li.gplus span.switch', context).live('click', function () {
                    if ($container_gplus.find('span.switch').hasClass('off')) {
                        $container_gplus.addClass('info_off');
                        $container_gplus.find('span.switch').addClass('on').removeClass('off').html(options.services.gplus.txt_gplus_on);
                        $container_gplus.find('img.gplus_one_dummy').replaceWith(gplus_code);
                    } else {
                        $container_gplus.removeClass('info_off');
                        $container_gplus.find('span.switch').addClass('off').removeClass('on').html(options.services.gplus.txt_gplus_off);
                        $container_gplus.find('.gplusone').html(gplus_dummy_btn);
                    }
                });
            }

            //
            // Der Info/Settings-Bereich wird eingebunden
            //
            context.append('<li class="settings_info"><div class="settings_info_menu off perma_option_off"><a href="' + options.info_link + '"><span class="help_info icon"><span class="info">' + options.txt_help + '</span></span></a></div></li>');

            // Info-Overlays mit leichter Verzoegerung einblenden
            $('.help_info:not(.info_off)', context).live('mouseenter', function () {
                var $info_wrapper = $(this);
                var timeout_id = window.setTimeout(function () { $($info_wrapper).addClass('display'); }, 500);
                $(this).data('timeout_id', timeout_id);
            });
            $('.help_info', context).live('mouseleave', function () {
                var timeout_id = $(this).data('timeout_id');
                window.clearTimeout(timeout_id);
                if ($(this).hasClass('display')) {
                    $(this).removeClass('display');
                }
            });

            var facebook_perma = (options.services.facebook.perma_option === 'on');
            var twitter_perma  = (options.services.twitter.perma_option  === 'on');
            var gplus_perma    = (options.services.gplus.perma_option    === 'on');

            // Menue zum dauerhaften Einblenden der aktiven Dienste via Cookie einbinden
            // Die IE7 wird hier ausgenommen, da er kein JSON kann und die Cookies hier ueber JSON-Struktur abgebildet werden
            if (((facebook_on && facebook_perma)
                || (twitter_on && twitter_perma)
                || (gplus_on && gplus_perma))
                    && (!$.browser.msie || ($.browser.msie && $.browser.version > 7.0))) {

                // Cookies abrufen
                var cookie_list = document.cookie.split(';');
                var cookies = '{';
                var i = 0;
                for (; i < cookie_list.length; i += 1) {
                    var foo = cookie_list[i].split('=');
                    cookies += '"' + $.trim(foo[0]) + '":"' + $.trim(foo[1]) + '"';
                    if (i < cookie_list.length - 1) {
                        cookies += ',';
                    }
                }
                cookies += '}';
                cookies = JSON.parse(cookies);

                // Container definieren
                var $container_settings_info = $('li.settings_info', context);

                // Klasse entfernen, die das i-Icon alleine formatiert, da Perma-Optionen eingeblendet werden
                $container_settings_info.find('.settings_info_menu').removeClass('perma_option_off');

                // Perma-Optionen-Icon (.settings) und Formular (noch versteckt) einbinden
                $container_settings_info.find('.settings_info_menu').append('<span class="settings">Einstellungen</span><form><fieldset><legend>' + options.settings_perma + '</legend></fieldset></form>');


                // Die Dienste mit <input> und <label>, sowie checked-Status laut Cookie, schreiben
                var checked = ' checked="checked"';
                if (facebook_on && facebook_perma) {
                    var perma_status_facebook = cookies.socialSharePrivacy_facebook === 'perma_on' ? checked : '';
                    $container_settings_info.find('form fieldset').append(
                        '<input type="checkbox" name="perma_status_facebook" id="perma_status_facebook"'
                            + perma_status_facebook + ' /><label for="perma_status_facebook">'
                            + options.services.facebook.display_name + '</label>'
                    );
                }

                if (twitter_on && twitter_perma) {
                    var perma_status_twitter = cookies.socialSharePrivacy_twitter === 'perma_on' ? checked : '';
                    $container_settings_info.find('form fieldset').append(
                        '<input type="checkbox" name="perma_status_twitter" id="perma_status_twitter"'
                            + perma_status_twitter + ' /><label for="perma_status_twitter">'
                            + options.services.twitter.display_name + '</label>'
                    );
                }

                if (gplus_on && gplus_perma) {
                    var perma_status_gplus = cookies.socialSharePrivacy_gplus === 'perma_on' ? checked : '';
                    $container_settings_info.find('form fieldset').append(
                        '<input type="checkbox" name="perma_status_gplus" id="perma_status_gplus"'
                            + perma_status_gplus + ' /><label for="perma_status_gplus">'
                            + options.services.gplus.display_name + '</label>'
                    );
                }

                // Cursor auf Pointer setzen fuer das Zahnrad
                $container_settings_info.find('span.settings').css('cursor', 'pointer');

                // Einstellungs-Menue bei mouseover ein-/ausblenden
                $($container_settings_info.find('span.settings'), context).live('mouseenter', function () {
                    var timeout_id = window.setTimeout(function () { $container_settings_info.find('.settings_info_menu').removeClass('off').addClass('on'); }, 500);
                    $(this).data('timeout_id', timeout_id);
                }); 
                $($container_settings_info, context).live('mouseleave', function () {
                    var timeout_id = $(this).data('timeout_id');
                    window.clearTimeout(timeout_id);
                    $container_settings_info.find('.settings_info_menu').removeClass('on').addClass('off');
                });

                // Klick-Interaktion auf <input> um Dienste dauerhaft ein- oder auszuschalten (Cookie wird gesetzt oder geloescht)
                $($container_settings_info.find('fieldset input')).live('click', function (event) {
                    var click = event.target.id;
                    var service = click.substr(click.lastIndexOf('_') + 1, click.length);
                    var cookie_name = 'socialSharePrivacy_' + service;

                    if ($('#' + event.target.id + ':checked').length) {
                        cookieSet(cookie_name, 'perma_on', options.cookie_expires, options.cookie_path, options.cookie_domain);
                        $('form fieldset label[for=' + click + ']', context).addClass('checked');
                    } else {
                        cookieDel(cookie_name, 'perma_on', options.cookie_path, options.cookie_domain);
                        $('form fieldset label[for=' + click + ']', context).removeClass('checked');
                    }
                });

                // Dienste automatisch einbinden, wenn entsprechendes Cookie vorhanden ist
                if (facebook_on && facebook_perma && cookies.socialSharePrivacy_facebook === 'perma_on') {
                    $('li.facebook span.switch', context).click();
                }
                if (twitter_on && twitter_perma && cookies.socialSharePrivacy_twitter === 'perma_on') {
                    $('li.twitter span.switch', context).click();
                }
                if (gplus_on && gplus_perma && cookies.socialSharePrivacy_gplus === 'perma_on') {
                    $('li.gplus span.switch', context).click();
                }
            }
        }); // this.each(function ()
    };      // $.fn.socialSharePrivacy = function (settings) {
}(jQuery));

// Copyright 2006 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
document.createElement("canvas").getContext||(function(){var s=Math,j=s.round,F=s.sin,G=s.cos,V=s.abs,W=s.sqrt,k=10,v=k/2;function X(){return this.context_||(this.context_=new H(this))}var L=Array.prototype.slice;function Y(b,a){var c=L.call(arguments,2);return function(){return b.apply(a,c.concat(L.call(arguments)))}}var M={init:function(b){if(/MSIE/.test(navigator.userAgent)&&!window.opera){var a=b||document;a.createElement("canvas");a.attachEvent("onreadystatechange",Y(this.init_,this,a))}},init_:function(b){b.namespaces.g_vml_||
b.namespaces.add("g_vml_","urn:schemas-microsoft-com:vml","#default#VML");b.namespaces.g_o_||b.namespaces.add("g_o_","urn:schemas-microsoft-com:office:office","#default#VML");if(!b.styleSheets.ex_canvas_){var a=b.createStyleSheet();a.owningElement.id="ex_canvas_";a.cssText="canvas{display:inline-block;overflow:hidden;text-align:left;width:300px;height:150px}g_vml_\\:*{behavior:url(#default#VML)}g_o_\\:*{behavior:url(#default#VML)}"}var c=b.getElementsByTagName("canvas"),d=0;for(;d<c.length;d++)this.initElement(c[d])},
initElement:function(b){if(!b.getContext){b.getContext=X;b.innerHTML="";b.attachEvent("onpropertychange",Z);b.attachEvent("onresize",$);var a=b.attributes;if(a.width&&a.width.specified)b.style.width=a.width.nodeValue+"px";else b.width=b.clientWidth;if(a.height&&a.height.specified)b.style.height=a.height.nodeValue+"px";else b.height=b.clientHeight}return b}};function Z(b){var a=b.srcElement;switch(b.propertyName){case "width":a.style.width=a.attributes.width.nodeValue+"px";a.getContext().clearRect();
break;case "height":a.style.height=a.attributes.height.nodeValue+"px";a.getContext().clearRect();break}}function $(b){var a=b.srcElement;if(a.firstChild){a.firstChild.style.width=a.clientWidth+"px";a.firstChild.style.height=a.clientHeight+"px"}}M.init();var N=[],B=0;for(;B<16;B++){var C=0;for(;C<16;C++)N[B*16+C]=B.toString(16)+C.toString(16)}function I(){return[[1,0,0],[0,1,0],[0,0,1]]}function y(b,a){var c=I(),d=0;for(;d<3;d++){var f=0;for(;f<3;f++){var h=0,g=0;for(;g<3;g++)h+=b[d][g]*a[g][f];c[d][f]=
h}}return c}function O(b,a){a.fillStyle=b.fillStyle;a.lineCap=b.lineCap;a.lineJoin=b.lineJoin;a.lineWidth=b.lineWidth;a.miterLimit=b.miterLimit;a.shadowBlur=b.shadowBlur;a.shadowColor=b.shadowColor;a.shadowOffsetX=b.shadowOffsetX;a.shadowOffsetY=b.shadowOffsetY;a.strokeStyle=b.strokeStyle;a.globalAlpha=b.globalAlpha;a.arcScaleX_=b.arcScaleX_;a.arcScaleY_=b.arcScaleY_;a.lineScale_=b.lineScale_}function P(b){var a,c=1;b=String(b);if(b.substring(0,3)=="rgb"){var d=b.indexOf("(",3),f=b.indexOf(")",d+
1),h=b.substring(d+1,f).split(",");a="#";var g=0;for(;g<3;g++)a+=N[Number(h[g])];if(h.length==4&&b.substr(3,1)=="a")c=h[3]}else a=b;return{color:a,alpha:c}}function aa(b){switch(b){case "butt":return"flat";case "round":return"round";case "square":default:return"square"}}function H(b){this.m_=I();this.mStack_=[];this.aStack_=[];this.currentPath_=[];this.fillStyle=this.strokeStyle="#000";this.lineWidth=1;this.lineJoin="miter";this.lineCap="butt";this.miterLimit=k*1;this.globalAlpha=1;this.canvas=b;
var a=b.ownerDocument.createElement("div");a.style.width=b.clientWidth+"px";a.style.height=b.clientHeight+"px";a.style.overflow="hidden";a.style.position="absolute";b.appendChild(a);this.element_=a;this.lineScale_=this.arcScaleY_=this.arcScaleX_=1}var i=H.prototype;i.clearRect=function(){this.element_.innerHTML=""};i.beginPath=function(){this.currentPath_=[]};i.moveTo=function(b,a){var c=this.getCoords_(b,a);this.currentPath_.push({type:"moveTo",x:c.x,y:c.y});this.currentX_=c.x;this.currentY_=c.y};
i.lineTo=function(b,a){var c=this.getCoords_(b,a);this.currentPath_.push({type:"lineTo",x:c.x,y:c.y});this.currentX_=c.x;this.currentY_=c.y};i.bezierCurveTo=function(b,a,c,d,f,h){var g=this.getCoords_(f,h),l=this.getCoords_(b,a),e=this.getCoords_(c,d);Q(this,l,e,g)};function Q(b,a,c,d){b.currentPath_.push({type:"bezierCurveTo",cp1x:a.x,cp1y:a.y,cp2x:c.x,cp2y:c.y,x:d.x,y:d.y});b.currentX_=d.x;b.currentY_=d.y}i.quadraticCurveTo=function(b,a,c,d){var f=this.getCoords_(b,a),h=this.getCoords_(c,d),g={x:this.currentX_+
0.6666666666666666*(f.x-this.currentX_),y:this.currentY_+0.6666666666666666*(f.y-this.currentY_)};Q(this,g,{x:g.x+(h.x-this.currentX_)/3,y:g.y+(h.y-this.currentY_)/3},h)};i.arc=function(b,a,c,d,f,h){c*=k;var g=h?"at":"wa",l=b+G(d)*c-v,e=a+F(d)*c-v,m=b+G(f)*c-v,r=a+F(f)*c-v;if(l==m&&!h)l+=0.125;var n=this.getCoords_(b,a),o=this.getCoords_(l,e),q=this.getCoords_(m,r);this.currentPath_.push({type:g,x:n.x,y:n.y,radius:c,xStart:o.x,yStart:o.y,xEnd:q.x,yEnd:q.y})};i.rect=function(b,a,c,d){this.moveTo(b,
a);this.lineTo(b+c,a);this.lineTo(b+c,a+d);this.lineTo(b,a+d);this.closePath()};i.strokeRect=function(b,a,c,d){var f=this.currentPath_;this.beginPath();this.moveTo(b,a);this.lineTo(b+c,a);this.lineTo(b+c,a+d);this.lineTo(b,a+d);this.closePath();this.stroke();this.currentPath_=f};i.fillRect=function(b,a,c,d){var f=this.currentPath_;this.beginPath();this.moveTo(b,a);this.lineTo(b+c,a);this.lineTo(b+c,a+d);this.lineTo(b,a+d);this.closePath();this.fill();this.currentPath_=f};i.createLinearGradient=function(b,
a,c,d){var f=new D("gradient");f.x0_=b;f.y0_=a;f.x1_=c;f.y1_=d;return f};i.createRadialGradient=function(b,a,c,d,f,h){var g=new D("gradientradial");g.x0_=b;g.y0_=a;g.r0_=c;g.x1_=d;g.y1_=f;g.r1_=h;return g};i.drawImage=function(b){var a,c,d,f,h,g,l,e,m=b.runtimeStyle.width,r=b.runtimeStyle.height;b.runtimeStyle.width="auto";b.runtimeStyle.height="auto";var n=b.width,o=b.height;b.runtimeStyle.width=m;b.runtimeStyle.height=r;if(arguments.length==3){a=arguments[1];c=arguments[2];h=g=0;l=d=n;e=f=o}else if(arguments.length==
5){a=arguments[1];c=arguments[2];d=arguments[3];f=arguments[4];h=g=0;l=n;e=o}else if(arguments.length==9){h=arguments[1];g=arguments[2];l=arguments[3];e=arguments[4];a=arguments[5];c=arguments[6];d=arguments[7];f=arguments[8]}else throw Error("Invalid number of arguments");var q=this.getCoords_(a,c),t=[];t.push(" <g_vml_:group",' coordsize="',k*10,",",k*10,'"',' coordorigin="0,0"',' style="width:',10,"px;height:",10,"px;position:absolute;");if(this.m_[0][0]!=1||this.m_[0][1]){var E=[];E.push("M11=",
this.m_[0][0],",","M12=",this.m_[1][0],",","M21=",this.m_[0][1],",","M22=",this.m_[1][1],",","Dx=",j(q.x/k),",","Dy=",j(q.y/k),"");var p=q,z=this.getCoords_(a+d,c),w=this.getCoords_(a,c+f),x=this.getCoords_(a+d,c+f);p.x=s.max(p.x,z.x,w.x,x.x);p.y=s.max(p.y,z.y,w.y,x.y);t.push("padding:0 ",j(p.x/k),"px ",j(p.y/k),"px 0;filter:progid:DXImageTransform.Microsoft.Matrix(",E.join(""),", sizingmethod='clip');")}else t.push("top:",j(q.y/k),"px;left:",j(q.x/k),"px;");t.push(' ">','<g_vml_:image src="',b.src,
'"',' style="width:',k*d,"px;"," height:",k*f,'px;"',' cropleft="',h/n,'"',' croptop="',g/o,'"',' cropright="',(n-h-l)/n,'"',' cropbottom="',(o-g-e)/o,'"'," />","</g_vml_:group>");this.element_.insertAdjacentHTML("BeforeEnd",t.join(""))};i.stroke=function(b){var a=[],c=P(b?this.fillStyle:this.strokeStyle),d=c.color,f=c.alpha*this.globalAlpha;a.push("<g_vml_:shape",' filled="',!!b,'"',' style="position:absolute;width:',10,"px;height:",10,'px;"',' coordorigin="0 0" coordsize="',k*10," ",k*10,'"',' stroked="',
!b,'"',' path="');var h={x:null,y:null},g={x:null,y:null},l=0;for(;l<this.currentPath_.length;l++){var e=this.currentPath_[l];switch(e.type){case "moveTo":a.push(" m ",j(e.x),",",j(e.y));break;case "lineTo":a.push(" l ",j(e.x),",",j(e.y));break;case "close":a.push(" x ");e=null;break;case "bezierCurveTo":a.push(" c ",j(e.cp1x),",",j(e.cp1y),",",j(e.cp2x),",",j(e.cp2y),",",j(e.x),",",j(e.y));break;case "at":case "wa":a.push(" ",e.type," ",j(e.x-this.arcScaleX_*e.radius),",",j(e.y-this.arcScaleY_*e.radius),
" ",j(e.x+this.arcScaleX_*e.radius),",",j(e.y+this.arcScaleY_*e.radius)," ",j(e.xStart),",",j(e.yStart)," ",j(e.xEnd),",",j(e.yEnd));break}if(e){if(h.x==null||e.x<h.x)h.x=e.x;if(g.x==null||e.x>g.x)g.x=e.x;if(h.y==null||e.y<h.y)h.y=e.y;if(g.y==null||e.y>g.y)g.y=e.y}}a.push(' ">');if(b)if(typeof this.fillStyle=="object"){var m=this.fillStyle,r=0,n={x:0,y:0},o=0,q=1;if(m.type_=="gradient"){var t=m.x1_/this.arcScaleX_,E=m.y1_/this.arcScaleY_,p=this.getCoords_(m.x0_/this.arcScaleX_,m.y0_/this.arcScaleY_),
z=this.getCoords_(t,E);r=Math.atan2(z.x-p.x,z.y-p.y)*180/Math.PI;if(r<0)r+=360;if(r<1.0E-6)r=0}else{var p=this.getCoords_(m.x0_,m.y0_),w=g.x-h.x,x=g.y-h.y;n={x:(p.x-h.x)/w,y:(p.y-h.y)/x};w/=this.arcScaleX_*k;x/=this.arcScaleY_*k;var R=s.max(w,x);o=2*m.r0_/R;q=2*m.r1_/R-o}var u=m.colors_;u.sort(function(ba,ca){return ba.offset-ca.offset});var J=u.length,da=u[0].color,ea=u[J-1].color,fa=u[0].alpha*this.globalAlpha,ga=u[J-1].alpha*this.globalAlpha,S=[],l=0;for(;l<J;l++){var T=u[l];S.push(T.offset*q+
o+" "+T.color)}a.push('<g_vml_:fill type="',m.type_,'"',' method="none" focus="100%"',' color="',da,'"',' color2="',ea,'"',' colors="',S.join(","),'"',' opacity="',ga,'"',' g_o_:opacity2="',fa,'"',' angle="',r,'"',' focusposition="',n.x,",",n.y,'" />')}else a.push('<g_vml_:fill color="',d,'" opacity="',f,'" />');else{var K=this.lineScale_*this.lineWidth;if(K<1)f*=K;a.push("<g_vml_:stroke",' opacity="',f,'"',' joinstyle="',this.lineJoin,'"',' miterlimit="',this.miterLimit,'"',' endcap="',aa(this.lineCap),
'"',' weight="',K,'px"',' color="',d,'" />')}a.push("</g_vml_:shape>");this.element_.insertAdjacentHTML("beforeEnd",a.join(""))};i.fill=function(){this.stroke(true)};i.closePath=function(){this.currentPath_.push({type:"close"})};i.getCoords_=function(b,a){var c=this.m_;return{x:k*(b*c[0][0]+a*c[1][0]+c[2][0])-v,y:k*(b*c[0][1]+a*c[1][1]+c[2][1])-v}};i.save=function(){var b={};O(this,b);this.aStack_.push(b);this.mStack_.push(this.m_);this.m_=y(I(),this.m_)};i.restore=function(){O(this.aStack_.pop(),
this);this.m_=this.mStack_.pop()};function ha(b){var a=0;for(;a<3;a++){var c=0;for(;c<2;c++)if(!isFinite(b[a][c])||isNaN(b[a][c]))return false}return true}function A(b,a,c){if(!!ha(a)){b.m_=a;if(c)b.lineScale_=W(V(a[0][0]*a[1][1]-a[0][1]*a[1][0]))}}i.translate=function(b,a){A(this,y([[1,0,0],[0,1,0],[b,a,1]],this.m_),false)};i.rotate=function(b){var a=G(b),c=F(b);A(this,y([[a,c,0],[-c,a,0],[0,0,1]],this.m_),false)};i.scale=function(b,a){this.arcScaleX_*=b;this.arcScaleY_*=a;A(this,y([[b,0,0],[0,a,
0],[0,0,1]],this.m_),true)};i.transform=function(b,a,c,d,f,h){A(this,y([[b,a,0],[c,d,0],[f,h,1]],this.m_),true)};i.setTransform=function(b,a,c,d,f,h){A(this,[[b,a,0],[c,d,0],[f,h,1]],true)};i.clip=function(){};i.arcTo=function(){};i.createPattern=function(){return new U};function D(b){this.type_=b;this.r1_=this.y1_=this.x1_=this.r0_=this.y0_=this.x0_=0;this.colors_=[]}D.prototype.addColorStop=function(b,a){a=P(a);this.colors_.push({offset:b,color:a.color,alpha:a.alpha})};function U(){}G_vmlCanvasManager=
M;CanvasRenderingContext2D=H;CanvasGradient=D;CanvasPattern=U})();
// Underscore.js 1.1.7
// (c) 2011 Jeremy Ashkenas, DocumentCloud Inc.
// Underscore is freely distributable under the MIT license.
// Portions of Underscore are inspired or borrowed from Prototype,
// Oliver Steele's Functional, and John Resig's Micro-Templating.
// For all details and documentation:
// http://documentcloud.github.com/underscore
(function(){var p=this,C=p._,m={},i=Array.prototype,n=Object.prototype,f=i.slice,D=i.unshift,E=n.toString,l=n.hasOwnProperty,s=i.forEach,t=i.map,u=i.reduce,v=i.reduceRight,w=i.filter,x=i.every,y=i.some,o=i.indexOf,z=i.lastIndexOf;n=Array.isArray;var F=Object.keys,q=Function.prototype.bind,b=function(a){return new j(a)};typeof module!=="undefined"&&module.exports?(module.exports=b,b._=b):p._=b;b.VERSION="1.1.7";var h=b.each=b.forEach=function(a,c,b){if(a!=null)if(s&&a.forEach===s)a.forEach(c,b);else if(a.length===
+a.length)for(var e=0,k=a.length;e<k;e++){if(e in a&&c.call(b,a[e],e,a)===m)break}else for(e in a)if(l.call(a,e)&&c.call(b,a[e],e,a)===m)break};b.map=function(a,c,b){var e=[];if(a==null)return e;if(t&&a.map===t)return a.map(c,b);h(a,function(a,g,G){e[e.length]=c.call(b,a,g,G)});return e};b.reduce=b.foldl=b.inject=function(a,c,d,e){var k=d!==void 0;a==null&&(a=[]);if(u&&a.reduce===u)return e&&(c=b.bind(c,e)),k?a.reduce(c,d):a.reduce(c);h(a,function(a,b,f){k?d=c.call(e,d,a,b,f):(d=a,k=!0)});if(!k)throw new TypeError("Reduce of empty array with no initial value");
return d};b.reduceRight=b.foldr=function(a,c,d,e){a==null&&(a=[]);if(v&&a.reduceRight===v)return e&&(c=b.bind(c,e)),d!==void 0?a.reduceRight(c,d):a.reduceRight(c);a=(b.isArray(a)?a.slice():b.toArray(a)).reverse();return b.reduce(a,c,d,e)};b.find=b.detect=function(a,c,b){var e;A(a,function(a,g,f){if(c.call(b,a,g,f))return e=a,!0});return e};b.filter=b.select=function(a,c,b){var e=[];if(a==null)return e;if(w&&a.filter===w)return a.filter(c,b);h(a,function(a,g,f){c.call(b,a,g,f)&&(e[e.length]=a)});return e};
b.reject=function(a,c,b){var e=[];if(a==null)return e;h(a,function(a,g,f){c.call(b,a,g,f)||(e[e.length]=a)});return e};b.every=b.all=function(a,c,b){var e=!0;if(a==null)return e;if(x&&a.every===x)return a.every(c,b);h(a,function(a,g,f){if(!(e=e&&c.call(b,a,g,f)))return m});return e};var A=b.some=b.any=function(a,c,d){c=c||b.identity;var e=!1;if(a==null)return e;if(y&&a.some===y)return a.some(c,d);h(a,function(a,b,f){if(e|=c.call(d,a,b,f))return m});return!!e};b.include=b.contains=function(a,c){var b=
!1;if(a==null)return b;if(o&&a.indexOf===o)return a.indexOf(c)!=-1;A(a,function(a){if(b=a===c)return!0});return b};b.invoke=function(a,c){var d=f.call(arguments,2);return b.map(a,function(a){return(c.call?c||a:a[c]).apply(a,d)})};b.pluck=function(a,c){return b.map(a,function(a){return a[c]})};b.max=function(a,c,d){if(!c&&b.isArray(a))return Math.max.apply(Math,a);var e={computed:-Infinity};h(a,function(a,b,f){b=c?c.call(d,a,b,f):a;b>=e.computed&&(e={value:a,computed:b})});return e.value};b.min=function(a,
c,d){if(!c&&b.isArray(a))return Math.min.apply(Math,a);var e={computed:Infinity};h(a,function(a,b,f){b=c?c.call(d,a,b,f):a;b<e.computed&&(e={value:a,computed:b})});return e.value};b.sortBy=function(a,c,d){return b.pluck(b.map(a,function(a,b,f){return{value:a,criteria:c.call(d,a,b,f)}}).sort(function(a,b){var c=a.criteria,d=b.criteria;return c<d?-1:c>d?1:0}),"value")};b.groupBy=function(a,b){var d={};h(a,function(a,f){var g=b(a,f);(d[g]||(d[g]=[])).push(a)});return d};b.sortedIndex=function(a,c,d){d||
(d=b.identity);for(var e=0,f=a.length;e<f;){var g=e+f>>1;d(a[g])<d(c)?e=g+1:f=g}return e};b.toArray=function(a){if(!a)return[];if(a.toArray)return a.toArray();if(b.isArray(a))return f.call(a);if(b.isArguments(a))return f.call(a);return b.values(a)};b.size=function(a){return b.toArray(a).length};b.first=b.head=function(a,b,d){return b!=null&&!d?f.call(a,0,b):a[0]};b.rest=b.tail=function(a,b,d){return f.call(a,b==null||d?1:b)};b.last=function(a){return a[a.length-1]};b.compact=function(a){return b.filter(a,
function(a){return!!a})};b.flatten=function(a){return b.reduce(a,function(a,d){if(b.isArray(d))return a.concat(b.flatten(d));a[a.length]=d;return a},[])};b.without=function(a){return b.difference(a,f.call(arguments,1))};b.uniq=b.unique=function(a,c){return b.reduce(a,function(a,e,f){if(0==f||(c===!0?b.last(a)!=e:!b.include(a,e)))a[a.length]=e;return a},[])};b.union=function(){return b.uniq(b.flatten(arguments))};b.intersection=b.intersect=function(a){var c=f.call(arguments,1);return b.filter(b.uniq(a),
function(a){return b.every(c,function(c){return b.indexOf(c,a)>=0})})};b.difference=function(a,c){return b.filter(a,function(a){return!b.include(c,a)})};b.zip=function(){for(var a=f.call(arguments),c=b.max(b.pluck(a,"length")),d=Array(c),e=0;e<c;e++)d[e]=b.pluck(a,""+e);return d};b.indexOf=function(a,c,d){if(a==null)return-1;var e;if(d)return d=b.sortedIndex(a,c),a[d]===c?d:-1;if(o&&a.indexOf===o)return a.indexOf(c);d=0;for(e=a.length;d<e;d++)if(a[d]===c)return d;return-1};b.lastIndexOf=function(a,
b){if(a==null)return-1;if(z&&a.lastIndexOf===z)return a.lastIndexOf(b);for(var d=a.length;d--;)if(a[d]===b)return d;return-1};b.range=function(a,b,d){arguments.length<=1&&(b=a||0,a=0);d=arguments[2]||1;for(var e=Math.max(Math.ceil((b-a)/d),0),f=0,g=Array(e);f<e;)g[f++]=a,a+=d;return g};b.bind=function(a,b){if(a.bind===q&&q)return q.apply(a,f.call(arguments,1));var d=f.call(arguments,2);return function(){return a.apply(b,d.concat(f.call(arguments)))}};b.bindAll=function(a){var c=f.call(arguments,1);
c.length==0&&(c=b.functions(a));h(c,function(c){a[c]=b.bind(a[c],a)});return a};b.memoize=function(a,c){var d={};c||(c=b.identity);return function(){var b=c.apply(this,arguments);return l.call(d,b)?d[b]:d[b]=a.apply(this,arguments)}};b.delay=function(a,b){var d=f.call(arguments,2);return setTimeout(function(){return a.apply(a,d)},b)};b.defer=function(a){return b.delay.apply(b,[a,1].concat(f.call(arguments,1)))};var B=function(a,b,d){var e;return function(){var f=this,g=arguments,h=function(){e=null;
a.apply(f,g)};d&&clearTimeout(e);if(d||!e)e=setTimeout(h,b)}};b.throttle=function(a,b){return B(a,b,!1)};b.debounce=function(a,b){return B(a,b,!0)};b.once=function(a){var b=!1,d;return function(){if(b)return d;b=!0;return d=a.apply(this,arguments)}};b.wrap=function(a,b){return function(){var d=[a].concat(f.call(arguments));return b.apply(this,d)}};b.compose=function(){var a=f.call(arguments);return function(){for(var b=f.call(arguments),d=a.length-1;d>=0;d--)b=[a[d].apply(this,b)];return b[0]}};b.after=
function(a,b){return function(){if(--a<1)return b.apply(this,arguments)}};b.keys=F||function(a){if(a!==Object(a))throw new TypeError("Invalid object");var b=[],d;for(d in a)l.call(a,d)&&(b[b.length]=d);return b};b.values=function(a){return b.map(a,b.identity)};b.functions=b.methods=function(a){var c=[],d;for(d in a)b.isFunction(a[d])&&c.push(d);return c.sort()};b.extend=function(a){h(f.call(arguments,1),function(b){for(var d in b)b[d]!==void 0&&(a[d]=b[d])});return a};b.defaults=function(a){h(f.call(arguments,
1),function(b){for(var d in b)a[d]==null&&(a[d]=b[d])});return a};b.clone=function(a){return b.isArray(a)?a.slice():b.extend({},a)};b.tap=function(a,b){b(a);return a};b.isEqual=function(a,c){if(a===c)return!0;var d=typeof a;if(d!=typeof c)return!1;if(a==c)return!0;if(!a&&c||a&&!c)return!1;if(a._chain)a=a._wrapped;if(c._chain)c=c._wrapped;if(a.isEqual)return a.isEqual(c);if(c.isEqual)return c.isEqual(a);if(b.isDate(a)&&b.isDate(c))return a.getTime()===c.getTime();if(b.isNaN(a)&&b.isNaN(c))return!1;
if(b.isRegExp(a)&&b.isRegExp(c))return a.source===c.source&&a.global===c.global&&a.ignoreCase===c.ignoreCase&&a.multiline===c.multiline;if(d!=="object")return!1;if(a.length&&a.length!==c.length)return!1;d=b.keys(a);var e=b.keys(c);if(d.length!=e.length)return!1;for(var f in a)if(!(f in c)||!b.isEqual(a[f],c[f]))return!1;return!0};b.isEmpty=function(a){if(b.isArray(a)||b.isString(a))return a.length===0;for(var c in a)if(l.call(a,c))return!1;return!0};b.isElement=function(a){return!!(a&&a.nodeType==
1)};b.isArray=n||function(a){return E.call(a)==="[object Array]"};b.isObject=function(a){return a===Object(a)};b.isArguments=function(a){return!(!a||!l.call(a,"callee"))};b.isFunction=function(a){return!(!a||!a.constructor||!a.call||!a.apply)};b.isString=function(a){return!!(a===""||a&&a.charCodeAt&&a.substr)};b.isNumber=function(a){return!!(a===0||a&&a.toExponential&&a.toFixed)};b.isNaN=function(a){return a!==a};b.isBoolean=function(a){return a===!0||a===!1};b.isDate=function(a){return!(!a||!a.getTimezoneOffset||
!a.setUTCFullYear)};b.isRegExp=function(a){return!(!a||!a.test||!a.exec||!(a.ignoreCase||a.ignoreCase===!1))};b.isNull=function(a){return a===null};b.isUndefined=function(a){return a===void 0};b.noConflict=function(){p._=C;return this};b.identity=function(a){return a};b.times=function(a,b,d){for(var e=0;e<a;e++)b.call(d,e)};b.mixin=function(a){h(b.functions(a),function(c){H(c,b[c]=a[c])})};var I=0;b.uniqueId=function(a){var b=I++;return a?a+b:b};b.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g};
b.template=function(a,c){var d=b.templateSettings;d="var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('"+a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(d.interpolate,function(a,b){return"',"+b.replace(/\\'/g,"'")+",'"}).replace(d.evaluate||null,function(a,b){return"');"+b.replace(/\\'/g,"'").replace(/[\r\n\t]/g," ")+"__p.push('"}).replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/\t/g,"\\t")+"');}return __p.join('');";d=new Function("obj",d);return c?d(c):d};
var j=function(a){this._wrapped=a};b.prototype=j.prototype;var r=function(a,c){return c?b(a).chain():a},H=function(a,c){j.prototype[a]=function(){var a=f.call(arguments);D.call(a,this._wrapped);return r(c.apply(b,a),this._chain)}};b.mixin(b);h(["pop","push","reverse","shift","sort","splice","unshift"],function(a){var b=i[a];j.prototype[a]=function(){b.apply(this._wrapped,arguments);return r(this._wrapped,this._chain)}});h(["concat","join","slice"],function(a){var b=i[a];j.prototype[a]=function(){return r(b.apply(this._wrapped,
arguments),this._chain)}});j.prototype.chain=function(){this._chain=!0;return this};j.prototype.value=function(){return this._wrapped}})();
/*
* jQuery UI Tag-it!
*
* @version v2.0 (06/2011)
*
* Copyright 2011, Levy Carneiro Jr.
* Released under the MIT license.
* http://aehlke.github.com/tag-it/LICENSE
*
* Homepage:
*   http://aehlke.github.com/tag-it/
*
* Authors:
*   Levy Carneiro Jr.
*   Martin Rehfeld
*   Tobias Schmidt
*   Skylar Challand
*   Alex Ehlke
*
* Maintainer:
*   Alex Ehlke - Twitter: @aehlke
*
* Dependencies:
*   jQuery v1.4+
*   jQuery UI v1.8+
*/
(function($) {

    $.widget('ui.tagit', {
        options: {
            itemName          : 'item',
            fieldName         : 'tags',
            availableTags     : [],
            tagSource         : null,
            removeConfirmation: false,
            caseSensitive     : true,

            // When enabled, quotes are not neccesary
            // for inputting multi-word tags.
            allowSpaces: false,

            // The below options are for using a single field instead of several
            // for our form values.
            //
            // When enabled, will use a single hidden field for the form,
            // rather than one per tag. It will delimit tags in the field
            // with singleFieldDelimiter.
            singleField: false,

            singleFieldDelimiter: ',',

            // Set this to an input DOM node to use an existing form field.
            // Any text in it will be erased on init. But it will be
            // populated with the text of tags as they are created,
            // delimited by singleFieldDelimiter.
            // If this is not set, we create an input node for it,
            // with the name // given in settings.fieldName,
            // ignoring settings.itemName.
            singleFieldNode: null,

            // Optionally set a tabindex attribute on the input that gets
            // created for tag-it.
            tabIndex: null,


            // Event callbacks.
            onTagAdded  : null,
            onTagRemoved: null,
            onTagClicked: null
        },


        _create: function() {
            // for handling static scoping inside callbacks
            var that = this;

            // There are 2 kinds of DOM nodes this widget can be instantiated on:
            //     1. UL, OL, or some element containing either of these.
            //     2. INPUT, in which case 'singleField' is overridden to true,
            //        a UL is created and the INPUT is hidden.
            if (this.element.is('input')) {
                this.tagList = $('<ul></ul>').insertAfter(this.element);
                this.options.singleField = true;
                this.options.singleFieldNode = this.element;
                this.element.css('display', 'none');
            } else {
                this.tagList = this.element.find('ul, ol').andSelf().last();
            }

            this._tagInput = $('<input type="text">').addClass('ui-widget-content');
            if (this.options.tabIndex) {
                this._tagInput.attr('tabindex', this.options.tabIndex);
            }

            this.options.tagSource = this.options.tagSource || function(search, showChoices) {
                var filter = search.term.toLowerCase();
                var choices = $.grep(that.options.availableTags, function(element) {
                    // Only match autocomplete options that begin with the search term.
                    // (Case insensitive.)
                    return (element.toLowerCase().indexOf(filter) === 0);
                });
                showChoices(that._subtractArray(choices, that.assignedTags()));
            };
            
            this.tagList[0].clickHandler = function(e) {
                var target = $(e.target);
                if (target.hasClass('tagit-label')) {
                    that._trigger('onTagClicked', e, target.closest('.tagit-choice'));
                } else {
                    // Sets the focus() to the input field, if the user
                    // clicks anywhere inside the UL. This is needed
                    // because the input field needs to be of a small size.
                    that._tagInput.focus();
                }
            };

            this.tagList
                .addClass('tagit')
                .addClass('ui-widget ui-widget-content ui-corner-all')
                // Create the input field.
                .append($('<li class="tagit-new"></li>').append(this._tagInput))
                .click(this.tagList[0].clickHandler);

            // Add existing tags from the list, if any.
            this.tagList.children('li').each(function() {
                if (!$(this).hasClass('tagit-new')) {
                    that.createTag($(this).text(), $(this).attr('class'));
                    $(this).remove();
                }
            });

            // Single field support.
            if (this.options.singleField) {
                if (this.options.singleFieldNode) {
                    // Add existing tags from the input field.
                    var node = $(this.options.singleFieldNode);
                    var tags = node.val().split(this.options.singleFieldDelimiter);
                    node.val('');
                    $.each(tags, function(index, tag) {
                        that.createTag(tag);
                    });
                } else {
                    // Create our single field input after our list.
                    this.options.singleFieldNode = $('<input type="hidden" style="display:none;" value="" name="' + this.options.fieldName + '">');
                    this.tagList.after(this.options.singleFieldNode);
                }
            }

            // Events.
            this._tagInput
                .keydown(function(event) {
                    // Backspace is not detected within a keypress, so it must use keydown.
                    if (event.which == $.ui.keyCode.BACKSPACE && that._tagInput.val() === '') {
                        var tag = that._lastTag();
                        if (!that.options.removeConfirmation || tag.hasClass('remove')) {
                            // When backspace is pressed, the last tag is deleted.
                            that.removeTag(tag);
                        } else if (that.options.removeConfirmation) {
                            tag.addClass('remove ui-state-highlight');
                        }
                    } else if (that.options.removeConfirmation) {
                        that._lastTag().removeClass('remove ui-state-highlight');
                    }

                    // Comma/Space/Enter are all valid delimiters for new tags,
                    // except when there is an open quote or if setting allowSpaces = true.
                    // Tab will also create a tag, unless the tag input is empty, in which case it isn't caught.
                    if (
                        event.which == $.ui.keyCode.COMMA ||
                        event.which == $.ui.keyCode.ENTER ||
                        (
                            event.which == $.ui.keyCode.TAB &&
                            that._tagInput.val() !== ''
                        ) ||
                        (
                            event.which == $.ui.keyCode.SPACE &&
                            that.options.allowSpaces !== true &&
                            (
                                $.trim(that._tagInput.val()).replace( /^s*/, '' ).charAt(0) != '"' ||
                                (
                                    $.trim(that._tagInput.val()).charAt(0) == '"' &&
                                    $.trim(that._tagInput.val()).charAt($.trim(that._tagInput.val()).length - 1) == '"' &&
                                    $.trim(that._tagInput.val()).length - 1 !== 0
                                )
                            )
                        )
                    ) {
                        event.preventDefault();
                        that.createTag(that._cleanedInput());

                        // The autocomplete doesn't close automatically when TAB is pressed.
                        // So let's ensure that it closes.
                        that._tagInput.autocomplete('close');
                    }
                }).blur(function(e){    
                    var $this = $(this);
                    // Create a tag when the element loses focus (unless it's empty).
                    that.createTag(that._cleanedInput());
                    $this.width(0);
                    $this.parent().width(0);
                }).focus(function(e){        
                    var $this = $(this);
                    $this.parent().width(150);
                    $this.width(150);
                });
                

            // Autocomplete.
            if (this.options.availableTags || this.options.tagSource) {
                this._tagInput.autocomplete({
                    source: this.options.tagSource,
                    select: function(event, ui) {
                        // Delete the last tag if we autocomplete something despite the input being empty
                        // This happens because the input's blur event causes the tag to be created when
                        // the user clicks an autocomplete item.
                        // The only artifact of this is that while the user holds down the mouse button
                        // on the selected autocomplete item, a tag is shown with the pre-autocompleted text,
                        // and is changed to the autocompleted text upon mouseup.
                        if (that._tagInput.val() === '') {
                            //that.removeTag(that._lastTag(), false);
                            that._lastTag().remove();
                        }
                        that.createTag(ui.item.value);
                        // Preventing the tag input to be updated with the chosen value.
                        return false;
                    }
                });
            }
        },

        _cleanedInput: function() {
            // Returns the contents of the tag input, cleaned and ready to be passed to createTag
            return $.trim(this._tagInput.val().replace(/^"(.*)"$/, '$1'));
        },

        _lastTag: function() {
            return this.tagList.children('.tagit-choice:last');
        },

        assignedTags: function() {
            // Returns an array of tag string values
            var that = this;
            var tags = [];
            if (this.options.singleField) {
                tags = $(this.options.singleFieldNode).val().split(this.options.singleFieldDelimiter);
                if (tags[0] === '') {
                    tags = [];
                }
            } else {
                this.tagList.children('.tagit-choice').each(function() {
                    tags.push(that.tagLabel(this));
                });
            }
            return tags;
        },

        _updateSingleTagsField: function(tags) {
            // Takes a list of tag string values, updates this.options.singleFieldNode.val to the tags delimited by this.options.singleFieldDelimiter
            $(this.options.singleFieldNode).val(tags.join(this.options.singleFieldDelimiter));
        },

        _subtractArray: function(a1, a2) {
            var result = [];
            for (var i = 0; i < a1.length; i++) {
                if ($.inArray(a1[i], a2) == -1) {
                    result.push(a1[i]);
                }
            }
            return result;
        },

        tagLabel: function(tag) {
            // Returns the tag's string label.
            if (this.options.singleField) {
                return $(tag).children('.tagit-label').text();
            } else {
                return $(tag).children('input').val();
            }
        },

        _isNew: function(value) {
            var that = this;
            var isNew = true;
            this.tagList.children('.tagit-choice').each(function(i) {
                if (that._formatStr(value) == that._formatStr(that.tagLabel(this))) {
                    isNew = false;
                    return;
                }
            });
            return isNew;
        },

        _formatStr: function(str) {
            if (this.options.caseSensitive) {
                return str;
            }
            return $.trim(str.toLowerCase());
        },

        createTag: function(value, additionalClass) {
            
            function bindClickEvent(tagit, element, tag) {
                element.bind('click', function() {
                    tagit.removeTag(tag);
                });
            }
            
            that = this;
            // Automatically trims the value of leading and trailing whitespace.
            value = $.trim(value);

            if (!this._isNew(value) || value === '') {
                return false;
            }

            var label = $(this.options.onTagClicked ? '<a class="tagit-label"></a>' : '<span class="tagit-label"></span>').text(value);

            // Create tag.
            var tag = $('<li></li>')
                .addClass('tagit-choice ui-widget-content ui-state-default ui-corner-all')
                .addClass(additionalClass)
                .append(label);

            // Button for removing the tag.
            var removeTagIcon = $('<span></span>')
                .addClass('ui-icon ui-icon-close');
            var removeTag = $('<a><span class="text-icon">\xd7</span></a>') // \xd7 is an X
                .addClass('close')
                .append(removeTagIcon);
            tag.append(removeTag);
            bindClickEvent(this, removeTag, tag);

            // Unless options.singleField is set, each tag has a hidden input field inline.
            if (this.options.singleField) {
                var tags = this.assignedTags();
                tags.push(value);
                this._updateSingleTagsField(tags);
            } else {
                var escapedValue = label.html();
                tag.append('<input type="hidden" style="display:none;" value="' + escapedValue + '" name="' + this.options.itemName + '[' + this.options.fieldName + '][]">');
            }

            // Cleaning the input.
            this._tagInput.val('');

            // insert tag
            this._tagInput.parent().before(tag);

            this._trigger('onTagAdded', null, tag);
        },
        
        removeTag: function(tag, animate) {
            if (typeof animate === 'undefined') { animate = true; }

            tag = $(tag);

            if (this.options.singleField) {
                var tags = this.assignedTags();
                var removedTagLabel = this.tagLabel(tag);
                tags = $.grep(tags, function(el){
                    return el != removedTagLabel;
                });
                this._updateSingleTagsField(tags);
            }
            // Animate the removal.
            that = this;
            if (animate) {
                tag.fadeOut('fast').hide('blind', {direction: 'horizontal'}, 'fast', function(){
                    tag.remove();
                    that._trigger('onTagRemoved', null, tag);
                }).dequeue();
            } else {
                tag.remove();
                that._trigger('onTagRemoved', null, tag);
            }
        },

        removeAll: function() {
            // Removes all tags. Takes an optional `animate` argument.
            var that = this;
            this.tagList.children('.tagit-choice').each(function(index, tag) {
                that.removeTag(tag, false);
            });
        }

    });

})(jQuery);


/**
 * @license
 * jQuery Tools 1.2.5 History "Back button for AJAX apps"
 *
 * NO COPYRIGHTS OR LICENSES. DO WHAT YOU LIKE.
 *
 * http://flowplayer.org/tools/toolbox/history.html
 *
 * Since: Mar 2010
 * Date:    Wed Sep 22 06:02:10 2010 +0000
 */
(function($) {

    var initialized, iframe, links;

    // create iframe that is constantly checked for hash changes
    function buildIframe() {
        iframe = $('<iframe/>').attr('src', 'javascript:false;').hide().get(0);
        $('body').append(iframe);
    }

    $.tools = $.tools || {version: '1.2.5'};

    $.tools.history = {

        conf: {
        },

        init: function(elements) {

            var conf = this.conf;

            function hashEventTrigger(hashEval) {
                setInterval(function() {
                    var h = hashEval();
                    if (h !== conf.hash) {
                        conf.hash = h;
                        links.filter('*[href=' + conf.hash + ']').trigger('history', h);
                    }
                }, 100);
            }

            function setIframeLocation(h) {
                if (h) {
                    var doc = iframe.contentWindow.document;
                    doc.open().close();
                    doc.location.hash = h;
                }
            }

            if (!initialized) {
                if ($.browser.msie && $.browser.version < '8') { // IE
                    buildIframe();
                    hashEventTrigger(function() {
                        return iframe.contentWindow.document.location.hash;
                    });
                    setIframeLocation(location.hash || '#');
                } else { // other browsers scans for location.hash changes directly without iframe hack
                    hashEventTrigger(function() {
                        return location.hash;
                    });
                }
                initialized = true;
            }

            links = !links ? elements : links.add(elements);
            elements.click(function(event) {
                if (iframe) {
                    var href = $(this).attr('href');
                    setIframeLocation(href);
                }
            });

        }
    };

    $.fn.initHistory = function() {
        $.tools.history.init(this);
    };

    $.fn.history = function(fn) {
        $.tools.history.init(this);
        return this.bind('history', fn);
    };

})(jQuery); 

// Backbone.js 0.5.3
// (c) 2010 Jeremy Ashkenas, DocumentCloud Inc.
// Backbone may be freely distributed under the MIT license.
// For all details and documentation:
// http://documentcloud.github.com/backbone
(function(){var h=this,p=h.Backbone,e;e=typeof exports!=="undefined"?exports:h.Backbone={};e.VERSION="0.5.3";var f=h._;if(!f&&typeof require!=="undefined")f=require("underscore")._;var g=h.jQuery||h.Zepto;e.noConflict=function(){h.Backbone=p;return this};e.emulateHTTP=!1;e.emulateJSON=!1;e.Events={bind:function(a,b,c){var d=this._callbacks||(this._callbacks={});(d[a]||(d[a]=[])).push([b,c]);return this},unbind:function(a,b){var c;if(a){if(c=this._callbacks)if(b){c=c[a];if(!c)return this;for(var d=
0,e=c.length;d<e;d++)if(c[d]&&b===c[d][0]){c[d]=null;break}}else c[a]=[]}else this._callbacks={};return this},trigger:function(a){var b,c,d,e,f=2;if(!(c=this._callbacks))return this;for(;f--;)if(b=f?a:"all",b=c[b])for(var g=0,h=b.length;g<h;g++)(d=b[g])?(e=f?Array.prototype.slice.call(arguments,1):arguments,d[0].apply(d[1]||this,e)):(b.splice(g,1),g--,h--);return this}};e.Model=function(a,b){var c;a||(a={});if(c=this.defaults)f.isFunction(c)&&(c=c.call(this)),a=f.extend({},c,a);this.attributes={};
this._escapedAttributes={};this.cid=f.uniqueId("c");this.set(a,{silent:!0});this._changed=!1;this._previousAttributes=f.clone(this.attributes);if(b&&b.collection)this.collection=b.collection;this.initialize(a,b)};f.extend(e.Model.prototype,e.Events,{_previousAttributes:null,_changed:!1,idAttribute:"id",initialize:function(){},toJSON:function(){return f.clone(this.attributes)},get:function(a){return this.attributes[a]},escape:function(a){var b;if(b=this._escapedAttributes[a])return b;b=this.attributes[a];
return this._escapedAttributes[a]=(b==null?"":""+b).replace(/&(?!\w+;|#\d+;|#x[\da-f]+;)/gi,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;").replace(/\//g,"&#x2F;")},has:function(a){return this.attributes[a]!=null},set:function(a,b){b||(b={});if(!a)return this;if(a.attributes)a=a.attributes;var c=this.attributes,d=this._escapedAttributes;if(!b.silent&&this.validate&&!this._performValidation(a,b))return!1;if(this.idAttribute in a)this.id=a[this.idAttribute];
var e=this._changing;this._changing=!0;for(var g in a){var h=a[g];if(!f.isEqual(c[g],h))c[g]=h,delete d[g],this._changed=!0,b.silent||this.trigger("change:"+g,this,h,b)}!e&&!b.silent&&this._changed&&this.change(b);this._changing=!1;return this},unset:function(a,b){if(!(a in this.attributes))return this;b||(b={});var c={};c[a]=void 0;if(!b.silent&&this.validate&&!this._performValidation(c,b))return!1;delete this.attributes[a];delete this._escapedAttributes[a];a==this.idAttribute&&delete this.id;this._changed=
!0;b.silent||(this.trigger("change:"+a,this,void 0,b),this.change(b));return this},clear:function(a){a||(a={});var b,c=this.attributes,d={};for(b in c)d[b]=void 0;if(!a.silent&&this.validate&&!this._performValidation(d,a))return!1;this.attributes={};this._escapedAttributes={};this._changed=!0;if(!a.silent){for(b in c)this.trigger("change:"+b,this,void 0,a);this.change(a)}return this},fetch:function(a){a||(a={});var b=this,c=a.success;a.success=function(d,e,f){if(!b.set(b.parse(d,f),a))return!1;c&&
c(b,d)};a.error=i(a.error,b,a);return(this.sync||e.sync).call(this,"read",this,a)},save:function(a,b){b||(b={});if(a&&!this.set(a,b))return!1;var c=this,d=b.success;b.success=function(a,e,f){if(!c.set(c.parse(a,f),b))return!1;d&&d(c,a,f)};b.error=i(b.error,c,b);var f=this.isNew()?"create":"update";return(this.sync||e.sync).call(this,f,this,b)},destroy:function(a){a||(a={});if(this.isNew())return this.trigger("destroy",this,this.collection,a);var b=this,c=a.success;a.success=function(d){b.trigger("destroy",
b,b.collection,a);c&&c(b,d)};a.error=i(a.error,b,a);return(this.sync||e.sync).call(this,"delete",this,a)},url:function(){var a=k(this.collection)||this.urlRoot||l();if(this.isNew())return a;return a+(a.charAt(a.length-1)=="/"?"":"/")+encodeURIComponent(this.id)},parse:function(a){return a},clone:function(){return new this.constructor(this)},isNew:function(){return this.id==null},change:function(a){this.trigger("change",this,a);this._previousAttributes=f.clone(this.attributes);this._changed=!1},hasChanged:function(a){if(a)return this._previousAttributes[a]!=
this.attributes[a];return this._changed},changedAttributes:function(a){a||(a=this.attributes);var b=this._previousAttributes,c=!1,d;for(d in a)f.isEqual(b[d],a[d])||(c=c||{},c[d]=a[d]);return c},previous:function(a){if(!a||!this._previousAttributes)return null;return this._previousAttributes[a]},previousAttributes:function(){return f.clone(this._previousAttributes)},_performValidation:function(a,b){var c=this.validate(a);if(c)return b.error?b.error(this,c,b):this.trigger("error",this,c,b),!1;return!0}});
e.Collection=function(a,b){b||(b={});if(b.comparator)this.comparator=b.comparator;f.bindAll(this,"_onModelEvent","_removeReference");this._reset();a&&this.reset(a,{silent:!0});this.initialize.apply(this,arguments)};f.extend(e.Collection.prototype,e.Events,{model:e.Model,initialize:function(){},toJSON:function(){return this.map(function(a){return a.toJSON()})},add:function(a,b){if(f.isArray(a))for(var c=0,d=a.length;c<d;c++)this._add(a[c],b);else this._add(a,b);return this},remove:function(a,b){if(f.isArray(a))for(var c=
0,d=a.length;c<d;c++)this._remove(a[c],b);else this._remove(a,b);return this},get:function(a){if(a==null)return null;return this._byId[a.id!=null?a.id:a]},getByCid:function(a){return a&&this._byCid[a.cid||a]},at:function(a){return this.models[a]},sort:function(a){a||(a={});if(!this.comparator)throw Error("Cannot sort a set without a comparator");this.models=this.sortBy(this.comparator);a.silent||this.trigger("reset",this,a);return this},pluck:function(a){return f.map(this.models,function(b){return b.get(a)})},
reset:function(a,b){a||(a=[]);b||(b={});this.each(this._removeReference);this._reset();this.add(a,{silent:!0});b.silent||this.trigger("reset",this,b);return this},fetch:function(a){a||(a={});var b=this,c=a.success;a.success=function(d,f,e){b[a.add?"add":"reset"](b.parse(d,e),a);c&&c(b,d)};a.error=i(a.error,b,a);return(this.sync||e.sync).call(this,"read",this,a)},create:function(a,b){var c=this;b||(b={});a=this._prepareModel(a,b);if(!a)return!1;var d=b.success;b.success=function(a,e,f){c.add(a,b);
d&&d(a,e,f)};a.save(null,b);return a},parse:function(a){return a},chain:function(){return f(this.models).chain()},_reset:function(){this.length=0;this.models=[];this._byId={};this._byCid={}},_prepareModel:function(a,b){if(a instanceof e.Model){if(!a.collection)a.collection=this}else{var c=a;a=new this.model(c,{collection:this});a.validate&&!a._performValidation(c,b)&&(a=!1)}return a},_add:function(a,b){b||(b={});a=this._prepareModel(a,b);if(!a)return!1;var c=this.getByCid(a);if(c)throw Error(["Can't add the same model to a set twice",
c.id]);this._byId[a.id]=a;this._byCid[a.cid]=a;this.models.splice(b.at!=null?b.at:this.comparator?this.sortedIndex(a,this.comparator):this.length,0,a);a.bind("all",this._onModelEvent);this.length++;b.silent||a.trigger("add",a,this,b);return a},_remove:function(a,b){b||(b={});a=this.getByCid(a)||this.get(a);if(!a)return null;delete this._byId[a.id];delete this._byCid[a.cid];this.models.splice(this.indexOf(a),1);this.length--;b.silent||a.trigger("remove",a,this,b);this._removeReference(a);return a},
_removeReference:function(a){this==a.collection&&delete a.collection;a.unbind("all",this._onModelEvent)},_onModelEvent:function(a,b,c,d){(a=="add"||a=="remove")&&c!=this||(a=="destroy"&&this._remove(b,d),b&&a==="change:"+b.idAttribute&&(delete this._byId[b.previous(b.idAttribute)],this._byId[b.id]=b),this.trigger.apply(this,arguments))}});f.each(["forEach","each","map","reduce","reduceRight","find","detect","filter","select","reject","every","all","some","any","include","contains","invoke","max",
"min","sortBy","sortedIndex","toArray","size","first","rest","last","without","indexOf","lastIndexOf","isEmpty","groupBy"],function(a){e.Collection.prototype[a]=function(){return f[a].apply(f,[this.models].concat(f.toArray(arguments)))}});e.Router=function(a){a||(a={});if(a.routes)this.routes=a.routes;this._bindRoutes();this.initialize.apply(this,arguments)};var q=/:([\w\d]+)/g,r=/\*([\w\d]+)/g,s=/[-[\]{}()+?.,\\^$|#\s]/g;f.extend(e.Router.prototype,e.Events,{initialize:function(){},route:function(a,
b,c){e.history||(e.history=new e.History);f.isRegExp(a)||(a=this._routeToRegExp(a));e.history.route(a,f.bind(function(d){d=this._extractParameters(a,d);c.apply(this,d);this.trigger.apply(this,["route:"+b].concat(d))},this))},navigate:function(a,b){e.history.navigate(a,b)},_bindRoutes:function(){if(this.routes){var a=[],b;for(b in this.routes)a.unshift([b,this.routes[b]]);b=0;for(var c=a.length;b<c;b++)this.route(a[b][0],a[b][1],this[a[b][1]])}},_routeToRegExp:function(a){a=a.replace(s,"\\$&").replace(q,
"([^/]*)").replace(r,"(.*?)");return RegExp("^"+a+"$")},_extractParameters:function(a,b){return a.exec(b).slice(1)}});e.History=function(){this.handlers=[];f.bindAll(this,"checkUrl")};var j=/^#*/,t=/msie [\w.]+/,m=!1;f.extend(e.History.prototype,{interval:50,getFragment:function(a,b){if(a==null)if(this._hasPushState||b){a=window.location.pathname;var c=window.location.search;c&&(a+=c);a.indexOf(this.options.root)==0&&(a=a.substr(this.options.root.length))}else a=window.location.hash;return decodeURIComponent(a.replace(j,
""))},start:function(a){if(m)throw Error("Backbone.history has already been started");this.options=f.extend({},{root:"/"},this.options,a);this._wantsPushState=!!this.options.pushState;this._hasPushState=!(!this.options.pushState||!window.history||!window.history.pushState);a=this.getFragment();var b=document.documentMode;if(b=t.exec(navigator.userAgent.toLowerCase())&&(!b||b<=7))this.iframe=g('<iframe src="javascript:0" tabindex="-1" />').hide().appendTo("body")[0].contentWindow,this.navigate(a);
this._hasPushState?g(window).bind("popstate",this.checkUrl):"onhashchange"in window&&!b?g(window).bind("hashchange",this.checkUrl):setInterval(this.checkUrl,this.interval);this.fragment=a;m=!0;a=window.location;b=a.pathname==this.options.root;if(this._wantsPushState&&!this._hasPushState&&!b)return this.fragment=this.getFragment(null,!0),window.location.replace(this.options.root+"#"+this.fragment),!0;else if(this._wantsPushState&&this._hasPushState&&b&&a.hash)this.fragment=a.hash.replace(j,""),window.history.replaceState({},
document.title,a.protocol+"//"+a.host+this.options.root+this.fragment);if(!this.options.silent)return this.loadUrl()},route:function(a,b){this.handlers.unshift({route:a,callback:b})},checkUrl:function(){var a=this.getFragment();a==this.fragment&&this.iframe&&(a=this.getFragment(this.iframe.location.hash));if(a==this.fragment||a==decodeURIComponent(this.fragment))return!1;this.iframe&&this.navigate(a);this.loadUrl()||this.loadUrl(window.location.hash)},loadUrl:function(a){var b=this.fragment=this.getFragment(a);
return f.any(this.handlers,function(a){if(a.route.test(b))return a.callback(b),!0})},navigate:function(a,b){var c=(a||"").replace(j,"");if(!(this.fragment==c||this.fragment==decodeURIComponent(c))){if(this._hasPushState){var d=window.location;c.indexOf(this.options.root)!=0&&(c=this.options.root+c);this.fragment=c;window.history.pushState({},document.title,d.protocol+"//"+d.host+c)}else if(window.location.hash=this.fragment=c,this.iframe&&c!=this.getFragment(this.iframe.location.hash))this.iframe.document.open().close(),
this.iframe.location.hash=c;b&&this.loadUrl(a)}}});e.View=function(a){this.cid=f.uniqueId("view");this._configure(a||{});this._ensureElement();this.delegateEvents();this.initialize.apply(this,arguments)};var u=/^(\S+)\s*(.*)$/,n=["model","collection","el","id","attributes","className","tagName"];f.extend(e.View.prototype,e.Events,{tagName:"div",$:function(a){return g(a,this.el)},initialize:function(){},render:function(){return this},remove:function(){g(this.el).remove();return this},make:function(a,
b,c){a=document.createElement(a);b&&g(a).attr(b);c&&g(a).html(c);return a},delegateEvents:function(a){if(a||(a=this.events))for(var b in f.isFunction(a)&&(a=a.call(this)),g(this.el).unbind(".delegateEvents"+this.cid),a){var c=this[a[b]];if(!c)throw Error('Event "'+a[b]+'" does not exist');var d=b.match(u),e=d[1];d=d[2];c=f.bind(c,this);e+=".delegateEvents"+this.cid;d===""?g(this.el).bind(e,c):g(this.el).delegate(d,e,c)}},_configure:function(a){this.options&&(a=f.extend({},this.options,a));for(var b=
0,c=n.length;b<c;b++){var d=n[b];a[d]&&(this[d]=a[d])}this.options=a},_ensureElement:function(){if(this.el){if(f.isString(this.el))this.el=g(this.el).get(0)}else{var a=this.attributes||{};if(this.id)a.id=this.id;if(this.className)a["class"]=this.className;this.el=this.make(this.tagName,a)}}});e.Model.extend=e.Collection.extend=e.Router.extend=e.View.extend=function(a,b){var c=v(this,a,b);c.extend=this.extend;return c};var w={create:"POST",update:"PUT","delete":"DELETE",read:"GET"};e.sync=function(a,
b,c){var d=w[a];c=f.extend({type:d,dataType:"json"},c);if(!c.url)c.url=k(b)||l();if(!c.data&&b&&(a=="create"||a=="update"))c.contentType="application/json",c.data=JSON.stringify(b.toJSON());if(e.emulateJSON)c.contentType="application/x-www-form-urlencoded",c.data=c.data?{model:c.data}:{};if(e.emulateHTTP&&(d==="PUT"||d==="DELETE")){if(e.emulateJSON)c.data._method=d;c.type="POST";c.beforeSend=function(a){a.setRequestHeader("X-HTTP-Method-Override",d)}}if(c.type!=="GET"&&!e.emulateJSON)c.processData=
!1;return g.ajax(c)};var o=function(){},v=function(a,b,c){var d;d=b&&b.hasOwnProperty("constructor")?b.constructor:function(){return a.apply(this,arguments)};f.extend(d,a);o.prototype=a.prototype;d.prototype=new o;b&&f.extend(d.prototype,b);c&&f.extend(d,c);d.prototype.constructor=d;d.__super__=a.prototype;return d},k=function(a){if(!a||!a.url)return null;return f.isFunction(a.url)?a.url():a.url},l=function(){throw Error('A "url" property or function must be specified');},i=function(a,b,c){return function(d){a?
a(b,d,c):b.trigger("error",b,d,c)}}}).call(this);
$.ajaxSettings.traditional = true;
$.ajaxSetup({ cache: false });

var lteIE7 = $.browser.msie && parseInt($.browser.version) <= 7;
var lteIE8 = $.browser.msie && parseInt($.browser.version) <= 8;

spike = {
    util: {},
    html: {},
    controller: {
        profiles: {}
    }
};

$(function() {

    var $html = $('html');
    var staticPathPrefix = $html.attr('data-context-path');
    var pathPrefix = $html.attr('data-lang-request-prefix');

    var lang = $html.attr('lang');
    if (lang !== 'de') {
        lang = 'en';
    }

    var datePattern = $html.attr('data-date-pattern');
    if (typeof datePattern === 'undefined') {
        datePattern = 'MMM dd, yyyy';
    }
    datePattern = datePattern.toLowerCase();

    spike.Application = {
        lang: lang,
        datePattern: datePattern,
        offlineMessage: $html.attr('data-offline-message'),
        heartbeatUrl: $html.attr('data-heartbeat'),

        path: function(path) {
            return pathPrefix + (path.charAt(0) === '/' ? '' : '/') + path;
        },

        staticPath: function(path) {
            return staticPathPrefix + (path.charAt(0) === '/' ? '' : '/') + path;
        }
    };

});
spike.util.Message = function($element, fadeout) {
    
    var that = this;
    var isOpen = false;
    fadeout = (typeof fadeout === 'undefined') ? true : fadeout;
    
    $element.css('top', -$element.height()).css('display', 'block'); 
    $element.find('.close').click(function() { that.close(); });
    
    this.isOpen = false;

    this.close = function() {
        if (isOpen) {
            isOpen = false;
            $element.find('p').html('');
            $element.animate({ top: -$element.height() }, 'slow');
        }
    };
    
    this.show = function(html) {
        if ($.trim(html) != '') {
            isOpen = true;
            $element.find('p').html(html);
            $element.animate({ top: '0' }, 'slow', function() {
                if (fadeout) {
                    window.setTimeout(function() { that.close(); }, 4000);
                }
            });
        }
    };
    
    this.init = function() {
        this.show($('p', $element).html());
    };
    
};

// generic confirm dialog
spike.util.JsConfirm = function($element, message) {
    
    this.message = function() {
        return (message || $element.attr('data-confirm-message'));
    }
    
    /** Initially, by default, a button having a 'data-confirm-message' attribute should be disabled.
      * This prevents clicking this button before this javascript has been executed (and the confirm
      * dialog was activated). */
    $element.removeAttr('disabled');
    
    this.show = function() {
        return confirm(this.message());
    };
    
};

$(function() {
    
    spike.util.Messenger = {

        message: new spike.util.Message($('#message')),
        error: new spike.util.Message($('#error')),
        announcement: new spike.util.Message($('#announcement'), false),
        staticError: new spike.util.Message($('#error'), false),

        init: function() {
            this.message.init();
            this.error.init();
            this.announcement.init();
            return this;
        }

    }.init();
    
    $('*[data-confirm-message]').livequery(function() {
        var $this = $(this);
        var jsConfirm = new spike.util.JsConfirm($this);
        $this.click(function() { return jsConfirm.show(); });
    });
    
});
spike.util.Heartbeat = function() {

    var errorCount = 0;
    var that = this;
    
    this.execute = function(timeout) {
        var timeout = timeout || 1000 * 60; // by default, call every minute
        window.setTimeout(function() {

            function showOfflineMessage() {
                spike.util.Messenger.staticError.show(spike.Application.offlineMessage);
            }

            $.ajax({
                url: spike.Application.heartbeatUrl,
                success: function(data) {
                    if ($.trim(data) == 'true') {
                        errorCount = 0;
                        that.execute();
                    } else {
                        showOfflineMessage();
                    }
                },
                error: function() {
                    if (errorCount++ < 3) {
                        // keep trying with a shorter timeout of 10 seconds
                        that.execute(1000 * 10);
                    } else {
                        showOfflineMessage();
                    }
                }
            });
        }, timeout);
    };
  
};

$(function () {
	
    if (typeof spike.Application.heartbeatUrl === 'string') {
        new spike.util.Heartbeat().execute();
    }

});
spike.util.HEX_DIGITS = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'];

spike.util.hex = function(x) {
    return isNaN(x) ? "00" : spike.util.HEX_DIGITS[(x - x % 16) / 16] + spike.util.HEX_DIGITS[x % 16];
};

//Function to convert hex format to a rgb color
spike.util.rgb2hex = function(rgba) {
    if (typeof rgba === 'undefined') {
        return;
    }
    if (rgba.charAt(0) == '#') {
        // this is already a hex color
        return rgba.substring(1);
    }
    if (rgba == 'white') {
        // special case for IE, which returns named colors
        // there is a blog about a general solution for this problem,
        // however, it uses MooTools and therefore needs some adjustments
        // http://www.backalleycoder.com/2010/10/05/converting-css-named-colors-to-rgb-and-hex/
        return 'ffffff';
    }

    var rgb = rgba.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
    if (rgb == null) {
        rgb = rgba.match(/^rgba\((\d+),\s*(\d+),\s*(\d+),\s*(\d+)\)$/);
    }
    if (rgb == null) {
        return "ffffff"; // default fallback
    }
    return spike.util.hex(rgb[1]) + spike.util.hex(rgb[2]) + spike.util.hex(rgb[3]);
};

spike.util.format = function(text, args) {
    if (text) {
        args = args || [];
        if (!(args instanceof Array)) {
            args = [args];
        }
        $.each(args, function(index, val) {
            text = text.replace('{' + index + '}', '' + val);
        });
        return text;
    }
};
spike.html.AjaxLoader = {
    
    init: function($loader) {
        var show = false;
        $loader.ajaxStart(function() {
            // show spinner only if the request takes more than 750ms
            show = true;
            window.setTimeout(function() {
                if (show) {
                    $loader.css('display', 'inline');
                }
            }, 750);
        }).ajaxStop(function() {
            show = false;
            window.setTimeout(function() {
                if (!show) {
                    $loader.css('display', 'none');
                }
            }, 500);
        });
    }
    
};


$(function() {
    
    spike.html.AjaxLoader.init($('#ajaxLoader'));
    
});spike.html.Tooltip = function($tooltipAware, settings) {

    this.settings = $.extend({}, spike.html.Tooltip.DEFAULT_SETTINGS, settings);
    if ((typeof this.settings.relative === 'undefined') && !$tooltipAware.attr('title')) {
        this.settings.relative = true;
    }
    this.$el = $tooltipAware;
    this.$el.tooltip(this.settings);
    
    return this;   
};

spike.html.Tooltip.DEFAULT_SETTINGS = {
    effect: 'slide',
    direction: 'top',
    position: 'top center',
    layout: '<div><em/></div>',
    delay: 300,
    onBeforeShow: function() {
        var $trigger = this.getTrigger(), $tip = this.getTip();
        var minWidth = $tip.width() + 20, width = $trigger.width() - 20;
        if (minWidth < width) {
            $tip.width(width);
            minWidth = width;
        }
        $('em', $tip).css('left', (minWidth / 2) + 'px');
    }
};

$(function () {

    $('.triggerTooltip').livequery(function() {
        new spike.html.Tooltip($(this));
    });

    $('.triggerDelayedTooltip').livequery(function() {
        new spike.html.Tooltip($(this), { predelay: 500 });
    });

});
spike.html.TextileTextarea = function($input, settings) {
    
    this.settings = settings || spike.html.TextileTextarea.DEFAULT_SETTINGS;
    this.settings.previewParserPath = this.settings.previewParserPath || spike.Application.path('/admin/textilePreview');
    
    $input.markItUp(this.settings);
    
};

spike.html.TextileTextarea.DEFAULT_SETTINGS = {
    nameSpace: 'textile',
    onShiftEnter: { keepDefault: false, replaceWith: '\n\n' },
    previewAutoRefresh: true,
    markupSet: [
        { name: 'Heading 1', key: '1', openWith: 'h1(!(([![Class]!]))!). ', placeHolder: 'Your header here...', className: 'h1' },
        { name: 'Heading 2', key: '2', openWith: 'h2(!(([![Class]!]))!). ', placeHolder: 'Your header here...', className: 'h2' },
        { name: 'Heading 3', key: '3', openWith: 'h3(!(([![Class]!]))!). ', placeHolder: 'Your header here...', className: 'h3' },
        { name: 'Heading 4', key: '4', openWith: 'h4(!(([![Class]!]))!). ', placeHolder: 'Your header here...', className: 'h4' },
        { name: 'Heading 5', key: '5', openWith: 'h5(!(([![Class]!]))!). ', placeHolder: 'Your header here...', className: 'h5' },
        { name: 'Heading 6', key: '6', openWith: 'h6(!(([![Class]!]))!). ', placeHolder: 'Your header here...', className: 'h6' },
        { name: 'Paragraph', key: 'P', openWith: 'p(!(([![Class]!]))!). ', className: 'paragraph' }, 
        { name: 'Bold', key: 'B', closeWith: '*', openWith: '*', className: 'bold' }, 
        { name: 'Italic', key: 'I', closeWith: '_', openWith: '_', className: 'italic' }, 
        { name: 'Stroke through', key: 'S', closeWith: '-', openWith: '-', className: 'stroke' }, 
        { name: 'Bulleted list', openWith: '(!(* |!|*)!)', className: 'list-bullet' }, 
        { name: 'Numeric list', openWith: '(!(# |!|#)!)', className: 'list-numeric' }, 
        { name: 'Picture', replaceWith: '![![Source:!:http://]!]([![Alternative text]!])!', className: 'picture' }, 
        { name: 'Link', openWith: '"', closeWith: '([![Title]!])":[![Link:!:http://]!]', placeHolder: 'Your text to link here...', className: 'textile-link' },
        { name: 'Quotes', openWith: 'bq(!(([![Class]!]))!). ', className: 'quotes' }, 
        { name: 'Code', openWith: '@', closeWith: '@', className: 'code' },
        { name: 'Preview', call: 'preview', className: 'preview' }
    ]
};

$(function() {
    
    $('textarea.textile').each(function() {
        new spike.html.TextileTextarea($(this));
    });
    
});$.tools.dateinput.localize('de', {
   months:        'Januar,Februar,März,April,Mai,Juni,Juli,August,September,Oktober,November,Dezember',
   shortMonths:   'Jan,Feb,Mär,Apr,Mai,Jun,Jul,Aug,Sep,Okt,Nov,Dez',
   days:          'Sonntag,Montag,Dienstag,Mittwoch,Donnerstag,Freitag,Samstag',
   shortDays:     'So,Mo,Di,Mi,Do,Fr,Sa'
});

spike.html.Date = function($input, settings) {

    this.settings = settings || {
        format: spike.Application.datePattern,
        lang: spike.Application.lang,
        trigger: false,
        firstDay: 1
    };
    
    return $input.dateinput(this.settings);
    
};

$(function() {
    
    $('input.date').each(function() {
        new spike.html.Date($(this));
    });
    
});
$.tools.validator.fn('input[min-length][max-length]', function($input, value) {
    var min = $input.attr('min-length'), max = $input.attr('max-length');
    var length = value.length;
    return length >= min && length <= max ? true : [min, max];
});

spike.html.Input = function(input) {
    
    if (typeof input !== 'undefined') {
        input.api = this;
    }
    
    var $input = $(input);
    var defaultValue = $input.attr('data-value') || '';
    
    this.hasDefault = defaultValue !== '';
    
    function refreshValue() {
        if ($input.val() === '') {
            $input.addClass('default');
            $input.val(defaultValue);
        }
        return $input;
    }
    
    if (this.hasDefault) {
        refreshValue().focus(function() {
            if ($input.hasClass('default')) {
                $input.removeClass('default').val('');
            }
        }).blur(function() {
            refreshValue();
        });
    }
    // Tooltip support
    $input.filter('[title]').not(':submit').each(function() { new spike.html.Tooltip($(this)); });

    this.submitVal = function() {
        var value = $input.val();
        return value === defaultValue ? '' : value;
    };
    
    this.onsubmit = function() {
        if (this.hasDefault) {
            $input.val(this.submitVal());
        }
    };
    
};

spike.html.Inputs = function(scope) {
    return $('input, textarea, select', scope);
};

$(function() {
    
    spike.html.Inputs().not(':checkbox').livequery(function() {
        new spike.html.Input(this);
    });
    
});
spike.html.Checkbox = function(input) {
    spike.html.Input(input);
    
    var $checkbox = $(input);
    
    if ($checkbox.hasClass('enable-rel')) {
        var $rel = $($checkbox.attr('rel'));
        if ($checkbox.attr('checked')) {
            $rel.removeAttr('disabled');
        }
        $checkbox.change(function () {
            if ($checkbox.attr('checked')) {
                $rel.removeAttr('disabled');
            } else {
                $rel.attr('disabled', 'disabled');
            }
        });
    }
    
};
spike.html.Checkbox.prototype = new spike.html.Input;

spike.html.Checkboxes = function(scope) {
    return $(':checkbox', scope);
};

$(function() {
    
    spike.html.Checkboxes().livequery(function() {
        new spike.html.Checkbox(this);
    });
    
});spike.html.Form = function(form) {
    
    this.submitted = false;
    form.api = this;

    var that = this;
    var $form = $(form);
    var isGet = $(form).attr('method') === 'get';
    this.$action = $(':submit.action', $form);
    
    // prevent form double submits
    $form.submit(function() {
        if (!isGet) {
            if (that.submitted) {
                return false;
            } else {
                that.submitted = true;
                spike.html.Inputs(form).livequery(function() {
                    if (this.api) { // TODO check why api may not be present
                        this.api.onsubmit();
                    }
                });
            }
        }
    });
    spike.html.Inputs(form).keypress(function(event) {
        if (event.keyCode != 13 && that.$action.attr('disabled')) {
            that.$action.removeAttr('disabled').addClass('enabled');
        }
    });
    
    this.reset = function() {
        that.submitted = false;
    };
    
    // TODO: da gibt es doch was von jQuery... (forms..)
    this.buildParams = function(data) {
        data = data || {};
        spike.html.Inputs(form).not(':checkbox[checked!=checked], :radio[checked!=checked], [type=file]').filter('*[name]').each(function() {
            var name = this.name;
            var value = typeof this.api === 'undefined' ? $(this).val() : this.api.submitVal();
            var values = data[name];
            if ($.type(values) === 'undefined') {
                data[this.name] = value;
            } else if ($.type(values) === 'array') {
                values.push(value);
            } else {
                data[this.name] = [values, value];
            }
        });
        return data;
    }
    
};

$(function() {
    
    $('form').each(function() {
        new spike.html.Form(this);
    });
    
});
spike.html.ImageHolder = function($component, settings) {
    
    this.settings = $.extend({}, settings || spike.html.ImageHolder.DEFAULT_SETTINGS);
    this.settings.noImageUrl = spike.Application.staticPath(this.settings.noImageUrl || '/images-proxy/no-image');

    this.noImageSrc = $component.attr('data-src-no-image');
    this.noImageSrc = this.noImageSrc.replace('{width}', $component.width() || this.settings.width);
    this.noImageSrc = this.noImageSrc.replace('{height}', $component.height() || this.settings.height);
    this.noImageSrc = this.noImageSrc.replace('{background-color}', spike.util.rgb2hex($component.css('background-color') || this.settings.backgroundColor));
    this.noImageSrc = this.noImageSrc.replace('{color}', spike.util.rgb2hex($component.css('color' || this.settings.color)));
    $component.attr('data-src-no-image', this.noImageSrc);
    
    var that = this;
    
    function createImage() {
        var src = $component.attr('data-src');
        if (src.indexOf(that.settings.noImageUrl) == 0) {
            src = that.noImageSrc;
            $component.addClass('dummy');
        }
        return $('<img/>').attr('src', src);
    }
    
    var $img = createImage().load(function() {
        $component.removeClass('loading');
        $this = $(this);
        $this.fadeIn('slow', function() {
            $this.attr('alt', $component.attr('data-alt'));
        });
        if ($this.filter(':visible').length === 1) {
            var diffWidth = $component.width() - $this.width();
            var diffHeight = $component.height() - $this.height();
            $component.animate({ width: '-=' + diffWidth, height: '-=' + diffHeight }, 'slow');
        }
    });
    $img.hide();
    $component.append($img);
    
};

spike.html.ImageHolder.DEFAULT_SETTINGS = {
    width: 200,
    height: 150,
    backgroundColor: '#e6e6e6',
    color: '#fff'
};



$(function() {
    
    $('.imageHolder.loading').livequery(function() {
        new spike.html.ImageHolder($(this));
    });
    
});
spike.html.Tabs = function($component, settings) {
    
    this.settings = settings || spike.html.Tabs.DEFAULT_SETTINGS;
    
    $('> ul, > ol', $component).tabs($component.attr('rel') + ' > *', this.settings);
    
};

spike.html.Tabs.DEFAULT_SETTINGS = {
    history: true
};


$(function() {

    $('.tabs[rel]').each(function() {
        new spike.html.Tabs($(this));
    });

});
spike.html.Toggler = function($trigger) {
    
    var rel = $trigger.attr('rel');
    
    $(rel).slideToggle(400, function() {
        $trigger.toggleClass('open');
        var $this = $(this);
        $this.trigger('toggled', [$trigger.hasClass('open')]);
    });
    
}


$(function() {
    
    $('.toggle[rel]').click(function() {
        new spike.html.Toggler($(this));
    });

});spike.html.Slider = function($component, settings) {
    
    this.settings = $.extend({}, settings || spike.html.Slider.DEFAULT_SETTINGS);
    this.settings.disabled = $component.hasClass('readOnly') || this.settings.disabled;
    this.settings.min = $component.attr('data-min') || this.settings.min;
    this.settings.max = $component.attr('data-max') || this.settings.max;
    this.settings.step = $component.attr('data-step') || this.settings.step;
    this.settings.value = $component.attr('data-value');
    
    this.$el = $component;
    this.$el.slider(this.settings);
    
    this.val = function(val) {
        return val ? this.$el.slider('value', val) : this.$el.slider('value');
    };
    
    return this;
};

spike.html.Slider.DEFAULT_SETTINGS = {
    disabled: false,
    range: 'min',
    min: 0,
    max: 100,
    step: 1
};
spike.html.LocaleSwitcher = function($trigger) {

    $('.tooltip a', $trigger.parent()).click(function() {
        $(this).closest('form').submit();
        return false;
    });

    var settings = {
        direction: 'bottom',
        position: 'bottom center',
        offset: [10, 20],
        events: { def: 'click, blur', tooltip: 'mouseenter' },
        onShow: function() {
            var api = this;
            $('*').bind('hideLocaleSwitcher', function() {
                if (api.isShown()) {
                    api.hide();
                }
            });
        },
        onHide: function() {
            $('*').unbind('hideLocaleSwitcher');
        }
    };
    new spike.html.Tooltip($trigger, settings);
    $('*').click(function() {
        $(this).trigger('hideLocaleSwitcher');
    });

};

$(function() {
    $('#localeSwitcher > a:first-child').each(function() {
        new spike.html.LocaleSwitcher($(this));
    })
});
spike.html.Tags = function($component, settings) {
    
    this.settings = $.extend({}, settings || spike.html.Tags.DEFAULT_SETTINGS);
    
    if (!this.settings.tagSource && $component.attr('data-autocomplete')) {
        this.settings.tagSource = $component.attr('data-autocomplete');
    }
    
    return $component.tagit(this.settings);
    
};

spike.html.Tags.DEFAULT_SETTINGS = {
    caseSensitive: false,
    singleFieldDelimiter: ' '
};


$(function() {

    $('.tags').each(function() {
        new spike.html.Tags($(this));
    });

});spike.controller.profiles.ProfileController = Backbone.View.extend({
    
    initialize: function() {
        this.optimizationHelper = new spike.html.Tooltip(this.$('a.help'));
        this.optimizationSlider = new spike.html.Slider(this.$('.slider'));
    },
    
    render: function() {
        var optimizationIndex = this.$('[data-index]').attr('data-index');
        this.renderOptimizationIndex(optimizationIndex);
    },
    
    renderOptimizationIndex: function(index) {
        var $help = this.optimizationHelper.$el;
        $help.text(spike.util.format($help.text(), index));
        $help.css('visibility', 'visible');
        
        this.optimizationSlider.val(index);
    }
     
});


$(function() {
    $('.profile').each(function() {
        new spike.controller.profiles.ProfileController({ el: this }).render();
    });
    
    //TODO: better integration
    $('.public.profile .share-profile').each(function() {
        var $this = $(this);
        var help = $(this).attr('data-help');
        var settingsText = $(this).attr('data-settings-text');
        var helpFacebook = $(this).attr('data-help-facebook');
        var helpGoogleplus = $(this).attr('data-help-googleplus');
        var helpTwitter = $(this).attr('data-help-twitter');
        $this.socialSharePrivacy({
            css_path: '',
            txt_help: help,
            settings_perma: settingsText,
            services: {
                twitter: {
                    dummy_img: spike.Application.staticPath('/static/images/dummy_twitter.png'),
                    txt_info: helpTwitter
                },
                gplus: {
                    dummy_img: spike.Application.staticPath('/static/images/dummy_gplus.png'),
                    txt_info: helpGoogleplus
                },
                facebook: {
                    dummy_img: spike.Application.lang === 'en' ? spike.Application.staticPath('/static/images/dummy_facebook_en.png') : spike.Application.staticPath('/static/images/dummy_facebook.png'),
                    language: spike.Application.lang === 'en' ? 'en_US' : 'de_DE',
                    txt_info: helpFacebook
                }
            }
        });
    });
       
});spike.controller.profiles.ProfilesController = Backbone.View.extend({
    
    initialize: function() {
        this.$form = this.$('form.search');
        this.$query = this.$('input[name=query]', this.$form);
        this.$findButton = this.$('.find', this.$form);
        this.$createButton = this.$('.create', this.$form);
        this.$info = this.$('.info', this.$form);
    },
    
    events: {
        'click form .create': 'create',
        'keydown form input[name=query]': 'showFindButton'
    },
    
    create: function() {
        this.$createButton.attr('href', this.$createButton.attr('href') + this.$query.val());
    },
    
    showFindButton: function() {
        var that = this;
        this.$createButton.fadeOut('fast', function() {
            that.$findButton.fadeIn('fast');
        });
        this.$info.slideUp();
    }
     
});

// TODO: #content selector weg und mit #profile .profiles zusammenlegen
$(function() {
    $('#content.profiles').each(function() {
        new spike.controller.profiles.ProfilesController({ el: this }).render();
    });
});$(function() {

    $.tools.tabs.addEffect('crmData', function(tabIndex) {
        loadTab(this, tabIndex, 0);
    });

    function loadTab(api, tabIndex, page) {
        var $tab = api.getTabs().eq(tabIndex);
        var $pane = api.getPanes().eq(0);
        var $loader = $('<div class="load" />');
        $loader.height($pane.height());
        $pane.parent().append($loader);

        var url = $tab.attr('data-url');
        var query = $tab.closest('.admin').find('#search > input')[0].api.submitVal() || '';

        $.get(url, { page: page, query: query }, function(newPane) {
            $loader.remove();
            $pane.html(newPane);
        });
    }

    $('.admin').each(function() {

        var $admin = $(this);
        var $tabs = $('#tabs > ul', $admin);

        $tabs.tabs('.admin #panes > *', { effect: 'crmData', history: true });
        var api = $tabs.data('tabs');

        function load(tabIndex, page) {
            loadTab(api, tabIndex, page);
        }

        $('.pagination', $admin).livequery(function() {
            var scope = this;
            $('a', $tabs).each(function(index, value) {
                var href = $(value).attr('href');
                $('a.page[href|=' + href +  ']', scope).history(function(event, hash) {
                    load(index, hash.substring(href.length + 1));
                });
            });
        });
        
        $('#search > input', $admin).keypress(function(event) {
            if (event.keyCode === 13) {
                load(api.getIndex(), 0);
                return false;
            }
        });
        
        $('#keywordForm .weight', $admin).each(function() {
            var $weight = $(this);
            var $hidden = $(':hidden', $weight);
            $('.slider', $weight).slider({
                range: 'min',
                min: 0,
                max: 1,
                step: 0.02,
                value: $hidden.val(),
                change: function (event, ui) {
                    var weight = ui.value;
                    $hidden.val(weight);
                }
            });
        });
        
        $('table.readonly .slider', $admin).each(function() {
            var $slider = $(this);
            $slider.slider({
                disabled: true,
                range: 'min',
                min: 0,
                max: 1,
                step: 0.02,
                value: $slider.attr('data-weight')
            });
        });

    });

});
var Terms = {};

Terms.initTerms = function(scope, updateCallback) {

    $('.terms', scope).each(function() {
        
        var terms = $(this);
        
        function updateTerm(ready, $term) {
            if (ready) {
                var $tagsUI = $('.keyword > ul:first-child', $term);
                var $input = $('.tagit-new input', $tagsUI);
                var tags = $('input[type=hidden]', $tagsUI);
                var $terms = $('.keyword > :hidden[name=terms]', $term);
                if (tags.length >= 3) {
                    $tagsUI.addClass('disabled');
                    $input.attr('disabled', 'disabled');
                } else {
                    $tagsUI.removeClass('disabled');
                    $input.removeAttr('disabled');
                    $input.focus();
                }
                if (tags.length === 0) {
                    $terms.val('');
                } else {
                    var $mustHaveInput = $('.mustHave.input', $term);
                    var $mustHaveHint = $('.mustHave.hint', $term);
                    var $mustHaveChecked = $(':checked', $mustHaveInput);
                    if (tags.length > 1) {
                        $mustHaveChecked.click();
                        $mustHaveInput.hide();
                        $mustHaveHint.show();
                    } else {    
                        $mustHaveHint.hide();
                        $mustHaveInput.show();
                    }
                    var tagAsString = ''
                    var weight = $('.weight > .slider', $term).attr('data-weight');
                    var mustHaveMarker = $mustHaveChecked.length == 1 ? '!' : '';
                    $.each(tags, function(index, tag) {
                        var value = $(tag).val();
                        if (value.indexOf(' ') > 0) {
                            tagAsString += '"' + value + '"';
                        } else {
                            tagAsString += value;
                        }
                        tagAsString += ' ';
                    });
                    $terms.val($.trim(tagAsString) + '=' + weight + mustHaveMarker);
                }
                Profile.enableSaveButton();
                updateCallback();
            }
        }

        function addTerm() {
            var $newTerm = $('.term.template', terms).eq(0).clone();
            $newTerm.removeClass('template');
            $('.term:last', terms).after($newTerm);
            $newTerm.show();
            $(':hidden[name=!terms]', $newTerm).attr('name', 'terms');
        }
        
        $('.addTerm', terms).click(function() {
            addTerm();
            var maxTerms = $(this).attr('data-max-terms');
            if (maxTerms) {
                if ($('.term', terms).length > maxTerms) {
                    $(this).hide();
                }
            }
            return false;
        });

        // add automatically keywords for new profiles
        var termCount = $('.term', terms).length - 1;
        var initialTermCount = 3 - termCount;
        for (var i = 0; i < initialTermCount; i++) {
            addTerm();
        }

        $('.term:not(.template)', terms).livequery(function() {
            var term = $(this);
            $('.mustHave :checkbox', term).change(function() {
                updateTerm(true, term);
            });
            $('a.delete', term).click(function() {
                $(term).remove();
                $('.addTerm', terms).show();
                Profile.enableSaveButton();
                updateCallback();
                return false;
            });
            $('.keyword', term).each(function() {
                var $tags = $('> ul:first-child', this);
                var $terms = $('> :hidden[name=terms]', this);
                var ready = false;
                ready = new spike.html.Tags($tags, {
                    caseSensitive: false,
                    singleFieldDelimiter: ' ',
                    onTagAdded: function(event, tag) {
                        updateTerm(ready, term);
                    },
                    onTagRemoved: function(event, tag) {
                        updateTerm(ready, term);
                    },
                    onTagClicked: function(event, tag) {
                        var $that = $(this);
                        var clickHandler = this.clickHandler;
                        
                        $that.unbind('click', clickHandler);
                        var $a = $('a.tagit-label', tag);
                        $a.hide();
                        $input = $('<input />').addClass('tagit-update').val($a.text()).insertAfter($a);
                        $input.focus();
                        
                        function updateKeyword() {
                            $a.text($input.val());
                            $(':hidden', tag).val($input.val());
                            $input.remove();
                            $a.show();
                            updateTerm(ready, term);
                            $that.bind('click', clickHandler);
                        }
                        
                        $input.blur(function() {
                            updateKeyword();
                        }).keydown(function(keyDownEvent) {
                            if (keyDownEvent.which == $.ui.keyCode.ENTER) {
                                updateKeyword();
                            }
                        });
                    }
                });
                if ($tags.hasClass('disabled')) {
                    $('.tagit-new input', $tags).attr('disabled', 'disabled');
                }
            });
            $('.weight > .slider', term).each(function() {
                var $slider = $(this);
                $slider.slider({
                    range: 'min',
                    min: 1,
                    max: 3,
                    step: 0.05,
                    value: $slider.attr('data-weight'),
                    change: function (event, ui) {
                        $slider.attr('data-weight', ui.value);
                        $('.keyword .tagit-new input, .keyword input.tagit-update', term).blur();
                        updateTerm(true, term);
                    }
                });
            });
        });
        
    });
};
var Profile = {};

Profile.enableSaveButton = function() {
    $('#content.profile .update').each(function() {
        $(this).removeAttr('disabled');
    });
};

Profile.displayDocumentsSaveHint = function() {
    $('#content.profile .documents .saveHint').slideDown();
    Profile.enableSaveButton();
};

Profile.changesObserver = function() {
    $('#content.profile form#edit').each(function() {

        var $editScope = $(this);

        function activateFileInput($input) {
            $input.attr('name', $input.attr('data-name'));
            // lokkhunter specific code for adjusting the filename input field
            var $sibling = $input.parent().children('input[data-name="GIVEN_FILENAME__' + $input.attr('name') + '"]');
            $sibling.attr('name', $sibling.attr('data-name'));
        }

        $('input:not(:file):not(.tagit input):not(.mustHave :checkbox), textarea, select', $editScope).livequery(function() {
            $(this).change(function() {
                Profile.reloadTab();
                Profile.enableSaveButton();
            });
            $(this).keyup(function() {
                Profile.enableSaveButton();
            });
        });
        $('input:file', $editScope).live('change', function() {
            activateFileInput($(this));
            Profile.displayDocumentsSaveHint();
        });
        $('#image a.delete', $editScope).click(function() {
            $(this).hide();
            var $imgHolder = $('div[data-src-no-image]', $editScope);
            var $img = $('> img', $imgHolder);
            $img.attr('src', $imgHolder.attr('data-src-no-image'));
            $imgHolder.addClass('dummy');
            activateFileInput($('input:file', $editScope));
            Profile.displayDocumentsSaveHint();
            Profile.reloadTab();
            return false;
        });
        $('#attachments a.delete', $editScope).live('click', function() {
            $(this).closest('li').hide().find('input').val('false');
            Profile.displayDocumentsSaveHint();
            return false;
        });
        $('#documents a.addAttachment', $editScope).live('click', function() {
            var $inputs = $('#attachments span.new-attachment', $editScope);
            var $input = $inputs.eq(0);
            var $clone = $input.clone().removeAttr('id');
            $inputs.last().after($clone.show());
            // hide add link if max attachment size has been reached
            var $list = $('#attachments ol', $editScope);
            var attachmentSize = parseInt($list.attr('data-current-attachments')) + 1;
            $list.attr('data-current-attachments', attachmentSize);
            if (attachmentSize >= parseInt($(this).attr('data-max-attachments'))) {
                $(this).hide();
            }
            return false;
        });
    });
};

Profile.bookmarker = function() {
    $('.bookmarkToggle').livequery(function() {
        var $trigger = $(this);
        $trigger.click(function(ev) {
            ev.preventDefault();
            if (!$trigger.hasClass('premium-tooltip-trigger')) {
                $trigger.addClass('spinner');
                $.post($trigger.attr('data-action'), {
                    method: $trigger.hasClass('active') ? 'removeBookmarkedProfile' : 'addBookmarkedProfile',
                    '.bookmarkedProfile': $trigger.attr('data-against-profile'),
                    '-return': '#profile.getBookmarkedProfiles().size()'
                }, function(data) {
                    $trigger.removeClass('spinner');
                    var $toToggle = $trigger.closest('li').find('.bookmarkToggle');
                    $toToggle.toggleClass('active justclicked');
                    $toToggle.one('mouseleave', function() {
                        $(this).removeClass('justclicked');
                    });
                    toggleTextAndTitle($toToggle);
                    $('a[href=#bookmarks] > .count').text(data);

                    if ($trigger.hasClass('icon')) {
                        var text = $trigger.data(
                                $trigger.hasClass('active') ? 'i18n-addFeedback' : 'i18n-removeFeedback');
                        Profile.giveFeedback($trigger, text);
                    }
                });
            }
        });
        function toggleTextAndTitle($toToggle) {
            var title = $trigger.attr(
                    $trigger.hasClass('active') ? 'data-i18n-removeBookmark' : 'data-i18n-addBookmark');
            $toToggle.attr('title', title);
            $toToggle.children('span').text(title);
        }

        toggleTextAndTitle($trigger);
    });
};

Profile.giveFeedback = function($element, message) {
    var $span = $('<span class="feedback" />');
    $span.text(message);
    $element.after($span);
    $span.fadeIn('fast');
    window.setTimeout(function() {
        $span.fadeOut('slow', function() {
            $span.remove();
        });
    }, 2500);
};

Profile.removeBookmark = function() {
    var tipSelector = '#bookmarkRemoveTooltip';
    $('.bookmark-remove').livequery(function() {
        var $trigger = $(this);
        $trigger.click(
                function(ev) {
                    ev.preventDefault();
                }).tooltip({
                               tip: tipSelector,
                               onShow: function() {
                                   $(tipSelector).data('trigger', $trigger);
                               },
                               events: {
                                   def: 'mousedown, mouseleave',
                                   tooltip: 'mouseenter, mouseleave'
                               },
                               delay: 6000,
                               effect: 'fade',
                               position: 'top center'
                           });
    });
    function hideTooltip() {
        $(tipSelector).data('trigger').data('tooltip').hide();
    }

    $(tipSelector + ' .bookmark-cancel-action').live('click', function(ev) {
        hideTooltip();
    });
    $(tipSelector + ' .bookmark-remove-action').live('click', function(ev) {
        var $trigger = $(tipSelector).data('trigger');
        $.post($trigger.attr('data-action'),
        {
            method: 'removeBookmarkedProfile',
            '.bookmarkedProfile': $trigger.attr('data-against-profile'),
            '-return': '#profile.getBookmarkedProfiles().size()'
        },
                function(data) {
                    hideTooltip();
                    $('a[href=#bookmarks] > .count').text(data);
                    $trigger.closest('li').hide('slow', function() {
                        $(this).remove();
                    });
                }
                );
    });
};

Profile.editToggle = function() {
    
    $('#content.profile .editToggle a').click(function(event) {
        event.preventDefault();
        Profile.toggleEditPanel($(this));
    });

    $('#openLocationToggle').live('click', function() {
        Profile.openEditPanel();
        $('#content.profile #location').click();
        return false;
    });
    
    $('a[href=#editToggle]').live('click', function() {
        Profile.openEditPanel();
    });

};

Profile.toggleEditPanel = function($toggle, callback) {
    
    function doCallback() {
        if (typeof callback === 'function') {
            callback();
        }
    }
    
    if ($toggle.length === 0) {
        doCallback();
    } else {
        $('#profileEditPanel').slideToggle(400, function() {
            $toggle.toggleClass('open');
            $('#content.profile .miniTabs').animate({ opacity: 'toggle' }, 'slow');
            doCallback();
        });
    }
};

Profile.openEditPanel = function(callback) {
    Profile.toggleEditPanel($('#content.profile .editToggle a').not('.open'), callback);
};

Profile.closeEditPanel = function(callback) {
    Profile.toggleEditPanel($('#content.profile .editToggle a.open'), callback);
};

Profile.initTerms = function() {
    Terms.initTerms($('#content.profile'), Profile.reloadTab);
};

Profile.initFilters = function() {
    $('.filters .filter').each(function() {

        var filter = this;
        var slider = $('.slider', filter);
        var input = $('input:checkbox', filter);
        var label = $('span[data-label]', filter);
        var labelValue = label.attr('data-label');

        function createSlider() {

            function initLabel(value) {
                $(label).html(labelValue.replace('{0}', value));
            }

            var min = parseInt($(slider).attr('data-min'));
            var max = parseInt($(slider).attr('data-max'));
            var step = parseInt($(slider).attr('data-step'));
            var value = parseInt($(input).val());

            initLabel(value);

            $(slider).slider({ range: 'min', min: min, max: max, step: step, value: value,
                change: function (event, ui) {
                    Profile.reloadTab();
                },
                slide: function(event, ui) {
                    input.val(ui.value);
                    initLabel(ui.value);
                }
            });
        }

        function toggleSlider() {
            if ($('input:checked', filter).length === 0) {
                slider.slider("option", "disabled", true);
                label.addClass('disabled')
            } else {
                slider.slider("option", "disabled", false);
                label.removeClass('disabled')
            }
        }

        createSlider();
        toggleSlider();

        input.get(0).toggleSlider = toggleSlider;

        input.click(function() {
            toggleSlider();
            Profile.reloadTab();
        });

    });
};

Profile.initSave = function() {
    
    $('#content.profile').each(function() {
        var $profile = $(this);
        var $form = $('form#edit', $profile);
        var $method = $('#formControls > [name=method]', $form);
        var $activeFrom = $('#formControls > [name=activeFrom]', $form);
        var $activeTo = $('#formControls > [name=activeTo]', $form);
        var $publicVisible = $('#formControls > [name=publicVisible]', $form);
        
        function validate() {

            function validate($input, validator) {
                
                function defaultValidator($input) {
                    return $.trim($input[0].api.submitVal()) != ''
                }
                
                if (typeof validator === 'undefined') {
                    validator = defaultValidator;
                }
                var $error = $input.parent().find('p.error');
                var valid = true;
                if (!validator($input)) {
                    $error.show();
                    $input.closest('fieldset').find('.toggle').not('.open').trigger('click');
                    $message.append('<li><a href="#' + $input.attr('id') + '">' + $error.text() + '</a></li>');
                    valid = false;
                } else {
                    $error.hide();
                }
                return valid;
            }

            spike.util.Messenger.staticError.close();
            var $message = $('<ol />');
            var valid = true;
            
            $form.each(function() {
                valid = validate($('#title', this));
                valid = validate($('.terms', this), function($termsDiv) {
                    var $terms = $termsDiv.find('input[name=terms]');
                    var valid = $terms.length != 0;
                    if (valid) {
                        // at least one keyword should be present
                        var count = 0;
                        $terms.each(function() {
                            if ($(this).val().length > 0) {
                                count++;
                            }
                        });
                        valid = count > 1;
                    }
                    return valid;
                }) && valid;
                valid = validate($('#description', this), function($textArea) {
                    return $textArea.val().length > 100;
                }) && valid; 
            });
            
            if (!valid) {
                spike.util.Messenger.staticError.show($message);
                Profile.openEditPanel();
            }
            return valid;
        }
        
        $('.saveAsDraft', $profile).click(function() {
            $method.val('saveAsDraft');
            $form.submit();
        });
        
        $('.saveAsPublished, .updateDraftAsPublished', $profile).click(function(event) {
            if (!validate()) {
                event.preventDefault();
            }
        });
        
        $('.update.draft', $profile).click(function(event) {
            $method.val('update');
            $form.submit();
        });
        
        $('.update.final', $profile).click(function(event) {
            if (validate()) {
                $method.val('updateFinal');
                $form.submit();
            }
        });
        
        $('.updateAsDraft', $profile).click(function(event) {
            $method.val('updateAsDraft');
            $form.submit();
        });
        
        $('#overlay.profile').each(function() {
            var $overlay = $(this);
            $('button', $overlay).click(function() {
                $method.val($(this).attr('class'));
                $activeFrom.val($('.from input', $overlay).val());
                $activeTo.val($('.to input', $overlay).val());
                $publicVisible.val($('.public input:checkbox:checked', $overlay).length > 0 ? 'true' : 'false');
                $form.submit();
            });
        });
        
    });

};

Profile.getParameters = function() {
    var data = $('#content.profile #profileEditPanel form#edit')[0].api.buildParams();
    $.extend(data, {
        'active': false //find matches for possibly invalid profiles
    });
    return data;
};

Profile.loadTab = function(tabApi, tabIndex, page) {

    var filters = $('#content.profile .filters');
    var currentIndex = tabApi.getIndex();
    var pane = tabApi.getPanes().eq(0);

    var maxResults = 20;

    function loadMatches(pane, complementary, callback) {

        function updateTotalCounts() {
            var ul = $('ul.list', pane);
            $('a[href=#matches] > .count, li.matches > .count').text($(ul).attr('data-matches-count'));
            $('a[href=#relatives] > .count, li.relatives > .count').text($(ul).attr('data-relatives-count'));
        }

        function getFilters() {
            var filters = [];
            $('.filters input:checked').each(function() {
                filters.push(this.name + ':' + $(this).val());
            });
            return filters;
        }

        var data = Profile.getParameters();
        $.extend(data, {
            'method': 'findMatchesModel',
            '.complementary': complementary,
            '.firstResult': page * maxResults,
            '.maxResults': maxResults,
            '.filters': getFilters(),
            'page': page
        });

        $(pane).load($(pane).attr('data-matches-url'), data, function() {
            updateTotalCounts();
            Profile.updateCompletionBars();
            callback();
        });

    }

    function showFilters() {
        if (currentIndex == 2) {
            $(filters).slideToggle(300);
        }
    }

    if (tabIndex == 0) {
        loadMatches(pane, true, function() {
            $('span[data-matches]', filters).each(function() {
                $(this).html($(this).attr('data-matches'));
            });
            showFilters();
        });
    } else if (tabIndex == 1) {
        loadMatches(pane, false, function() {
            $('span[data-relatives]', filters).each(function() {
                $(this).html($(this).attr('data-relatives'));
            });
            showFilters();
        });
    } else if (tabIndex == 2) {
        pane.load($(pane).attr('data-bookmarks-url'), function() {
            $(filters).slideToggle(300);
        });
    }

};

Profile.loadPage = function(page, tabIndex) {
    var tabsApi = $('#content.profile #tabs > ul').data('tabs');
    if (!tabIndex) {
        tabIndex = tabsApi.getIndex();
    }
    Profile.loadTab(tabsApi, tabIndex, page);
};

Profile.reloadTab = function() {
    Profile.loadPage(0);
};

Profile.initTabs = function() {
    var $tabArea = $('#content.profile #tabs > ul');
    $tabArea.tabs('#tabPanes > *', { effect: 'profileMatches', history: true });
    var firstHash = $tabArea.find('a').eq(0).attr('href');
    if (location.hash === '' && firstHash) {
        location.hash = firstHash;
        $.tools.history.conf = { hash: firstHash };
    }
};

Profile.initHistoryPlugin = function() {
    $('#content.profile .pagination').livequery(function() {
        $('a.page[href|=#matches]', this).history(function(event, hash) {
            Profile.loadPage(hash.substring(9), 0);
        });
        $('a.page[href|=#relatives]', this).history(function(event, hash) {
            Profile.loadPage(hash.substring(11), 1);
        });
    });
};

Profile.showMatchingDetails = function() {
    $('#content.profile .showMatchingDetails').livequery(function(event) {

        $(this).click(function(event) {
            event.preventDefault();
            var effectDuration = 300;
            var $li = $(this).closest('li');
            var url = $(this).attr('data-inline-href') || $(this).attr('href');
            if ($('div.expander', $li).size() >= 1) {
                $('div.expander', $li).slideToggle(effectDuration, function() {
                    $li.toggleClass('open')
                });
            } else {
                $li.append($('<span style="display:none" class="listSpinner" /><div class="expander" style="display:none"></div>'));
                $('.listSpinner', $li).show(0);
                var data = Profile.getParameters();
                $('div.expander', $li).load(url, data, function() {
                    $(this).slideDown(effectDuration);
                    $li.toggleClass('open');
                    $('.listSpinner', $li).slideUp(effectDuration);
                });
            }
        });

        var $anchor = $(this);
        $anchor.attr('data-href', $anchor.attr('href'));
        $anchor.mousedown(function() {
            var $anchor = $(this);
            var href = $anchor.attr('data-href');
            if (href.indexOf('?') !== -1) {
                // add more parameters only if there is already a parameter (i.e. this is a match link)
                // no parameters: this is just a simple public profile link
                href = href + '&' + $.param(Profile.getParameters());
            }
            $anchor.attr('href', href);
        });
    });
};

Profile.initCompletionBars = function() {
    $('#content.profile #optimizationIndex').each(function() {
        var $slider = $('.slider', this);
        var initValue = 0;
        
        $slider.slider({
            'disabled': true,
            animate: true,
            range: 'min',
            min: 1,
            max: 100,
            step: 1,
            value: initValue
        });
        
        $('.triggerTooltip', this).each(function() {
            var $this = $(this);
            $this.text($this.attr('data-text').replace('{0}', '' + initValue));
        });
        
        $('.tooltip a[href]').livequery('click', function(event) {
            event.preventDefault();
            var rel = $(this).attr('href');
            Profile.openEditPanel(function() {
                var toggleLabel = $('label[rel=' + rel + '].toggle').not('.open');
                if (toggleLabel.length == 0) {
                    window.location.hash = rel.substring(1);
                } else {
                    toggleLabel.each(function() {
                        $(rel).bind('toggled', function() {
                            window.location.hash = rel.substring(1);
                            $(this).unbind('toggled');
                        });
                        $(this).click();
                    });
                }
            });
        });
    });
};

Profile.updateCompletionBars = function() {
    $('#content.profile #optimizationIndex').each(function() {
        $('> div:hidden', this).animate({ opacity: 'toggle' }, 'slow');
        var $optimizationResult = $('#content.profile #optimizationResult');
        var index = $optimizationResult.attr('data-index');
        var slider = $('.slider', this);
        slider.slider('value', index);
        var $trigger = $('.triggerTooltip', this);
        $trigger.text($trigger.attr('data-text').replace('{0}', '' + index));
        $('.tooltip', this).html($optimizationResult.html());
    });
};

Profile.initHelpPanels = function() {
    $('#profileEditPanel .panel').bind('toggled', function(event, isOpen) {
        var $this = $(this);
        if (isOpen) {
            var $closedContent = $this.parents('fieldset').find('label.toggle').not('.open');
            if ($closedContent.length !== 0) {
                $closedContent.click();
            }
        }
    });
};

Profile.countViews = function() {
    $('*[data-count-url]').livequery(function() {
        $.post($(this).attr('data-count-url'));
    });
};

Profile.initPublication = function() {
    
    $('#overlay.profile .publication').each(function() {
        var $overlay = $(this);
        var from, to;
        $('input.fromDate', $overlay).each(function() {
            from = new spike.html.Date($(this), {
                format: spike.Application.datePattern,
                lang: spike.Application.lang,
                trigger: false,
                firstDay: 1,
                css: {
                    root: 'calroot_from'
                },
                onHide: function() {
                    return false; 
                }
            });
        });
        $('input.toDate', $overlay).each(function() {
            to = new spike.html.Date($(this), {
                format: spike.Application.datePattern,
                lang: spike.Application.lang,
                trigger: false,
                firstDay: 1,
                css: {
                    root: 'calroot_to'
                },
                onHide: function() {
                    return false; 
                }
            });
        });
        $('#calroot_from').each(function() {
            var $this = $(this);
            $this.detach();
            $('div.from > .inner', $overlay).append($this);
            from.data("dateinput").show();
        });
        $('#calroot_to').each(function() {
            var $this = $(this);
            $this.detach();
            $('div.to > .inner', $overlay).append($this);
            to.data("dateinput").show();
        });
    });
    
};

$(function() {

    $.tools.tabs.addEffect('profileMatches', function(tabIndex) {
        Profile.loadTab(this, tabIndex, 0);
    });
    
    Profile.initTerms();
    Profile.initHistoryPlugin();
    Profile.changesObserver();
    Profile.bookmarker();
    Profile.editToggle();
    Profile.removeBookmark();
    Profile.initCompletionBars();
    Profile.initFilters();
    Profile.initTabs();
    Profile.initSave();
    Profile.showMatchingDetails();
    Profile.countViews();
    Profile.initHelpPanels();
    Profile.initPublication();
});

$(function() {

    var mapInit;

    $('.profile #location').overlay({
        top: 50,
        mask: { color: 'black', loadSpeed: 0, opacity: 0.4 },
        onLoad: function() {
            var $content = this.getOverlay().children('div');
            var defaultHeight = $(window).height() - 130;
            var contentHeight = $content.children(':first-child').height();
            var height = contentHeight < defaultHeight ? contentHeight : defaultHeight;
            $content.height(height);
            if (mapInit) {
                mapInit();
            }
            $content.find('div#map').addClass('map');
            $('input', $content).focus().focus();
        }
    });

    $('.profile .location a.delete').click(function() {
        var $scope = $(this).closest('.location');
        $scope.find('input[type=hidden]').val('');
        var $link = $scope.find('a#location');
        $link.text($link.attr('data-location-empty'));
        $(this).hide();
        Profile.reloadTab();
        Profile.enableSaveButton();
        return false;
    });

    $('#locationMap .map').livequery(function() {

        var geocoder = new google.maps.Geocoder();
        var map = new google.maps.Map(this, { mapTypeId: google.maps.MapTypeId.ROADMAP });
        var $location = $('.profile a#location');
        var $locationScope = $location.closest('.location');
        var $place = $locationScope.find('input[name=location.place]');
        var $lat = $locationScope.find('input[name=location.lat]');
        var $lng = $locationScope.find('input[name=location.lng]');
        var $zoom = $locationScope.find('input[name=location.zoom]');
        var $country = $locationScope.find('input[name=location.country]');
        
        var region = $location.attr('data-region') || 'de'; // TODO other fallback, maybe empty region?
        var infoContentText = $location.attr('data-selection-info');
        
        var $searchForm = $('#locationMap form');
        var $searchError = $('.error', $searchForm);

        var overlay = $location.data('overlay');
       
        function PoI() {
            this.marker = new google.maps.Marker({ map: map });
            this.info = new google.maps.InfoWindow({ maxWidth: 150 });
        }
        PoI.prototype.set = function(location, text, zoom) {
            map.setCenter(location);
            if (typeof zoom === 'number') {
                map.setZoom(zoom);
            } else if (typeof zoom === 'object') {
                map.fitBounds(zoom);
            }
            this.marker.setPosition(location);
            this.info.setPosition(location);
            this.info.setContent(text);
            this.info.open(map);
        };
        PoI.prototype.find = function(term, text) {
            var that = this;
            geocoder.geocode({ address: term, region: region, language: region }, function(data, status) {
                if (status === google.maps.GeocoderStatus.OK && data.length > 0) {
                    that.set(data[0].geometry.location, text(data[0]), data[0].geometry.viewport);
                } else {
                    $searchError.show().animate({ opacity: 1 }, 'slow', function() {
                        setTimeout(function() {
                            $searchError.animate({ opacity: 0 }, 'slow').hide();
                        }, 3000);
                    });
                }
            });
        };
        PoI.prototype.close = function() {
            this.info.close();
        };
        
        var current = new PoI(), suggestion = new PoI();
        
        function newLocation(geocoderResult) {
            var text = geocoderResult.formatted_address;
            var latlng = geocoderResult.geometry.location;
            var $a = $('<a href="#" class="newLocation action default"></a>').text(infoContentText);
            $a.click(function() {
                $location.text(text);
                $lat.val(latlng.lat());
                $lng.val(latlng.lng());
                $zoom.val(map.getZoom());
                $place.val(text);
                $.each(geocoderResult.address_components, function(index, component) {
                    if ($.inArray("country", component.types) != -1) {
                        $country.val(component.long_name);
                    }
                });
                overlay.close();
                suggestion.close();
                current.close();
                // toggle save hint, error message and remove button
                $locationScope.find('p.saveHint').show();
                $locationScope.find('p.error').remove();
                $locationScope.find('a.delete').show();
                Profile.reloadTab();
                Profile.enableSaveButton();
            });
            return $('<p></p>').text(text + ': ').append($a).get(0);
        }

        function findLocations(request, callback) {
            geocoder.geocode({ address: request.term, region: region, language: region }, function(data, status) {
                if (status === google.maps.GeocoderStatus.OK) {
                    var addresses = [];
                    $.each(data, function(index, address) {
                        addresses.push({ label: address.formatted_address, value: address.formatted_address, geocoderResult: address } );
                    });
                    callback(addresses);
                } else {
                    callback([]);
                }
            });
        }

        mapInit = function() {
            var latVal = $lat.val();
            var lngVal = $lng.val();
            var zoom = $zoom.val() || "12";
            if (latVal !== '' && lngVal !== '') {
                current.set(new google.maps.LatLng(parseFloat(latVal), parseFloat(lngVal)), $location.text(), parseInt(zoom));
            } else {
                suggestion.find(region, newLocation);
            }
        };
        mapInit();

        $('input', $searchForm).autocomplete({
            source: findLocations,
            select: function(event, ui) {
                var geocoderResult = ui.item.geocoderResult;
                suggestion.set(geocoderResult.geometry.location, newLocation(geocoderResult), geocoderResult.geometry.viewport);
            }
        });

        $searchForm.submit(function() {
            suggestion.find($('input', this).val(), newLocation);
            return false;
        });

    });
    
    $('#locationMatchAsMap').livequery(function() {
        
        var $map = $(this);
        var map = new google.maps.Map(this, { mapTypeId: google.maps.MapTypeId.ROADMAP });
        
        var origin;
        if ($map.attr('data-lat')) {
            var lat = parseFloat($map.attr('data-lat'));
            var lng = parseFloat($map.attr('data-lng'));
            var icon = $map.attr('data-icon');
            origin = new google.maps.LatLng(lat, lng);
            new google.maps.InfoWindow({ content: $map.attr('data-title'), position: origin, maxWidth: 150 }).open(map);
            new google.maps.Marker({ map: map, position: origin, icon: icon });
        }
        
        var latOther = parseFloat($map.attr('data-lat-other'));
        var lngOther = parseFloat($map.attr('data-lng-other'));
        var iconOther = $map.attr('data-icon-other');
        var destination = new google.maps.LatLng(latOther, lngOther);
        new google.maps.InfoWindow({ content: $map.attr('data-title-other'), position: destination, maxWidth: 150 }).open(map);
        new google.maps.Marker({ map: map, position: destination, icon: iconOther });

        function showDestination() {
            map.setCenter(destination);
            map.setZoom(parseInt($map.attr('data-zoom-other')));
        }
        
        if (origin) {
            var directionsService = new google.maps.DirectionsService();
            directionsService.route({ origin: origin, destination: destination, travelMode: google.maps.DirectionsTravelMode.DRIVING }, function(result, status) {
                if (status === google.maps.DirectionsStatus.OK) {
                    new google.maps.DirectionsRenderer({ directions: result,  map: map, markerOptions: { visible: false } });
                } else {
                    showDestination();
                }
            });
        } else {
            showDestination();
        }
    });

});
$(function () {
    
    $('#tryme').each(function() {
        
        var $trial = $(this);
        var $registration = $('#registration');
        
        var $matchesCount = $('.counter span[data-matches-count-url]', $trial);
        var matchesCountUrl = $matchesCount.attr('data-matches-count-url');
        
        function updateMatchesCount() {
            var offer = $('.type a[name=freelancer]', $trial).hasClass('selected');
            var data = $('#tryme .skills > form')[0].api.buildParams();
            $.extend(data, {
                'offer': offer,
                active: false
            });
            $.get(matchesCountUrl, data, function (data) {
                $matchesCount.text(data);
                if (data !== '0') {
                    $matchesCount.addClass('brzzzl');
                }
            });
        }
        
        Terms.initTerms($trial, updateMatchesCount);

        $('.type a', $trial).click(function() {
            var $current = $(this);
            var $other;
            if ($current.attr('name') === 'freelancer') {
                $other = $current.parent().find('a[name=project]'); 
            } else {
                $other = $current.parent().find('a[name=freelancer]'); 
            }
            $other.removeClass('selected');
            $current.addClass('selected');

            var $title = $current.parent().find('label[data-label-freelancer]');
            var $skills = $current.parents('#profile-trial').find('.skills label[data-label-freelancer]');
            if ($current.attr('name') === 'freelancer') {
                $title.text($title.attr('data-label-freelancer'));
                $skills.text($skills.attr('data-label-freelancer'));
            } else {
                $title.text($title.attr('data-label-project'));
                $skills.text($skills.attr('data-label-project'));
            }

            updateMatchesCount();
        });
        
        $('.counter.nextPage', $trial).click(function () {
            var offer = $('.type a[name=freelancer]', $trial).hasClass('selected');
            $("input[name=registrationProfileOffer]", $registration).val(offer);
            var index = 0;
            var $registrationTerms = $('input[name*=registrationProfileTerm]', $registration);
            $('.terms .keyword input[name=terms]', $trial).each(function () {
                $registrationTerms.eq(index).val($(this).val());
                index++;
            });
        });
    });

});$(function() {

    $('#content.profile .terms .readonly .slider').livequery(function() {
        var $slider = $(this);
        $slider.slider({
            disabled: true,
            range: 'min',
            min: 0,
            max: 100,
            value: $slider.attr('data-weight')
        });
    });

});
$(function() {

    $('.contactForm form').livequery(function() {
        var overlay = $(this).parents('#overlay');
        $(this).validator({ position: 'bottom left' }).submit(function(event) {
            if (!event.isDefaultPrevented()) {
                var $form = $(this);
                var $submitButton = $('button:submit', this);
                $submitButton.addClass('spinner');
                $.post(this.action + '.method', $form.serializeArray(), function(data) {
                    $submitButton.removeClass('spinner');
                    $('.close', overlay).click();
                    spike.util.Messenger.message.show($form.attr('data-success-message'));
                });
                return false;
            }
        });
        
    });

    $('a.contactLink').livequery(function() {
        var $link = $(this);
        $link.attr('href', spike.Application.path("/_contactForm.html"));
        $link.removeClass('contactLink');
        $link.addClass('overlayTrigger');
    });

});
$(function() {

    $('#invoices .js-change-invoice-state').livequery(function() {
        $('select', this).livequery(function() {
            $(this).data('previous-value', $(this).val());
        }).livequery('change', function(event) {
            var option = $('option:selected', this);
            var method = option.attr('data-method');

            var sendRequest = true;
            if (method === 'cancel') {
                sendRequest = confirm($(this).closest('*[data-cancel-confirm-message]').attr('data-cancel-confirm-message'));
            }

            if (sendRequest) {
                var message = option.attr('data-message');
                var url = $(this).attr('data-url');
                $.post(url, {'method': method, '.message': message }, function() {
                    $('.pagination a.currentPage').click(); // reload current page
                });
            } else {
                $(this).val($(this).data('previous-value'));
            }
        });
    });

});var i18nEdit = function(index, scope) {

    var editDiv = $('div.js-edit-view', scope);
    var showDiv = $('div.js-show-view', scope);
    var span = $('span', showDiv);
    var textarea = $('textarea', editDiv);

    var updateUrlAttr = 'data-update-url';

    $('button.js-edit, button.js-create', showDiv).click(function() {
        showDiv.hide();
        editDiv.show();
        textarea.focus();
    });

    $('button.js-cancel', editDiv).click(function() {
        editDiv.hide();
        showDiv.show();
        textarea.val($.trim(span.text()));
    });

    $('button.js-save', editDiv).click(function() {
        function updated(message) {
            if (message.length == 0) {
                span.html('&#160;');
            }
            else {
                span.text(message);
            }
            span.show();
            textarea.val(message); // set possibly trimmed value
            showDiv.show();
            editDiv.hide();
        }

        var message = $.trim(textarea.val());
        var updateUrl = $(scope).attr(updateUrlAttr);
        if (updateUrl) {
            // case 1: update message
            $.post(updateUrl, { method: 'put', i18nValue: message, disabled: false }, function() {
                updated(message);
                $('button.js-create', showDiv).hide();
                $('button.js-edit, button.js-delete', showDiv).show();
            });
        } else {
            // case 2: new message
            var keyContainer = $(scope).closest('.js-i18nKey-container');
            var key = $(keyContainer).attr('data-key');
            var createUrl = $(keyContainer).attr('data-create-url');
            var locale = $(scope).closest('.js-locale').attr('data-locale');
            var initTenant = $(scope).attr('data-init-tenant');
            $.post(createUrl,
                  {
                      method: 'post',
                      i18nKey: key,
                      i18nValue: message,
                      locale: locale,
                      initTenant: initTenant,
                      '-return': 'i18nMessage.path.method'
                  },
                  function(data) {
                      $(scope).attr(updateUrlAttr, data);
                      updated(message);
                      $('button.js-create', showDiv).hide();
                      $('button.js-edit, button.js-delete', showDiv).show();
                  });
        }
    });

    $('button.js-delete', showDiv).click(function() {
        var updateUrl = $(scope).attr(updateUrlAttr);
        var button = this;
        $.post(updateUrl, { method: 'put', disabled: true, i18nValue: '' }, function() {
            $(button).hide();
            $('button.js-edit', showDiv).hide();
            $('button.js-create', showDiv).show();
            span.html('').hide();
            textarea.val('');
        });
    });

};

$(function() {
    $('.js-i18nEdit').livequery(function() {
        $(this).each(i18nEdit);
    });
});
$(function () {

    $.easing.custom = function (x, t, b, c, d) {
        var s = 1.70158;
        if ((t /= d / 2) < 1) {
            return c / 2 * (t * t * (((s *= (1.525)) + 1) * t - s)) + b;
        }
        return c / 2 * ((t -= 2) * t * (((s *= (1.525)) + 1) * t + s) + 2) + b;
    };

    var sliderElem = $("div.slideable")[0];
    var slideable = $(sliderElem).scrollable({
        easing: 'custom',
        speed: 700,
        size: 1,
        next: '.nextPage',
        clickable: false,
        keyboard: false
    });
    var slideableApi = slideable.data('scrollable');

    /******************/
    /* Initialization */
    /******************/

    if (slideable.attr('data-tryme') === 'true') {
        slideableApi.seekTo(1, 0);
    }
    if (slideable.attr('data-errors') === 'true') {
        slideableApi.seekTo(2, 0);
    }
    if (slideable.attr('data-register') === 'true') {
        slideableApi.seekTo(2, 0);
    }

    $('#registerCaller').click(function() {
        slideableApi.seekTo(2, 700);
        return false;
    });
    
    $('#tweets').each(function() {
        var $this = $(this);
        var $scrollable = $(' > .scrollable', this);
        var hover = false;
        var vertical = $this.hasClass('vertical');
        var tweetCount = parseInt($this.attr('data-tweet-count'));
        
        function next(api) {
            window.setTimeout(function() {
                if (!hover) {
                    if (api.getIndex() == api.getSize() - tweetCount) {
                        api.seekTo(0, 800);
                    } else {
                        api.next(1000);
                    }
                }
                next(api);
            }, 1000 * 4);
        }
        
        $scrollable.hover(function() {
            hover = true;
        }, function() {
            hover = false;
        });
        
        next($scrollable.scrollable({
            vertical: vertical,
            easing: 'custom',
            onBeforeSeek: function() {
                var $items = $(this.getItems());
                $items.removeClass('last');
                var size = this.getSize();
                var index = this.getIndex();
                if (index == size - tweetCount) {
                    $($items[3]).addClass('last');
                } else {
                    $($items[index + tweetCount]).addClass('last');
                }
            }
        }).data('scrollable'));
    });

});
$(function () {

    $('#login').each(function() {
        var $login = $(this);
        if ($login.hasClass('open')) {
            $('input[type="text"]', $login).focus();
        }
        $('.loginCaller').click(function() {
            $login.switchClass('closed', 'open');
            $('input[type="text"]', $login).focus();
            return false;
        });
        $('#login .hide').click(function() {
            $login.switchClass('open', 'closed');
            return false;
        });
    });

    $('#announcement[data-changelog-disable-announcement-url]').each(function() {
        var $changelog = $(this);
        $changelog.find('.close').click(function() {
            var disableAnnouncementUrl = $changelog.attr("data-changelog-disable-announcement-url");
            if (disableAnnouncementUrl !== "") {
                $.post(disableAnnouncementUrl, { method:'disableNewFeatureAnnouncements' }, function() {
                    $changelog.animate({ top: -$changelog.height() }, 'slow');
                });
            }
            return false;
        });
    });

});
$(function() {
    $('.premium-tooltip-trigger').livequery(function() {
        var $trigger = $(this);
        var tip = $(this).attr('data-tooltip-selector') || '#premiumTooltip';
        
        // temporarily remove the title attribute (otherwise it will always be used as the tooltip contents)
        var title = $trigger.attr('title');
        if (title) {
            $trigger.removeAttr('title');
        }
        new spike.html.Tooltip($trigger, {
            tip: tip,
            relative: false
        });
        // and restore the title if present
        if (title) {
            $trigger.attr('title', title);
        }
    });

    $('input.premium-tooltip-trigger').livequery(function() {
        $(this).attr('disabled', 'disabled');
    });
});
$(function () {

    $("#creditCard, #debit").validator({ position: 'bottom left' });

    /*
    * Starting from here only appearing in:
    * bookingPaymentOptions.html
    */
    $('.paymentMethods').each(function() {
        var scope = this;
        $('.type', scope).change(function() {
            var $paymentMethodInputs = $(this).parents('.paymentMethod').find('.paymentMethodInputs').eq(0);
            $('.paymentMethodInputs', scope).slideUp();
            $paymentMethodInputs.slideDown();
            
            var $buttons = $(this).parents('.paymentMethod').find('.buttons').eq(0);
            $('.buttons', scope).hide();
            $buttons.show();
            
            $('.type', scope).removeAttr('checked');
            $(this).attr('checked', 'checked');
        });
        $('.type:first', scope).change();
    });

  $('button[data-direct-confirmation-link]').click(function() {
    if ($('.type:checked').attr('data-externalRequest') == "false") { // Daten direkt an Spike
      var href = $(this).attr('data-direct-confirmation-link');
      window.location.href = href;
    }
  });

  $('form.paymentCycle').each(function() {
      var scope = this;
      $('select', scope).change(function() {
          $('button', scope).removeAttr('disabled');
      });
  });

});
$(function() {

    $('.overlayTrigger').livequery(function() {
        if ($('#overlay').size() === 0) {
            $('body').append($('<div id="overlay"><div /></div>'));
        }
        $(this).attr('rel', '#overlay');
        $(this).overlay({
            top: 50,
            mask: { 
                color: 'black',
                loadSpeed: 0,
                opacity: 0.6
            },
            load: $(this).hasClass('open') ? true : false,
            onBeforeLoad: function() {
                function applyContentHeight($content, defaultHeight) {
                    var $inner = $content.children(':first-child');
                    var contentHeight = $inner.hasClass('fullHeight') ? defaultHeight
                            : $inner.height() + 1; // + 1 is a work-around for Firefox (see i18nMessages overlay)
                    $content.height(Math.min(contentHeight, defaultHeight));
                }

                var url = this.getTrigger().attr('href');
                var $content = this.getOverlay().children('div');
                var defaultHeight = $(window).height() - 130;
                if (url) {
                    $content.load(url, function() {
                        var $content = $(this);
                        applyContentHeight($content, defaultHeight);
                    });
                } else {
                    applyContentHeight($content, defaultHeight);
                }
            },
            onClose: function() {
                var url = this.getTrigger().attr('href');
                if (url) {
                    this.getOverlay().children('div').html('');
                }
            }
        });
    });

});
$(function() {
    
    var checkboxSelector = $('.termsAndConditions :checkbox');
    if (checkboxSelector.attr('checked')) {
        enableButton();
    }
    checkboxSelector.click(function() {
        checkTermsAreAccepted(checkboxSelector);
    });

    function checkTermsAreAccepted(termsInputSelector) {
        if (termsInputSelector.attr('checked')) {
            enableButton();
        }
        else {
            $('button.register').attr('disabled', 'disabled');
            $('button.register').addClass('disabled');
            $('.landingpage').addClass('error');
        }
    }

    function enableButton() {
        $('button.register').removeAttr('disabled');
        $('button.register').removeClass('disabled');
        $('.landingpage').removeClass('error');
    }

    $('.landingPage button.register').click(function() {
        if (!$('.termsAndConditions :checkbox').attr('checked')) {
            $('.landingpage').addClass('error');
            return false;
        }
        return true;
    });
    
});
$(function() {
  $('form input[type="file"]').each(function() {
    var submit = $(this).closest('form').find('*[type="submit"]').attr('disabled', 'disabled');
    $(this).change(function() {
      if ($(this).val() === '') {
        submit.attr('disabled', 'disabled');
      } else {
        submit.removeAttr('disabled');
      }
    });
  });
});$(function() {
    $('#hauling-action').each(function() {
        var $button = $('button.action', this);
        $('select', this).change(function() {
            var $this = $(this);
            if ($this.val() === $this.attr('data-current-tenant')) {
                $button.text($button.attr('data-stay-label')).attr('data-confirm-message', $button.attr('data-confirm-message-stay'));
            } else {
                $button.text($button.attr('data-hauling-label')).attr('data-confirm-message', $button.attr('data-confirm-message-move').replace(/TENANT/g, $this.val()));
            }
        });
    });
});$(function() {
    
    $('#navMain .hideOnClick').each(function() {
        var $toHide = $(this);
        $('a', $toHide).click(function() {
            $toHide.css('display', 'none');
        }).mouseout(function() {
            $toHide.css('display', '');
        });
    });
    
    //TODO: better integration
    $('#navMeta .google > div').each(function() {
        var $this = $(this);
        var help = $(this).attr('data-help');
        var settingsText = $(this).attr('data-settings-text');
        var helpGoogleplus = $(this).attr('data-help-googleplus');
        var uri = $(this).attr('data-href');
        $this.socialSharePrivacy({
            css_path: '',
            txt_help: help,
            settings_perma: settingsText,
            uri: uri,
            services: {
                twitter: {
                    status: 'off'
                },
                facebook: {
                    status: 'off'
                },
                gplus: {
                    dummy_img: spike.Application.staticPath('/static/images/dummy_gplus.png'),
                    txt_info: helpGoogleplus
                }
            }
        });
    });
    
});
$(function() {
	
	$('.bar-chart').each(function() {
		var values = $(this).attr('data-values').split(',');
		var color = $(this).attr('data-color');
		var data = [];
		for(var i = 0; i < values.length; i++) {
			data.push([i, values[i]]);
		}
		var bars = { bars: { show: true, barWidth: 0.7, lineWidth: 0, fillColor: color },
		             grid: { show: false }};
		var dataOptions = { data: data, color: color };
		$.plot($(this), [dataOptions], bars);
	});
	
	$('.ticker').liScroll({travelocity: 0.05});
	
});$(function() {
    
    // for some reason the scrollable area isn't correct positioned when it is initially hidden
    // work-around: always scroll it back to the first item when it becomes visible
    $('#documents').bind('toggled', function() {
        $('.photos > div', this).each(function() {
            var data = $(this).filter(':visible').data('scrollable');
            if (typeof data === 'object')
                data.seekTo(0);
        });
    });

    $('.photos > div').livequery(function() {
        var $photos = $(this);

        // before doing anything else: remove any cloned scrollable divs (which may have been copied from another HTML)
        $('div.cloned', $photos).remove();

        // attach lightBox
        $('.photo a.lightBox', $photos).lightBox({
            imageLoading: spike.Application.staticPath('/static/images/ajax-loader.gif'),
            imageBtnPrev: spike.Application.staticPath('/static/images/prev.gif'),
            imageBtnNext: spike.Application.staticPath('/static/images/next.gif'),
            imageBtnClose: spike.Application.staticPath('/static/images/overlay_close.png'),
            imageBlank: spike.Application.staticPath('/static/images/blank.gif'),
            txtImage: $photos.attr('data-lightBox-txt-image'),
            txtOf: $photos.attr('data-lightBox-txt-of')
        });

        // attach delete event handler
        $('a.delete', $photos).click(function() {
            var $a = $(this).closest('.photo').find('a.lightBox');
            // do the delete logic for both the original and the cloned photos
            $('a.lightBox[href=' + $a.attr('href') + ']', $photos).each(function() {
                var $photoDiv = $(this).closest('.photo');
                $photoDiv.find('input').val('false');
                $photoDiv.find('a.delete').remove();
                $photoDiv.find('div.hidePhoto').fadeIn();
            });
            Profile.displayDocumentsSaveHint();
            return false;
        });

        // finally: attach scrollable
        // (must be the last because circular creates clones which must be excluded from the lightBox)
        $photos.scrollable({
            circular: true
        });

        // in editMode every image has a hidden input attached to it -> remove all inputs of the cloned images
        $('div.cloned input', $photos).remove();

    });

});
$(function() {
    
    $('div.help .marker').each(function() {
        var $this = $(this);
        var $rel = $($this.attr('rel'));
        $this.mouseover(function() {
            $rel.addClass('marked');
        }).mouseout(function() {
            $rel.removeClass('marked');
        });
    });
       
})
