radiant-race_results-extension 1.4.3 → 1.4.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. data/app/controllers/admin/race_instances_controller.rb +1 -1
  2. data/app/controllers/race_instances_controller.rb +7 -1
  3. data/app/controllers/race_performances_controller.rb +8 -0
  4. data/app/models/race.rb +7 -0
  5. data/app/models/race_checkpoint.rb +27 -1
  6. data/app/models/race_checkpoint_time.rb +33 -5
  7. data/app/models/race_instance.rb +38 -9
  8. data/app/models/race_performance.rb +81 -3
  9. data/app/views/admin/races/_form.html.haml +1 -2
  10. data/app/views/race_clubs/show.html.haml +3 -3
  11. data/app/views/race_instances/_results_header.html.haml +10 -0
  12. data/app/views/race_instances/_splits_header.html.haml +9 -0
  13. data/app/views/race_instances/show.html.haml +17 -8
  14. data/app/views/race_instances/splits.html.haml +19 -14
  15. data/app/views/race_performances/_performance.html.haml +12 -2
  16. data/app/views/race_performances/_splits.html.haml +30 -8
  17. data/app/views/race_performances/show.html.haml +18 -76
  18. data/app/views/races/show.html.haml +2 -1
  19. data/config/locales/en.yml +20 -0
  20. data/config/routes.rb +1 -1
  21. data/db/migrate/20111103150827_mapping_routes.rb +22 -0
  22. data/db/migrate/20111115150827_finish_checkpoint.rb +8 -0
  23. data/lib/race_tags.rb +3 -3
  24. data/lib/radiant-race_results-extension.rb +1 -1
  25. data/public/images/race_results/sorts.png +0 -0
  26. data/public/javascripts/flot/API.txt +1201 -0
  27. data/public/javascripts/flot/FAQ.txt +76 -0
  28. data/public/javascripts/flot/LICENSE.txt +22 -0
  29. data/public/javascripts/flot/Makefile +9 -0
  30. data/public/javascripts/flot/NEWS.txt +508 -0
  31. data/public/javascripts/flot/PLUGINS.txt +137 -0
  32. data/public/javascripts/flot/README.txt +90 -0
  33. data/public/javascripts/flot/examples/ajax.html +143 -0
  34. data/public/javascripts/flot/examples/annotating.html +75 -0
  35. data/public/javascripts/flot/examples/arrow-down.gif +0 -0
  36. data/public/javascripts/flot/examples/arrow-left.gif +0 -0
  37. data/public/javascripts/flot/examples/arrow-right.gif +0 -0
  38. data/public/javascripts/flot/examples/arrow-up.gif +0 -0
  39. data/public/javascripts/flot/examples/basic.html +38 -0
  40. data/public/javascripts/flot/examples/data-eu-gdp-growth-1.json +4 -0
  41. data/public/javascripts/flot/examples/data-eu-gdp-growth-2.json +4 -0
  42. data/public/javascripts/flot/examples/data-eu-gdp-growth-3.json +4 -0
  43. data/public/javascripts/flot/examples/data-eu-gdp-growth-4.json +4 -0
  44. data/public/javascripts/flot/examples/data-eu-gdp-growth-5.json +4 -0
  45. data/public/javascripts/flot/examples/data-eu-gdp-growth.json +4 -0
  46. data/public/javascripts/flot/examples/data-japan-gdp-growth.json +4 -0
  47. data/public/javascripts/flot/examples/data-usa-gdp-growth.json +4 -0
  48. data/public/javascripts/flot/examples/graph-types.html +75 -0
  49. data/public/javascripts/flot/examples/hs-2004-27-a-large_web.jpg +0 -0
  50. data/public/javascripts/flot/examples/image.html +45 -0
  51. data/public/javascripts/flot/examples/index.html +44 -0
  52. data/public/javascripts/flot/examples/interacting-axes.html +97 -0
  53. data/public/javascripts/flot/examples/interacting.html +93 -0
  54. data/public/javascripts/flot/examples/layout.css +6 -0
  55. data/public/javascripts/flot/examples/multiple-axes.html +60 -0
  56. data/public/javascripts/flot/examples/navigate.html +118 -0
  57. data/public/javascripts/flot/examples/percentiles.html +57 -0
  58. data/public/javascripts/flot/examples/pie.html +756 -0
  59. data/public/javascripts/flot/examples/realtime.html +83 -0
  60. data/public/javascripts/flot/examples/resize.html +61 -0
  61. data/public/javascripts/flot/examples/selection.html +114 -0
  62. data/public/javascripts/flot/examples/setting-options.html +61 -0
  63. data/public/javascripts/flot/examples/stacking.html +77 -0
  64. data/public/javascripts/flot/examples/symbols.html +49 -0
  65. data/public/javascripts/flot/examples/thresholding.html +54 -0
  66. data/public/javascripts/flot/examples/time.html +71 -0
  67. data/public/javascripts/flot/examples/tracking.html +95 -0
  68. data/public/javascripts/flot/examples/turning-series.html +98 -0
  69. data/public/javascripts/flot/examples/visitors.html +90 -0
  70. data/public/javascripts/flot/examples/zooming.html +98 -0
  71. data/public/javascripts/flot/excanvas.js +1427 -0
  72. data/public/javascripts/flot/excanvas.min.js +1 -0
  73. data/public/javascripts/flot/jquery.colorhelpers.js +179 -0
  74. data/public/javascripts/flot/jquery.colorhelpers.min.js +1 -0
  75. data/public/javascripts/flot/jquery.flot.crosshair.js +167 -0
  76. data/public/javascripts/flot/jquery.flot.crosshair.min.js +1 -0
  77. data/public/javascripts/flot/jquery.flot.fillbetween.js +183 -0
  78. data/public/javascripts/flot/jquery.flot.fillbetween.min.js +1 -0
  79. data/public/javascripts/flot/jquery.flot.image.js +238 -0
  80. data/public/javascripts/flot/jquery.flot.image.min.js +1 -0
  81. data/public/javascripts/flot/jquery.flot.js +2599 -0
  82. data/public/javascripts/flot/jquery.flot.min.js +6 -0
  83. data/public/javascripts/flot/jquery.flot.navigate.js +336 -0
  84. data/public/javascripts/flot/jquery.flot.navigate.min.js +1 -0
  85. data/public/javascripts/flot/jquery.flot.pie.js +750 -0
  86. data/public/javascripts/flot/jquery.flot.pie.min.js +1 -0
  87. data/public/javascripts/flot/jquery.flot.resize.js +60 -0
  88. data/public/javascripts/flot/jquery.flot.resize.min.js +1 -0
  89. data/public/javascripts/flot/jquery.flot.selection.js +344 -0
  90. data/public/javascripts/flot/jquery.flot.selection.min.js +1 -0
  91. data/public/javascripts/flot/jquery.flot.stack.js +184 -0
  92. data/public/javascripts/flot/jquery.flot.stack.min.js +1 -0
  93. data/public/javascripts/flot/jquery.flot.symbol.js +70 -0
  94. data/public/javascripts/flot/jquery.flot.symbol.min.js +1 -0
  95. data/public/javascripts/flot/jquery.flot.threshold.js +103 -0
  96. data/public/javascripts/flot/jquery.flot.threshold.min.js +1 -0
  97. data/public/javascripts/flot/jquery.js +8316 -0
  98. data/public/javascripts/flot/jquery.min.js +23 -0
  99. data/public/javascripts/jquery.qtip.js +2675 -0
  100. data/public/javascripts/jquery.sparkline.js +1271 -0
  101. data/public/javascripts/races.js +245 -0
  102. data/public/stylesheets/sass/admin/races.sass +65 -70
  103. data/public/stylesheets/sass/jquery.flot.sass +416 -0
  104. data/public/stylesheets/sass/race_results.sass +38 -2
  105. data/radiant-race_results-extension.gemspec +1 -1
  106. metadata +95 -11
  107. data/public/javascripts/tablesorter.js +0 -3
@@ -0,0 +1,23 @@
1
+ /*
2
+ * jQuery JavaScript Library v1.5.1
3
+ * http://jquery.com/
4
+ *
5
+ * Copyright 2011, John Resig
6
+ * Dual licensed under the MIT or GPL Version 2 licenses.
7
+ * http://jquery.org/license
8
+ *
9
+ * Includes Sizzle.js
10
+ * http://sizzlejs.com/
11
+ * Copyright 2011, The Dojo Foundation
12
+ * Released under the MIT, BSD, and GPL Licenses.
13
+ *
14
+ * Date: Wed Feb 23 13:55:29 2011 -0500
15
+ */
16
+ (function(aY,H){var al=aY.document;var a=(function(){var bn=function(bI,bJ){return new bn.fn.init(bI,bJ,bl)},bD=aY.jQuery,bp=aY.$,bl,bH=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,bv=/\S/,br=/^\s+/,bm=/\s+$/,bq=/\d/,bj=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,bw=/^[\],:{}\s]*$/,bF=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,by=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,bs=/(?:^|:|,)(?:\s*\[)+/g,bh=/(webkit)[ \/]([\w.]+)/,bA=/(opera)(?:.*version)?[ \/]([\w.]+)/,bz=/(msie) ([\w.]+)/,bB=/(mozilla)(?:.*? rv:([\w.]+))?/,bG=navigator.userAgent,bE,bC=false,bk,e="then done fail isResolved isRejected promise".split(" "),bd,bu=Object.prototype.toString,bo=Object.prototype.hasOwnProperty,bi=Array.prototype.push,bt=Array.prototype.slice,bx=String.prototype.trim,be=Array.prototype.indexOf,bg={};bn.fn=bn.prototype={constructor:bn,init:function(bI,bM,bL){var bK,bN,bJ,bO;if(!bI){return this}if(bI.nodeType){this.context=this[0]=bI;this.length=1;return this}if(bI==="body"&&!bM&&al.body){this.context=al;this[0]=al.body;this.selector="body";this.length=1;return this}if(typeof bI==="string"){bK=bH.exec(bI);if(bK&&(bK[1]||!bM)){if(bK[1]){bM=bM instanceof bn?bM[0]:bM;bO=(bM?bM.ownerDocument||bM:al);bJ=bj.exec(bI);if(bJ){if(bn.isPlainObject(bM)){bI=[al.createElement(bJ[1])];bn.fn.attr.call(bI,bM,true)}else{bI=[bO.createElement(bJ[1])]}}else{bJ=bn.buildFragment([bK[1]],[bO]);bI=(bJ.cacheable?bn.clone(bJ.fragment):bJ.fragment).childNodes}return bn.merge(this,bI)}else{bN=al.getElementById(bK[2]);if(bN&&bN.parentNode){if(bN.id!==bK[2]){return bL.find(bI)}this.length=1;this[0]=bN}this.context=al;this.selector=bI;return this}}else{if(!bM||bM.jquery){return(bM||bL).find(bI)}else{return this.constructor(bM).find(bI)}}}else{if(bn.isFunction(bI)){return bL.ready(bI)}}if(bI.selector!==H){this.selector=bI.selector;this.context=bI.context}return bn.makeArray(bI,this)},selector:"",jquery:"1.5.1",length:0,size:function(){return this.length},toArray:function(){return bt.call(this,0)},get:function(bI){return bI==null?this.toArray():(bI<0?this[this.length+bI]:this[bI])},pushStack:function(bJ,bL,bI){var bK=this.constructor();if(bn.isArray(bJ)){bi.apply(bK,bJ)}else{bn.merge(bK,bJ)}bK.prevObject=this;bK.context=this.context;if(bL==="find"){bK.selector=this.selector+(this.selector?" ":"")+bI}else{if(bL){bK.selector=this.selector+"."+bL+"("+bI+")"}}return bK},each:function(bJ,bI){return bn.each(this,bJ,bI)},ready:function(bI){bn.bindReady();bk.done(bI);return this},eq:function(bI){return bI===-1?this.slice(bI):this.slice(bI,+bI+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(bt.apply(this,arguments),"slice",bt.call(arguments).join(","))},map:function(bI){return this.pushStack(bn.map(this,function(bK,bJ){return bI.call(bK,bJ,bK)}))},end:function(){return this.prevObject||this.constructor(null)},push:bi,sort:[].sort,splice:[].splice};bn.fn.init.prototype=bn.fn;bn.extend=bn.fn.extend=function(){var bR,bK,bI,bJ,bO,bP,bN=arguments[0]||{},bM=1,bL=arguments.length,bQ=false;if(typeof bN==="boolean"){bQ=bN;bN=arguments[1]||{};bM=2}if(typeof bN!=="object"&&!bn.isFunction(bN)){bN={}}if(bL===bM){bN=this;--bM}for(;bM<bL;bM++){if((bR=arguments[bM])!=null){for(bK in bR){bI=bN[bK];bJ=bR[bK];if(bN===bJ){continue}if(bQ&&bJ&&(bn.isPlainObject(bJ)||(bO=bn.isArray(bJ)))){if(bO){bO=false;bP=bI&&bn.isArray(bI)?bI:[]}else{bP=bI&&bn.isPlainObject(bI)?bI:{}}bN[bK]=bn.extend(bQ,bP,bJ)}else{if(bJ!==H){bN[bK]=bJ}}}}}return bN};bn.extend({noConflict:function(bI){aY.$=bp;if(bI){aY.jQuery=bD}return bn},isReady:false,readyWait:1,ready:function(bI){if(bI===true){bn.readyWait--}if(!bn.readyWait||(bI!==true&&!bn.isReady)){if(!al.body){return setTimeout(bn.ready,1)}bn.isReady=true;if(bI!==true&&--bn.readyWait>0){return}bk.resolveWith(al,[bn]);if(bn.fn.trigger){bn(al).trigger("ready").unbind("ready")}}},bindReady:function(){if(bC){return}bC=true;if(al.readyState==="complete"){return setTimeout(bn.ready,1)}if(al.addEventListener){al.addEventListener("DOMContentLoaded",bd,false);aY.addEventListener("load",bn.ready,false)}else{if(al.attachEvent){al.attachEvent("onreadystatechange",bd);aY.attachEvent("onload",bn.ready);var bI=false;try{bI=aY.frameElement==null}catch(bJ){}if(al.documentElement.doScroll&&bI){bf()}}}},isFunction:function(bI){return bn.type(bI)==="function"},isArray:Array.isArray||function(bI){return bn.type(bI)==="array"},isWindow:function(bI){return bI&&typeof bI==="object"&&"setInterval" in bI},isNaN:function(bI){return bI==null||!bq.test(bI)||isNaN(bI)},type:function(bI){return bI==null?String(bI):bg[bu.call(bI)]||"object"},isPlainObject:function(bJ){if(!bJ||bn.type(bJ)!=="object"||bJ.nodeType||bn.isWindow(bJ)){return false}if(bJ.constructor&&!bo.call(bJ,"constructor")&&!bo.call(bJ.constructor.prototype,"isPrototypeOf")){return false}var bI;for(bI in bJ){}return bI===H||bo.call(bJ,bI)},isEmptyObject:function(bJ){for(var bI in bJ){return false}return true},error:function(bI){throw bI},parseJSON:function(bI){if(typeof bI!=="string"||!bI){return null}bI=bn.trim(bI);if(bw.test(bI.replace(bF,"@").replace(by,"]").replace(bs,""))){return aY.JSON&&aY.JSON.parse?aY.JSON.parse(bI):(new Function("return "+bI))()}else{bn.error("Invalid JSON: "+bI)}},parseXML:function(bK,bI,bJ){if(aY.DOMParser){bJ=new DOMParser();bI=bJ.parseFromString(bK,"text/xml")}else{bI=new ActiveXObject("Microsoft.XMLDOM");bI.async="false";bI.loadXML(bK)}bJ=bI.documentElement;if(!bJ||!bJ.nodeName||bJ.nodeName==="parsererror"){bn.error("Invalid XML: "+bK)}return bI},noop:function(){},globalEval:function(bK){if(bK&&bv.test(bK)){var bJ=al.head||al.getElementsByTagName("head")[0]||al.documentElement,bI=al.createElement("script");if(bn.support.scriptEval()){bI.appendChild(al.createTextNode(bK))}else{bI.text=bK}bJ.insertBefore(bI,bJ.firstChild);bJ.removeChild(bI)}},nodeName:function(bJ,bI){return bJ.nodeName&&bJ.nodeName.toUpperCase()===bI.toUpperCase()},each:function(bL,bP,bK){var bJ,bM=0,bN=bL.length,bI=bN===H||bn.isFunction(bL);if(bK){if(bI){for(bJ in bL){if(bP.apply(bL[bJ],bK)===false){break}}}else{for(;bM<bN;){if(bP.apply(bL[bM++],bK)===false){break}}}}else{if(bI){for(bJ in bL){if(bP.call(bL[bJ],bJ,bL[bJ])===false){break}}}else{for(var bO=bL[0];bM<bN&&bP.call(bO,bM,bO)!==false;bO=bL[++bM]){}}}return bL},trim:bx?function(bI){return bI==null?"":bx.call(bI)}:function(bI){return bI==null?"":bI.toString().replace(br,"").replace(bm,"")},makeArray:function(bL,bJ){var bI=bJ||[];if(bL!=null){var bK=bn.type(bL);if(bL.length==null||bK==="string"||bK==="function"||bK==="regexp"||bn.isWindow(bL)){bi.call(bI,bL)}else{bn.merge(bI,bL)}}return bI},inArray:function(bK,bL){if(bL.indexOf){return bL.indexOf(bK)}for(var bI=0,bJ=bL.length;bI<bJ;bI++){if(bL[bI]===bK){return bI}}return -1},merge:function(bM,bK){var bL=bM.length,bJ=0;if(typeof bK.length==="number"){for(var bI=bK.length;bJ<bI;bJ++){bM[bL++]=bK[bJ]}}else{while(bK[bJ]!==H){bM[bL++]=bK[bJ++]}}bM.length=bL;return bM},grep:function(bJ,bO,bI){var bK=[],bN;bI=!!bI;for(var bL=0,bM=bJ.length;bL<bM;bL++){bN=!!bO(bJ[bL],bL);if(bI!==bN){bK.push(bJ[bL])}}return bK},map:function(bJ,bO,bI){var bK=[],bN;for(var bL=0,bM=bJ.length;bL<bM;bL++){bN=bO(bJ[bL],bL,bI);if(bN!=null){bK[bK.length]=bN}}return bK.concat.apply([],bK)},guid:1,proxy:function(bK,bJ,bI){if(arguments.length===2){if(typeof bJ==="string"){bI=bK;bK=bI[bJ];bJ=H}else{if(bJ&&!bn.isFunction(bJ)){bI=bJ;bJ=H}}}if(!bJ&&bK){bJ=function(){return bK.apply(bI||this,arguments)}}if(bK){bJ.guid=bK.guid=bK.guid||bJ.guid||bn.guid++}return bJ},access:function(bI,bQ,bO,bK,bN,bP){var bJ=bI.length;if(typeof bQ==="object"){for(var bL in bQ){bn.access(bI,bL,bQ[bL],bK,bN,bO)}return bI}if(bO!==H){bK=!bP&&bK&&bn.isFunction(bO);for(var bM=0;bM<bJ;bM++){bN(bI[bM],bQ,bK?bO.call(bI[bM],bM,bN(bI[bM],bQ)):bO,bP)}return bI}return bJ?bN(bI[0],bQ):H},now:function(){return(new Date()).getTime()},_Deferred:function(){var bL=[],bM,bJ,bK,bI={done:function(){if(!bK){var bO=arguments,bP,bS,bR,bQ,bN;if(bM){bN=bM;bM=0}for(bP=0,bS=bO.length;bP<bS;bP++){bR=bO[bP];bQ=bn.type(bR);if(bQ==="array"){bI.done.apply(bI,bR)}else{if(bQ==="function"){bL.push(bR)}}}if(bN){bI.resolveWith(bN[0],bN[1])}}return this},resolveWith:function(bO,bN){if(!bK&&!bM&&!bJ){bJ=1;try{while(bL[0]){bL.shift().apply(bO,bN)}}catch(bP){throw bP}finally{bM=[bO,bN];bJ=0}}return this},resolve:function(){bI.resolveWith(bn.isFunction(this.promise)?this.promise():this,arguments);return this},isResolved:function(){return !!(bJ||bM)},cancel:function(){bK=1;bL=[];return this}};return bI},Deferred:function(bJ){var bI=bn._Deferred(),bL=bn._Deferred(),bK;bn.extend(bI,{then:function(bN,bM){bI.done(bN).fail(bM);return this},fail:bL.done,rejectWith:bL.resolveWith,reject:bL.resolve,isRejected:bL.isResolved,promise:function(bN){if(bN==null){if(bK){return bK}bK=bN={}}var bM=e.length;while(bM--){bN[e[bM]]=bI[e[bM]]}return bN}});bI.done(bL.cancel).fail(bI.cancel);delete bI.cancel;if(bJ){bJ.call(bI,bI)}return bI},when:function(bJ){var bO=arguments.length,bI=bO<=1&&bJ&&bn.isFunction(bJ.promise)?bJ:bn.Deferred(),bM=bI.promise();if(bO>1){var bN=bt.call(arguments,0),bL=bO,bK=function(bP){return function(bQ){bN[bP]=arguments.length>1?bt.call(arguments,0):bQ;if(!(--bL)){bI.resolveWith(bM,bN)}}};while((bO--)){bJ=bN[bO];if(bJ&&bn.isFunction(bJ.promise)){bJ.promise().then(bK(bO),bI.reject)}else{--bL}}if(!bL){bI.resolveWith(bM,bN)}}else{if(bI!==bJ){bI.resolve(bJ)}}return bM},uaMatch:function(bJ){bJ=bJ.toLowerCase();var bI=bh.exec(bJ)||bA.exec(bJ)||bz.exec(bJ)||bJ.indexOf("compatible")<0&&bB.exec(bJ)||[];return{browser:bI[1]||"",version:bI[2]||"0"}},sub:function(){function bJ(bL,bM){return new bJ.fn.init(bL,bM)}bn.extend(true,bJ,this);bJ.superclass=this;bJ.fn=bJ.prototype=this();bJ.fn.constructor=bJ;bJ.subclass=this.subclass;bJ.fn.init=function bK(bL,bM){if(bM&&bM instanceof bn&&!(bM instanceof bJ)){bM=bJ(bM)}return bn.fn.init.call(this,bL,bM,bI)};bJ.fn.init.prototype=bJ.fn;var bI=bJ(al);return bJ},browser:{}});bk=bn._Deferred();bn.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(bJ,bI){bg["[object "+bI+"]"]=bI.toLowerCase()});bE=bn.uaMatch(bG);if(bE.browser){bn.browser[bE.browser]=true;bn.browser.version=bE.version}if(bn.browser.webkit){bn.browser.safari=true}if(be){bn.inArray=function(bI,bJ){return be.call(bJ,bI)}}if(bv.test("\xA0")){br=/^[\s\xA0]+/;bm=/[\s\xA0]+$/}bl=bn(al);if(al.addEventListener){bd=function(){al.removeEventListener("DOMContentLoaded",bd,false);bn.ready()}}else{if(al.attachEvent){bd=function(){if(al.readyState==="complete"){al.detachEvent("onreadystatechange",bd);bn.ready()}}}}function bf(){if(bn.isReady){return}try{al.documentElement.doScroll("left")}catch(bI){setTimeout(bf,1);return}bn.ready()}return bn})();(function(){a.support={};var bd=al.createElement("div");bd.style.display="none";bd.innerHTML=" <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";var bm=bd.getElementsByTagName("*"),bk=bd.getElementsByTagName("a")[0],bl=al.createElement("select"),be=bl.appendChild(al.createElement("option")),bj=bd.getElementsByTagName("input")[0];if(!bm||!bm.length||!bk){return}a.support={leadingWhitespace:bd.firstChild.nodeType===3,tbody:!bd.getElementsByTagName("tbody").length,htmlSerialize:!!bd.getElementsByTagName("link").length,style:/red/.test(bk.getAttribute("style")),hrefNormalized:bk.getAttribute("href")==="/a",opacity:/^0.55$/.test(bk.style.opacity),cssFloat:!!bk.style.cssFloat,checkOn:bj.value==="on",optSelected:be.selected,deleteExpando:true,optDisabled:false,checkClone:false,noCloneEvent:true,noCloneChecked:true,boxModel:null,inlineBlockNeedsLayout:false,shrinkWrapBlocks:false,reliableHiddenOffsets:true};bj.checked=true;a.support.noCloneChecked=bj.cloneNode(true).checked;bl.disabled=true;a.support.optDisabled=!be.disabled;var bf=null;a.support.scriptEval=function(){if(bf===null){var bo=al.documentElement,bp=al.createElement("script"),br="script"+a.now();try{bp.appendChild(al.createTextNode("window."+br+"=1;"))}catch(bq){}bo.insertBefore(bp,bo.firstChild);if(aY[br]){bf=true;delete aY[br]}else{bf=false}bo.removeChild(bp);bo=bp=br=null}return bf};try{delete bd.test}catch(bh){a.support.deleteExpando=false}if(!bd.addEventListener&&bd.attachEvent&&bd.fireEvent){bd.attachEvent("onclick",function bn(){a.support.noCloneEvent=false;bd.detachEvent("onclick",bn)});bd.cloneNode(true).fireEvent("onclick")}bd=al.createElement("div");bd.innerHTML="<input type='radio' name='radiotest' checked='checked'/>";var bg=al.createDocumentFragment();bg.appendChild(bd.firstChild);a.support.checkClone=bg.cloneNode(true).cloneNode(true).lastChild.checked;a(function(){var bp=al.createElement("div"),e=al.getElementsByTagName("body")[0];if(!e){return}bp.style.width=bp.style.paddingLeft="1px";e.appendChild(bp);a.boxModel=a.support.boxModel=bp.offsetWidth===2;if("zoom" in bp.style){bp.style.display="inline";bp.style.zoom=1;a.support.inlineBlockNeedsLayout=bp.offsetWidth===2;bp.style.display="";bp.innerHTML="<div style='width:4px;'></div>";a.support.shrinkWrapBlocks=bp.offsetWidth!==2}bp.innerHTML="<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>";var bo=bp.getElementsByTagName("td");a.support.reliableHiddenOffsets=bo[0].offsetHeight===0;bo[0].style.display="";bo[1].style.display="none";a.support.reliableHiddenOffsets=a.support.reliableHiddenOffsets&&bo[0].offsetHeight===0;bp.innerHTML="";e.removeChild(bp).style.display="none";bp=bo=null});var bi=function(e){var bp=al.createElement("div");e="on"+e;if(!bp.attachEvent){return true}var bo=(e in bp);if(!bo){bp.setAttribute(e,"return;");bo=typeof bp[e]==="function"}bp=null;return bo};a.support.submitBubbles=bi("submit");a.support.changeBubbles=bi("change");bd=bm=bk=null})();var aE=/^(?:\{.*\}|\[.*\])$/;a.extend({cache:{},uuid:0,expando:"jQuery"+(a.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:true,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:true},hasData:function(e){e=e.nodeType?a.cache[e[a.expando]]:e[a.expando];return !!e&&!P(e)},data:function(bf,bd,bh,bg){if(!a.acceptData(bf)){return}var bk=a.expando,bj=typeof bd==="string",bi,bl=bf.nodeType,e=bl?a.cache:bf,be=bl?bf[a.expando]:bf[a.expando]&&a.expando;if((!be||(bg&&be&&!e[be][bk]))&&bj&&bh===H){return}if(!be){if(bl){bf[a.expando]=be=++a.uuid}else{be=a.expando}}if(!e[be]){e[be]={};if(!bl){e[be].toJSON=a.noop}}if(typeof bd==="object"||typeof bd==="function"){if(bg){e[be][bk]=a.extend(e[be][bk],bd)}else{e[be]=a.extend(e[be],bd)}}bi=e[be];if(bg){if(!bi[bk]){bi[bk]={}}bi=bi[bk]}if(bh!==H){bi[bd]=bh}if(bd==="events"&&!bi[bd]){return bi[bk]&&bi[bk].events}return bj?bi[bd]:bi},removeData:function(bg,be,bh){if(!a.acceptData(bg)){return}var bj=a.expando,bk=bg.nodeType,bd=bk?a.cache:bg,bf=bk?bg[a.expando]:a.expando;if(!bd[bf]){return}if(be){var bi=bh?bd[bf][bj]:bd[bf];if(bi){delete bi[be];if(!P(bi)){return}}}if(bh){delete bd[bf][bj];if(!P(bd[bf])){return}}var e=bd[bf][bj];if(a.support.deleteExpando||bd!=aY){delete bd[bf]}else{bd[bf]=null}if(e){bd[bf]={};if(!bk){bd[bf].toJSON=a.noop}bd[bf][bj]=e}else{if(bk){if(a.support.deleteExpando){delete bg[a.expando]}else{if(bg.removeAttribute){bg.removeAttribute(a.expando)}else{bg[a.expando]=null}}}}},_data:function(bd,e,be){return a.data(bd,e,be,true)},acceptData:function(bd){if(bd.nodeName){var e=a.noData[bd.nodeName.toLowerCase()];if(e){return !(e===true||bd.getAttribute("classid")!==e)}}return true}});a.fn.extend({data:function(bg,bi){var bh=null;if(typeof bg==="undefined"){if(this.length){bh=a.data(this[0]);if(this[0].nodeType===1){var e=this[0].attributes,be;for(var bf=0,bd=e.length;bf<bd;bf++){be=e[bf].name;if(be.indexOf("data-")===0){be=be.substr(5);aT(this[0],be,bh[be])}}}}return bh}else{if(typeof bg==="object"){return this.each(function(){a.data(this,bg)})}}var bj=bg.split(".");bj[1]=bj[1]?"."+bj[1]:"";if(bi===H){bh=this.triggerHandler("getData"+bj[1]+"!",[bj[0]]);if(bh===H&&this.length){bh=a.data(this[0],bg);bh=aT(this[0],bg,bh)}return bh===H&&bj[1]?this.data(bj[0]):bh}else{return this.each(function(){var bl=a(this),bk=[bj[0],bi];bl.triggerHandler("setData"+bj[1]+"!",bk);a.data(this,bg,bi);bl.triggerHandler("changeData"+bj[1]+"!",bk)})}},removeData:function(e){return this.each(function(){a.removeData(this,e)})}});function aT(be,bd,bf){if(bf===H&&be.nodeType===1){bf=be.getAttribute("data-"+bd);if(typeof bf==="string"){try{bf=bf==="true"?true:bf==="false"?false:bf==="null"?null:!a.isNaN(bf)?parseFloat(bf):aE.test(bf)?a.parseJSON(bf):bf}catch(bg){}a.data(be,bd,bf)}else{bf=H}}return bf}function P(bd){for(var e in bd){if(e!=="toJSON"){return false}}return true}a.extend({queue:function(bd,e,bf){if(!bd){return}e=(e||"fx")+"queue";var be=a._data(bd,e);if(!bf){return be||[]}if(!be||a.isArray(bf)){be=a._data(bd,e,a.makeArray(bf))}else{be.push(bf)}return be},dequeue:function(bf,be){be=be||"fx";var e=a.queue(bf,be),bd=e.shift();if(bd==="inprogress"){bd=e.shift()}if(bd){if(be==="fx"){e.unshift("inprogress")}bd.call(bf,function(){a.dequeue(bf,be)})}if(!e.length){a.removeData(bf,be+"queue",true)}}});a.fn.extend({queue:function(e,bd){if(typeof e!=="string"){bd=e;e="fx"}if(bd===H){return a.queue(this[0],e)}return this.each(function(bf){var be=a.queue(this,e,bd);if(e==="fx"&&be[0]!=="inprogress"){a.dequeue(this,e)}})},dequeue:function(e){return this.each(function(){a.dequeue(this,e)})},delay:function(bd,e){bd=a.fx?a.fx.speeds[bd]||bd:bd;e=e||"fx";return this.queue(e,function(){var be=this;setTimeout(function(){a.dequeue(be,e)},bd)})},clearQueue:function(e){return this.queue(e||"fx",[])}});var aC=/[\n\t\r]/g,a3=/\s+/,aG=/\r/g,a2=/^(?:href|src|style)$/,f=/^(?:button|input)$/i,C=/^(?:button|input|object|select|textarea)$/i,k=/^a(?:rea)?$/i,Q=/^(?:radio|checkbox)$/i;a.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};a.fn.extend({attr:function(e,bd){return a.access(this,e,bd,true,a.attr)},removeAttr:function(e,bd){return this.each(function(){a.attr(this,e,"");if(this.nodeType===1){this.removeAttribute(e)}})},addClass:function(bj){if(a.isFunction(bj)){return this.each(function(bm){var bl=a(this);bl.addClass(bj.call(this,bm,bl.attr("class")))})}if(bj&&typeof bj==="string"){var e=(bj||"").split(a3);for(var bf=0,be=this.length;bf<be;bf++){var bd=this[bf];if(bd.nodeType===1){if(!bd.className){bd.className=bj}else{var bg=" "+bd.className+" ",bi=bd.className;for(var bh=0,bk=e.length;bh<bk;bh++){if(bg.indexOf(" "+e[bh]+" ")<0){bi+=" "+e[bh]}}bd.className=a.trim(bi)}}}}return this},removeClass:function(bh){if(a.isFunction(bh)){return this.each(function(bl){var bk=a(this);bk.removeClass(bh.call(this,bl,bk.attr("class")))})}if((bh&&typeof bh==="string")||bh===H){var bi=(bh||"").split(a3);for(var be=0,bd=this.length;be<bd;be++){var bg=this[be];if(bg.nodeType===1&&bg.className){if(bh){var bf=(" "+bg.className+" ").replace(aC," ");for(var bj=0,e=bi.length;bj<e;bj++){bf=bf.replace(" "+bi[bj]+" "," ")}bg.className=a.trim(bf)}else{bg.className=""}}}}return this},toggleClass:function(bf,bd){var be=typeof bf,e=typeof bd==="boolean";if(a.isFunction(bf)){return this.each(function(bh){var bg=a(this);bg.toggleClass(bf.call(this,bh,bg.attr("class"),bd),bd)})}return this.each(function(){if(be==="string"){var bi,bh=0,bg=a(this),bj=bd,bk=bf.split(a3);while((bi=bk[bh++])){bj=e?bj:!bg.hasClass(bi);bg[bj?"addClass":"removeClass"](bi)}}else{if(be==="undefined"||be==="boolean"){if(this.className){a._data(this,"__className__",this.className)}this.className=this.className||bf===false?"":a._data(this,"__className__")||""}}})},hasClass:function(e){var bf=" "+e+" ";for(var be=0,bd=this.length;be<bd;be++){if((" "+this[be].className+" ").replace(aC," ").indexOf(bf)>-1){return true}}return false},val:function(bk){if(!arguments.length){var be=this[0];if(be){if(a.nodeName(be,"option")){var bd=be.attributes.value;return !bd||bd.specified?be.value:be.text}if(a.nodeName(be,"select")){var bi=be.selectedIndex,bl=[],bm=be.options,bh=be.type==="select-one";if(bi<0){return null}for(var bf=bh?bi:0,bj=bh?bi+1:bm.length;bf<bj;bf++){var bg=bm[bf];if(bg.selected&&(a.support.optDisabled?!bg.disabled:bg.getAttribute("disabled")===null)&&(!bg.parentNode.disabled||!a.nodeName(bg.parentNode,"optgroup"))){bk=a(bg).val();if(bh){return bk}bl.push(bk)}}if(bh&&!bl.length&&bm.length){return a(bm[bi]).val()}return bl}if(Q.test(be.type)&&!a.support.checkOn){return be.getAttribute("value")===null?"on":be.value}return(be.value||"").replace(aG,"")}return H}var e=a.isFunction(bk);return this.each(function(bp){var bo=a(this),bq=bk;if(this.nodeType!==1){return}if(e){bq=bk.call(this,bp,bo.val())}if(bq==null){bq=""}else{if(typeof bq==="number"){bq+=""}else{if(a.isArray(bq)){bq=a.map(bq,function(br){return br==null?"":br+""})}}}if(a.isArray(bq)&&Q.test(this.type)){this.checked=a.inArray(bo.val(),bq)>=0}else{if(a.nodeName(this,"select")){var bn=a.makeArray(bq);a("option",this).each(function(){this.selected=a.inArray(a(this).val(),bn)>=0});if(!bn.length){this.selectedIndex=-1}}else{this.value=bq}}})}});a.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(bd,e,bi,bl){if(!bd||bd.nodeType===3||bd.nodeType===8||bd.nodeType===2){return H}if(bl&&e in a.attrFn){return a(bd)[e](bi)}var be=bd.nodeType!==1||!a.isXMLDoc(bd),bh=bi!==H;e=be&&a.props[e]||e;if(bd.nodeType===1){var bg=a2.test(e);if(e==="selected"&&!a.support.optSelected){var bj=bd.parentNode;if(bj){bj.selectedIndex;if(bj.parentNode){bj.parentNode.selectedIndex}}}if((e in bd||bd[e]!==H)&&be&&!bg){if(bh){if(e==="type"&&f.test(bd.nodeName)&&bd.parentNode){a.error("type property can't be changed")}if(bi===null){if(bd.nodeType===1){bd.removeAttribute(e)}}else{bd[e]=bi}}if(a.nodeName(bd,"form")&&bd.getAttributeNode(e)){return bd.getAttributeNode(e).nodeValue}if(e==="tabIndex"){var bk=bd.getAttributeNode("tabIndex");return bk&&bk.specified?bk.value:C.test(bd.nodeName)||k.test(bd.nodeName)&&bd.href?0:H}return bd[e]}if(!a.support.style&&be&&e==="style"){if(bh){bd.style.cssText=""+bi}return bd.style.cssText}if(bh){bd.setAttribute(e,""+bi)}if(!bd.attributes[e]&&(bd.hasAttribute&&!bd.hasAttribute(e))){return H}var bf=!a.support.hrefNormalized&&be&&bg?bd.getAttribute(e,2):bd.getAttribute(e);return bf===null?H:bf}if(bh){bd[e]=bi}return bd[e]}});var aP=/\.(.*)$/,a0=/^(?:textarea|input|select)$/i,K=/\./g,aa=/ /g,aw=/[^\w\s.|`]/g,E=function(e){return e.replace(aw,"\\$&")};a.event={add:function(bg,bk,br,bi){if(bg.nodeType===3||bg.nodeType===8){return}try{if(a.isWindow(bg)&&(bg!==aY&&!bg.frameElement)){bg=aY}}catch(bl){}if(br===false){br=a5}else{if(!br){return}}var be,bp;if(br.handler){be=br;br=be.handler}if(!br.guid){br.guid=a.guid++}var bm=a._data(bg);if(!bm){return}var bq=bm.events,bj=bm.handle;if(!bq){bm.events=bq={}}if(!bj){bm.handle=bj=function(){return typeof a!=="undefined"&&!a.event.triggered?a.event.handle.apply(bj.elem,arguments):H}}bj.elem=bg;bk=bk.split(" ");var bo,bh=0,bd;while((bo=bk[bh++])){bp=be?a.extend({},be):{handler:br,data:bi};if(bo.indexOf(".")>-1){bd=bo.split(".");bo=bd.shift();bp.namespace=bd.slice(0).sort().join(".")}else{bd=[];bp.namespace=""}bp.type=bo;if(!bp.guid){bp.guid=br.guid}var bf=bq[bo],bn=a.event.special[bo]||{};if(!bf){bf=bq[bo]=[];if(!bn.setup||bn.setup.call(bg,bi,bd,bj)===false){if(bg.addEventListener){bg.addEventListener(bo,bj,false)}else{if(bg.attachEvent){bg.attachEvent("on"+bo,bj)}}}}if(bn.add){bn.add.call(bg,bp);if(!bp.handler.guid){bp.handler.guid=br.guid}}bf.push(bp);a.event.global[bo]=true}bg=null},global:{},remove:function(br,bm,be,bi){if(br.nodeType===3||br.nodeType===8){return}if(be===false){be=a5}var bu,bh,bj,bo,bp=0,bf,bk,bn,bg,bl,e,bt,bq=a.hasData(br)&&a._data(br),bd=bq&&bq.events;if(!bq||!bd){return}if(bm&&bm.type){be=bm.handler;bm=bm.type}if(!bm||typeof bm==="string"&&bm.charAt(0)==="."){bm=bm||"";for(bh in bd){a.event.remove(br,bh+bm)}return}bm=bm.split(" ");while((bh=bm[bp++])){bt=bh;e=null;bf=bh.indexOf(".")<0;bk=[];if(!bf){bk=bh.split(".");bh=bk.shift();bn=new RegExp("(^|\\.)"+a.map(bk.slice(0).sort(),E).join("\\.(?:.*\\.)?")+"(\\.|$)")}bl=bd[bh];if(!bl){continue}if(!be){for(bo=0;bo<bl.length;bo++){e=bl[bo];if(bf||bn.test(e.namespace)){a.event.remove(br,bt,e.handler,bo);bl.splice(bo--,1)}}continue}bg=a.event.special[bh]||{};for(bo=bi||0;bo<bl.length;bo++){e=bl[bo];if(be.guid===e.guid){if(bf||bn.test(e.namespace)){if(bi==null){bl.splice(bo--,1)}if(bg.remove){bg.remove.call(br,e)}}if(bi!=null){break}}}if(bl.length===0||bi!=null&&bl.length===1){if(!bg.teardown||bg.teardown.call(br,bk)===false){a.removeEvent(br,bh,bq.handle)}bu=null;delete bd[bh]}}if(a.isEmptyObject(bd)){var bs=bq.handle;if(bs){bs.elem=null}delete bq.events;delete bq.handle;if(a.isEmptyObject(bq)){a.removeData(br,H,true)}}},trigger:function(bd,bi,bf){var bm=bd.type||bd,bh=arguments[3];if(!bh){bd=typeof bd==="object"?bd[a.expando]?bd:a.extend(a.Event(bm),bd):a.Event(bm);if(bm.indexOf("!")>=0){bd.type=bm=bm.slice(0,-1);bd.exclusive=true}if(!bf){bd.stopPropagation();if(a.event.global[bm]){a.each(a.cache,function(){var br=a.expando,bq=this[br];if(bq&&bq.events&&bq.events[bm]){a.event.trigger(bd,bi,bq.handle.elem)}})}}if(!bf||bf.nodeType===3||bf.nodeType===8){return H}bd.result=H;bd.target=bf;bi=a.makeArray(bi);bi.unshift(bd)}bd.currentTarget=bf;var bj=a._data(bf,"handle");if(bj){bj.apply(bf,bi)}var bo=bf.parentNode||bf.ownerDocument;try{if(!(bf&&bf.nodeName&&a.noData[bf.nodeName.toLowerCase()])){if(bf["on"+bm]&&bf["on"+bm].apply(bf,bi)===false){bd.result=false;bd.preventDefault()}}}catch(bn){}if(!bd.isPropagationStopped()&&bo){a.event.trigger(bd,bi,bo,true)}else{if(!bd.isDefaultPrevented()){var be,bk=bd.target,e=bm.replace(aP,""),bp=a.nodeName(bk,"a")&&e==="click",bl=a.event.special[e]||{};if((!bl._default||bl._default.call(bf,bd)===false)&&!bp&&!(bk&&bk.nodeName&&a.noData[bk.nodeName.toLowerCase()])){try{if(bk[e]){be=bk["on"+e];if(be){bk["on"+e]=null}a.event.triggered=true;bk[e]()}}catch(bg){}if(be){bk["on"+e]=be}a.event.triggered=false}}}},handle:function(e){var bl,be,bd,bn,bm,bh=[],bj=a.makeArray(arguments);e=bj[0]=a.event.fix(e||aY.event);e.currentTarget=this;bl=e.type.indexOf(".")<0&&!e.exclusive;if(!bl){bd=e.type.split(".");e.type=bd.shift();bh=bd.slice(0).sort();bn=new RegExp("(^|\\.)"+bh.join("\\.(?:.*\\.)?")+"(\\.|$)")}e.namespace=e.namespace||bh.join(".");bm=a._data(this,"events");be=(bm||{})[e.type];if(bm&&be){be=be.slice(0);for(var bg=0,bf=be.length;bg<bf;bg++){var bk=be[bg];if(bl||bn.test(bk.namespace)){e.handler=bk.handler;e.data=bk.data;e.handleObj=bk;var bi=bk.handler.apply(this,bj);if(bi!==H){e.result=bi;if(bi===false){e.preventDefault();e.stopPropagation()}}if(e.isImmediatePropagationStopped()){break}}}}return e.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(bf){if(bf[a.expando]){return bf}var bd=bf;bf=a.Event(bd);for(var be=this.props.length,bh;be;){bh=this.props[--be];bf[bh]=bd[bh]}if(!bf.target){bf.target=bf.srcElement||al}if(bf.target.nodeType===3){bf.target=bf.target.parentNode}if(!bf.relatedTarget&&bf.fromElement){bf.relatedTarget=bf.fromElement===bf.target?bf.toElement:bf.fromElement}if(bf.pageX==null&&bf.clientX!=null){var bg=al.documentElement,e=al.body;bf.pageX=bf.clientX+(bg&&bg.scrollLeft||e&&e.scrollLeft||0)-(bg&&bg.clientLeft||e&&e.clientLeft||0);bf.pageY=bf.clientY+(bg&&bg.scrollTop||e&&e.scrollTop||0)-(bg&&bg.clientTop||e&&e.clientTop||0)}if(bf.which==null&&(bf.charCode!=null||bf.keyCode!=null)){bf.which=bf.charCode!=null?bf.charCode:bf.keyCode}if(!bf.metaKey&&bf.ctrlKey){bf.metaKey=bf.ctrlKey}if(!bf.which&&bf.button!==H){bf.which=(bf.button&1?1:(bf.button&2?3:(bf.button&4?2:0)))}return bf},guid:100000000,proxy:a.proxy,special:{ready:{setup:a.bindReady,teardown:a.noop},live:{add:function(e){a.event.add(this,n(e.origType,e.selector),a.extend({},e,{handler:af,guid:e.handler.guid}))},remove:function(e){a.event.remove(this,n(e.origType,e.selector),e)}},beforeunload:{setup:function(be,bd,e){if(a.isWindow(this)){this.onbeforeunload=e}},teardown:function(bd,e){if(this.onbeforeunload===e){this.onbeforeunload=null}}}}};a.removeEvent=al.removeEventListener?function(bd,e,be){if(bd.removeEventListener){bd.removeEventListener(e,be,false)}}:function(bd,e,be){if(bd.detachEvent){bd.detachEvent("on"+e,be)}};a.Event=function(e){if(!this.preventDefault){return new a.Event(e)}if(e&&e.type){this.originalEvent=e;this.type=e.type;this.isDefaultPrevented=(e.defaultPrevented||e.returnValue===false||e.getPreventDefault&&e.getPreventDefault())?h:a5}else{this.type=e}this.timeStamp=a.now();this[a.expando]=true};function a5(){return false}function h(){return true}a.Event.prototype={preventDefault:function(){this.isDefaultPrevented=h;var bd=this.originalEvent;if(!bd){return}if(bd.preventDefault){bd.preventDefault()}else{bd.returnValue=false}},stopPropagation:function(){this.isPropagationStopped=h;var bd=this.originalEvent;if(!bd){return}if(bd.stopPropagation){bd.stopPropagation()}bd.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=h;this.stopPropagation()},isDefaultPrevented:a5,isPropagationStopped:a5,isImmediatePropagationStopped:a5};var Z=function(be){var bd=be.relatedTarget;try{if(bd!==al&&!bd.parentNode){return}while(bd&&bd!==this){bd=bd.parentNode}if(bd!==this){be.type=be.data;a.event.handle.apply(this,arguments)}}catch(bf){}},aK=function(e){e.type=e.data;a.event.handle.apply(this,arguments)};a.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(bd,e){a.event.special[bd]={setup:function(be){a.event.add(this,e,be&&be.selector?aK:Z,bd)},teardown:function(be){a.event.remove(this,e,be&&be.selector?aK:Z)}}});if(!a.support.submitBubbles){a.event.special.submit={setup:function(bd,e){if(this.nodeName&&this.nodeName.toLowerCase()!=="form"){a.event.add(this,"click.specialSubmit",function(bg){var bf=bg.target,be=bf.type;if((be==="submit"||be==="image")&&a(bf).closest("form").length){aN("submit",this,arguments)}});a.event.add(this,"keypress.specialSubmit",function(bg){var bf=bg.target,be=bf.type;if((be==="text"||be==="password")&&a(bf).closest("form").length&&bg.keyCode===13){aN("submit",this,arguments)}})}else{return false}},teardown:function(e){a.event.remove(this,".specialSubmit")}}}if(!a.support.changeBubbles){var a6,j=function(bd){var e=bd.type,be=bd.value;if(e==="radio"||e==="checkbox"){be=bd.checked}else{if(e==="select-multiple"){be=bd.selectedIndex>-1?a.map(bd.options,function(bf){return bf.selected}).join("-"):""}else{if(bd.nodeName.toLowerCase()==="select"){be=bd.selectedIndex}}}return be},X=function X(bf){var bd=bf.target,be,bg;if(!a0.test(bd.nodeName)||bd.readOnly){return}be=a._data(bd,"_change_data");bg=j(bd);if(bf.type!=="focusout"||bd.type!=="radio"){a._data(bd,"_change_data",bg)}if(be===H||bg===be){return}if(be!=null||bg){bf.type="change";bf.liveFired=H;a.event.trigger(bf,arguments[1],bd)}};a.event.special.change={filters:{focusout:X,beforedeactivate:X,click:function(bf){var be=bf.target,bd=be.type;if(bd==="radio"||bd==="checkbox"||be.nodeName.toLowerCase()==="select"){X.call(this,bf)}},keydown:function(bf){var be=bf.target,bd=be.type;if((bf.keyCode===13&&be.nodeName.toLowerCase()!=="textarea")||(bf.keyCode===32&&(bd==="checkbox"||bd==="radio"))||bd==="select-multiple"){X.call(this,bf)}},beforeactivate:function(be){var bd=be.target;a._data(bd,"_change_data",j(bd))}},setup:function(be,bd){if(this.type==="file"){return false}for(var e in a6){a.event.add(this,e+".specialChange",a6[e])}return a0.test(this.nodeName)},teardown:function(e){a.event.remove(this,".specialChange");return a0.test(this.nodeName)}};a6=a.event.special.change.filters;a6.focus=a6.beforeactivate}function aN(bd,bf,e){var be=a.extend({},e[0]);be.type=bd;be.originalEvent={};be.liveFired=H;a.event.handle.call(bf,be);if(be.isDefaultPrevented()){e[0].preventDefault()}}if(al.addEventListener){a.each({focus:"focusin",blur:"focusout"},function(be,e){a.event.special[e]={setup:function(){this.addEventListener(be,bd,true)},teardown:function(){this.removeEventListener(be,bd,true)}};function bd(bf){bf=a.event.fix(bf);bf.type=e;return a.event.handle.call(this,bf)}})}a.each(["bind","one"],function(bd,e){a.fn[e]=function(bj,bk,bi){if(typeof bj==="object"){for(var bg in bj){this[e](bg,bk,bj[bg],bi)}return this}if(a.isFunction(bk)||bk===false){bi=bk;bk=H}var bh=e==="one"?a.proxy(bi,function(bl){a(this).unbind(bl,bh);return bi.apply(this,arguments)}):bi;if(bj==="unload"&&e!=="one"){this.one(bj,bk,bi)}else{for(var bf=0,be=this.length;bf<be;bf++){a.event.add(this[bf],bj,bh,bk)}}return this}});a.fn.extend({unbind:function(bg,bf){if(typeof bg==="object"&&!bg.preventDefault){for(var be in bg){this.unbind(be,bg[be])}}else{for(var bd=0,e=this.length;bd<e;bd++){a.event.remove(this[bd],bg,bf)}}return this},delegate:function(e,bd,bf,be){return this.live(bd,bf,be,e)},undelegate:function(e,bd,be){if(arguments.length===0){return this.unbind("live")}else{return this.die(bd,null,be,e)}},trigger:function(e,bd){return this.each(function(){a.event.trigger(e,bd,this)})},triggerHandler:function(e,be){if(this[0]){var bd=a.Event(e);bd.preventDefault();bd.stopPropagation();a.event.trigger(bd,be,this[0]);return bd.result}},toggle:function(be){var e=arguments,bd=1;while(bd<e.length){a.proxy(be,e[bd++])}return this.click(a.proxy(be,function(bf){var bg=(a._data(this,"lastToggle"+be.guid)||0)%bd;a._data(this,"lastToggle"+be.guid,bg+1);bf.preventDefault();return e[bg].apply(this,arguments)||false}))},hover:function(e,bd){return this.mouseenter(e).mouseleave(bd||e)}});var aH={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};a.each(["live","die"],function(bd,e){a.fn[e]=function(bn,bk,bp,bg){var bo,bl=0,bm,bf,br,bi=bg||this.selector,be=bg?this:a(this.context);if(typeof bn==="object"&&!bn.preventDefault){for(var bq in bn){be[e](bq,bk,bn[bq],bi)}return this}if(a.isFunction(bk)){bp=bk;bk=H}bn=(bn||"").split(" ");while((bo=bn[bl++])!=null){bm=aP.exec(bo);bf="";if(bm){bf=bm[0];bo=bo.replace(aP,"")}if(bo==="hover"){bn.push("mouseenter"+bf,"mouseleave"+bf);continue}br=bo;if(bo==="focus"||bo==="blur"){bn.push(aH[bo]+bf);bo=bo+bf}else{bo=(aH[bo]||bo)+bf}if(e==="live"){for(var bj=0,bh=be.length;bj<bh;bj++){a.event.add(be[bj],"live."+n(bo,bi),{data:bk,selector:bi,handler:bp,origType:bo,origHandler:bp,preType:br})}}else{be.unbind("live."+n(bo,bi),bp)}}return this}});function af(bn){var bk,bf,bt,bh,e,bp,bm,bo,bl,bs,bj,bi,br,bq=[],bg=[],bd=a._data(this,"events");if(bn.liveFired===this||!bd||!bd.live||bn.target.disabled||bn.button&&bn.type==="click"){return}if(bn.namespace){bi=new RegExp("(^|\\.)"+bn.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)")}bn.liveFired=this;var be=bd.live.slice(0);for(bm=0;bm<be.length;bm++){e=be[bm];if(e.origType.replace(aP,"")===bn.type){bg.push(e.selector)}else{be.splice(bm--,1)}}bh=a(bn.target).closest(bg,bn.currentTarget);for(bo=0,bl=bh.length;bo<bl;bo++){bj=bh[bo];for(bm=0;bm<be.length;bm++){e=be[bm];if(bj.selector===e.selector&&(!bi||bi.test(e.namespace))&&!bj.elem.disabled){bp=bj.elem;bt=null;if(e.preType==="mouseenter"||e.preType==="mouseleave"){bn.type=e.preType;bt=a(bn.relatedTarget).closest(e.selector)[0]}if(!bt||bt!==bp){bq.push({elem:bp,handleObj:e,level:bj.level})}}}}for(bo=0,bl=bq.length;bo<bl;bo++){bh=bq[bo];if(bf&&bh.level>bf){break}bn.currentTarget=bh.elem;bn.data=bh.handleObj.data;bn.handleObj=bh.handleObj;br=bh.handleObj.origHandler.apply(bh.elem,arguments);if(br===false||bn.isPropagationStopped()){bf=bh.level;if(br===false){bk=false}if(bn.isImmediatePropagationStopped()){break}}}return bk}function n(bd,e){return(bd&&bd!=="*"?bd+".":"")+e.replace(K,"`").replace(aa,"&")}a.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(bd,e){a.fn[e]=function(bf,be){if(be==null){be=bf;bf=null}return arguments.length>0?this.bind(e,bf,be):this.trigger(e)};if(a.attrFn){a.attrFn[e]=true}});
17
+ /*
18
+ * Sizzle CSS Selector Engine
19
+ * Copyright 2011, The Dojo Foundation
20
+ * Released under the MIT, BSD, and GPL Licenses.
21
+ * More information: http://sizzlejs.com/
22
+ */
23
+ (function(){var bn=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,bo=0,br=Object.prototype.toString,bi=false,bh=true,bp=/\\/g,bv=/\W/;[0,0].sort(function(){bh=false;return 0});var bf=function(bA,e,bD,bE){bD=bD||[];e=e||al;var bG=e;if(e.nodeType!==1&&e.nodeType!==9){return[]}if(!bA||typeof bA!=="string"){return bD}var bx,bI,bL,bw,bH,bK,bJ,bC,bz=true,by=bf.isXML(e),bB=[],bF=bA;do{bn.exec("");bx=bn.exec(bF);if(bx){bF=bx[3];bB.push(bx[1]);if(bx[2]){bw=bx[3];break}}}while(bx);if(bB.length>1&&bj.exec(bA)){if(bB.length===2&&bk.relative[bB[0]]){bI=bs(bB[0]+bB[1],e)}else{bI=bk.relative[bB[0]]?[e]:bf(bB.shift(),e);while(bB.length){bA=bB.shift();if(bk.relative[bA]){bA+=bB.shift()}bI=bs(bA,bI)}}}else{if(!bE&&bB.length>1&&e.nodeType===9&&!by&&bk.match.ID.test(bB[0])&&!bk.match.ID.test(bB[bB.length-1])){bH=bf.find(bB.shift(),e,by);e=bH.expr?bf.filter(bH.expr,bH.set)[0]:bH.set[0]}if(e){bH=bE?{expr:bB.pop(),set:bl(bE)}:bf.find(bB.pop(),bB.length===1&&(bB[0]==="~"||bB[0]==="+")&&e.parentNode?e.parentNode:e,by);bI=bH.expr?bf.filter(bH.expr,bH.set):bH.set;if(bB.length>0){bL=bl(bI)}else{bz=false}while(bB.length){bK=bB.pop();bJ=bK;if(!bk.relative[bK]){bK=""}else{bJ=bB.pop()}if(bJ==null){bJ=e}bk.relative[bK](bL,bJ,by)}}else{bL=bB=[]}}if(!bL){bL=bI}if(!bL){bf.error(bK||bA)}if(br.call(bL)==="[object Array]"){if(!bz){bD.push.apply(bD,bL)}else{if(e&&e.nodeType===1){for(bC=0;bL[bC]!=null;bC++){if(bL[bC]&&(bL[bC]===true||bL[bC].nodeType===1&&bf.contains(e,bL[bC]))){bD.push(bI[bC])}}}else{for(bC=0;bL[bC]!=null;bC++){if(bL[bC]&&bL[bC].nodeType===1){bD.push(bI[bC])}}}}}else{bl(bL,bD)}if(bw){bf(bw,bG,bD,bE);bf.uniqueSort(bD)}return bD};bf.uniqueSort=function(bw){if(bq){bi=bh;bw.sort(bq);if(bi){for(var e=1;e<bw.length;e++){if(bw[e]===bw[e-1]){bw.splice(e--,1)}}}}return bw};bf.matches=function(e,bw){return bf(e,null,null,bw)};bf.matchesSelector=function(e,bw){return bf(bw,null,null,[e]).length>0};bf.find=function(bC,e,bD){var bB;if(!bC){return[]}for(var by=0,bx=bk.order.length;by<bx;by++){var bz,bA=bk.order[by];if((bz=bk.leftMatch[bA].exec(bC))){var bw=bz[1];bz.splice(1,1);if(bw.substr(bw.length-1)!=="\\"){bz[1]=(bz[1]||"").replace(bp,"");bB=bk.find[bA](bz,e,bD);if(bB!=null){bC=bC.replace(bk.match[bA],"");break}}}}if(!bB){bB=typeof e.getElementsByTagName!=="undefined"?e.getElementsByTagName("*"):[]}return{set:bB,expr:bC}};bf.filter=function(bG,bF,bJ,bz){var bB,e,bx=bG,bL=[],bD=bF,bC=bF&&bF[0]&&bf.isXML(bF[0]);while(bG&&bF.length){for(var bE in bk.filter){if((bB=bk.leftMatch[bE].exec(bG))!=null&&bB[2]){var bK,bI,bw=bk.filter[bE],by=bB[1];e=false;bB.splice(1,1);if(by.substr(by.length-1)==="\\"){continue}if(bD===bL){bL=[]}if(bk.preFilter[bE]){bB=bk.preFilter[bE](bB,bD,bJ,bL,bz,bC);if(!bB){e=bK=true}else{if(bB===true){continue}}}if(bB){for(var bA=0;(bI=bD[bA])!=null;bA++){if(bI){bK=bw(bI,bB,bA,bD);var bH=bz^!!bK;if(bJ&&bK!=null){if(bH){e=true}else{bD[bA]=false}}else{if(bH){bL.push(bI);e=true}}}}}if(bK!==H){if(!bJ){bD=bL}bG=bG.replace(bk.match[bE],"");if(!e){return[]}break}}}if(bG===bx){if(e==null){bf.error(bG)}else{break}}bx=bG}return bD};bf.error=function(e){throw"Syntax error, unrecognized expression: "+e};var bk=bf.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|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(e){return e.getAttribute("href")},type:function(e){return e.getAttribute("type")}},relative:{"+":function(bB,bw){var by=typeof bw==="string",bA=by&&!bv.test(bw),bC=by&&!bA;if(bA){bw=bw.toLowerCase()}for(var bx=0,e=bB.length,bz;bx<e;bx++){if((bz=bB[bx])){while((bz=bz.previousSibling)&&bz.nodeType!==1){}bB[bx]=bC||bz&&bz.nodeName.toLowerCase()===bw?bz||false:bz===bw}}if(bC){bf.filter(bw,bB,true)}},">":function(bB,bw){var bA,bz=typeof bw==="string",bx=0,e=bB.length;if(bz&&!bv.test(bw)){bw=bw.toLowerCase();for(;bx<e;bx++){bA=bB[bx];if(bA){var by=bA.parentNode;bB[bx]=by.nodeName.toLowerCase()===bw?by:false}}}else{for(;bx<e;bx++){bA=bB[bx];if(bA){bB[bx]=bz?bA.parentNode:bA.parentNode===bw}}if(bz){bf.filter(bw,bB,true)}}},"":function(by,bw,bA){var bz,bx=bo++,e=bt;if(typeof bw==="string"&&!bv.test(bw)){bw=bw.toLowerCase();bz=bw;e=bd}e("parentNode",bw,bx,by,bz,bA)},"~":function(by,bw,bA){var bz,bx=bo++,e=bt;if(typeof bw==="string"&&!bv.test(bw)){bw=bw.toLowerCase();bz=bw;e=bd}e("previousSibling",bw,bx,by,bz,bA)}},find:{ID:function(bw,bx,by){if(typeof bx.getElementById!=="undefined"&&!by){var e=bx.getElementById(bw[1]);return e&&e.parentNode?[e]:[]}},NAME:function(bx,bA){if(typeof bA.getElementsByName!=="undefined"){var bw=[],bz=bA.getElementsByName(bx[1]);for(var by=0,e=bz.length;by<e;by++){if(bz[by].getAttribute("name")===bx[1]){bw.push(bz[by])}}return bw.length===0?null:bw}},TAG:function(e,bw){if(typeof bw.getElementsByTagName!=="undefined"){return bw.getElementsByTagName(e[1])}}},preFilter:{CLASS:function(by,bw,bx,e,bB,bC){by=" "+by[1].replace(bp,"")+" ";if(bC){return by}for(var bz=0,bA;(bA=bw[bz])!=null;bz++){if(bA){if(bB^(bA.className&&(" "+bA.className+" ").replace(/[\t\n\r]/g," ").indexOf(by)>=0)){if(!bx){e.push(bA)}}else{if(bx){bw[bz]=false}}}}return false},ID:function(e){return e[1].replace(bp,"")},TAG:function(bw,e){return bw[1].replace(bp,"").toLowerCase()},CHILD:function(e){if(e[1]==="nth"){if(!e[2]){bf.error(e[0])}e[2]=e[2].replace(/^\+|\s*/g,"");var bw=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(e[2]==="even"&&"2n"||e[2]==="odd"&&"2n+1"||!/\D/.test(e[2])&&"0n+"+e[2]||e[2]);e[2]=(bw[1]+(bw[2]||1))-0;e[3]=bw[3]-0}else{if(e[2]){bf.error(e[0])}}e[0]=bo++;return e},ATTR:function(bz,bw,bx,e,bA,bB){var by=bz[1]=bz[1].replace(bp,"");if(!bB&&bk.attrMap[by]){bz[1]=bk.attrMap[by]}bz[4]=(bz[4]||bz[5]||"").replace(bp,"");if(bz[2]==="~="){bz[4]=" "+bz[4]+" "}return bz},PSEUDO:function(bz,bw,bx,e,bA){if(bz[1]==="not"){if((bn.exec(bz[3])||"").length>1||/^\w/.test(bz[3])){bz[3]=bf(bz[3],null,null,bw)}else{var by=bf.filter(bz[3],bw,bx,true^bA);if(!bx){e.push.apply(e,by)}return false}}else{if(bk.match.POS.test(bz[0])||bk.match.CHILD.test(bz[0])){return true}}return bz},POS:function(e){e.unshift(true);return e}},filters:{enabled:function(e){return e.disabled===false&&e.type!=="hidden"},disabled:function(e){return e.disabled===true},checked:function(e){return e.checked===true},selected:function(e){if(e.parentNode){e.parentNode.selectedIndex}return e.selected===true},parent:function(e){return !!e.firstChild},empty:function(e){return !e.firstChild},has:function(bx,bw,e){return !!bf(e[3],bx).length},header:function(e){return(/h\d/i).test(e.nodeName)},text:function(e){return"text"===e.getAttribute("type")},radio:function(e){return"radio"===e.type},checkbox:function(e){return"checkbox"===e.type},file:function(e){return"file"===e.type},password:function(e){return"password"===e.type},submit:function(e){return"submit"===e.type},image:function(e){return"image"===e.type},reset:function(e){return"reset"===e.type},button:function(e){return"button"===e.type||e.nodeName.toLowerCase()==="button"},input:function(e){return(/input|select|textarea|button/i).test(e.nodeName)}},setFilters:{first:function(bw,e){return e===0},last:function(bx,bw,e,by){return bw===by.length-1},even:function(bw,e){return e%2===0},odd:function(bw,e){return e%2===1},lt:function(bx,bw,e){return bw<e[3]-0},gt:function(bx,bw,e){return bw>e[3]-0},nth:function(bx,bw,e){return e[3]-0===bw},eq:function(bx,bw,e){return e[3]-0===bw}},filter:{PSEUDO:function(bx,bC,bB,bD){var e=bC[1],bw=bk.filters[e];if(bw){return bw(bx,bB,bC,bD)}else{if(e==="contains"){return(bx.textContent||bx.innerText||bf.getText([bx])||"").indexOf(bC[3])>=0}else{if(e==="not"){var by=bC[3];for(var bA=0,bz=by.length;bA<bz;bA++){if(by[bA]===bx){return false}}return true}else{bf.error(e)}}}},CHILD:function(e,by){var bB=by[1],bw=e;switch(bB){case"only":case"first":while((bw=bw.previousSibling)){if(bw.nodeType===1){return false}}if(bB==="first"){return true}bw=e;case"last":while((bw=bw.nextSibling)){if(bw.nodeType===1){return false}}return true;case"nth":var bx=by[2],bE=by[3];if(bx===1&&bE===0){return true}var bA=by[0],bD=e.parentNode;if(bD&&(bD.sizcache!==bA||!e.nodeIndex)){var bz=0;for(bw=bD.firstChild;bw;bw=bw.nextSibling){if(bw.nodeType===1){bw.nodeIndex=++bz}}bD.sizcache=bA}var bC=e.nodeIndex-bE;if(bx===0){return bC===0}else{return(bC%bx===0&&bC/bx>=0)}}},ID:function(bw,e){return bw.nodeType===1&&bw.getAttribute("id")===e},TAG:function(bw,e){return(e==="*"&&bw.nodeType===1)||bw.nodeName.toLowerCase()===e},CLASS:function(bw,e){return(" "+(bw.className||bw.getAttribute("class"))+" ").indexOf(e)>-1},ATTR:function(bA,by){var bx=by[1],e=bk.attrHandle[bx]?bk.attrHandle[bx](bA):bA[bx]!=null?bA[bx]:bA.getAttribute(bx),bB=e+"",bz=by[2],bw=by[4];return e==null?bz==="!=":bz==="="?bB===bw:bz==="*="?bB.indexOf(bw)>=0:bz==="~="?(" "+bB+" ").indexOf(bw)>=0:!bw?bB&&e!==false:bz==="!="?bB!==bw:bz==="^="?bB.indexOf(bw)===0:bz==="$="?bB.substr(bB.length-bw.length)===bw:bz==="|="?bB===bw||bB.substr(0,bw.length+1)===bw+"-":false},POS:function(bz,bw,bx,bA){var e=bw[2],by=bk.setFilters[e];if(by){return by(bz,bx,bw,bA)}}}};var bj=bk.match.POS,be=function(bw,e){return"\\"+(e-0+1)};for(var bg in bk.match){bk.match[bg]=new RegExp(bk.match[bg].source+(/(?![^\[]*\])(?![^\(]*\))/.source));bk.leftMatch[bg]=new RegExp(/(^(?:.|\r|\n)*?)/.source+bk.match[bg].source.replace(/\\(\d+)/g,be))}var bl=function(bw,e){bw=Array.prototype.slice.call(bw,0);if(e){e.push.apply(e,bw);return e}return bw};try{Array.prototype.slice.call(al.documentElement.childNodes,0)[0].nodeType}catch(bu){bl=function(bz,by){var bx=0,bw=by||[];if(br.call(bz)==="[object Array]"){Array.prototype.push.apply(bw,bz)}else{if(typeof bz.length==="number"){for(var e=bz.length;bx<e;bx++){bw.push(bz[bx])}}else{for(;bz[bx];bx++){bw.push(bz[bx])}}}return bw}}var bq,bm;if(al.documentElement.compareDocumentPosition){bq=function(bw,e){if(bw===e){bi=true;return 0}if(!bw.compareDocumentPosition||!e.compareDocumentPosition){return bw.compareDocumentPosition?-1:1}return bw.compareDocumentPosition(e)&4?-1:1}}else{bq=function(bD,bC){var bA,bw,bx=[],e=[],bz=bD.parentNode,bB=bC.parentNode,bE=bz;if(bD===bC){bi=true;return 0}else{if(bz===bB){return bm(bD,bC)}else{if(!bz){return -1}else{if(!bB){return 1}}}}while(bE){bx.unshift(bE);bE=bE.parentNode}bE=bB;while(bE){e.unshift(bE);bE=bE.parentNode}bA=bx.length;bw=e.length;for(var by=0;by<bA&&by<bw;by++){if(bx[by]!==e[by]){return bm(bx[by],e[by])}}return by===bA?bm(bD,e[by],-1):bm(bx[by],bC,1)};bm=function(bw,e,bx){if(bw===e){return bx}var by=bw.nextSibling;while(by){if(by===e){return -1}by=by.nextSibling}return 1}}bf.getText=function(e){var bw="",by;for(var bx=0;e[bx];bx++){by=e[bx];if(by.nodeType===3||by.nodeType===4){bw+=by.nodeValue}else{if(by.nodeType!==8){bw+=bf.getText(by.childNodes)}}}return bw};(function(){var bw=al.createElement("div"),bx="script"+(new Date()).getTime(),e=al.documentElement;bw.innerHTML="<a name='"+bx+"'/>";e.insertBefore(bw,e.firstChild);if(al.getElementById(bx)){bk.find.ID=function(bz,bA,bB){if(typeof bA.getElementById!=="undefined"&&!bB){var by=bA.getElementById(bz[1]);return by?by.id===bz[1]||typeof by.getAttributeNode!=="undefined"&&by.getAttributeNode("id").nodeValue===bz[1]?[by]:H:[]}};bk.filter.ID=function(bA,by){var bz=typeof bA.getAttributeNode!=="undefined"&&bA.getAttributeNode("id");return bA.nodeType===1&&bz&&bz.nodeValue===by}}e.removeChild(bw);e=bw=null})();(function(){var e=al.createElement("div");e.appendChild(al.createComment(""));if(e.getElementsByTagName("*").length>0){bk.find.TAG=function(bw,bA){var bz=bA.getElementsByTagName(bw[1]);if(bw[1]==="*"){var by=[];for(var bx=0;bz[bx];bx++){if(bz[bx].nodeType===1){by.push(bz[bx])}}bz=by}return bz}}e.innerHTML="<a href='#'></a>";if(e.firstChild&&typeof e.firstChild.getAttribute!=="undefined"&&e.firstChild.getAttribute("href")!=="#"){bk.attrHandle.href=function(bw){return bw.getAttribute("href",2)}}e=null})();if(al.querySelectorAll){(function(){var e=bf,by=al.createElement("div"),bx="__sizzle__";by.innerHTML="<p class='TEST'></p>";if(by.querySelectorAll&&by.querySelectorAll(".TEST").length===0){return}bf=function(bJ,bA,bE,bI){bA=bA||al;if(!bI&&!bf.isXML(bA)){var bH=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(bJ);if(bH&&(bA.nodeType===1||bA.nodeType===9)){if(bH[1]){return bl(bA.getElementsByTagName(bJ),bE)}else{if(bH[2]&&bk.find.CLASS&&bA.getElementsByClassName){return bl(bA.getElementsByClassName(bH[2]),bE)}}}if(bA.nodeType===9){if(bJ==="body"&&bA.body){return bl([bA.body],bE)}else{if(bH&&bH[3]){var bD=bA.getElementById(bH[3]);if(bD&&bD.parentNode){if(bD.id===bH[3]){return bl([bD],bE)}}else{return bl([],bE)}}}try{return bl(bA.querySelectorAll(bJ),bE)}catch(bF){}}else{if(bA.nodeType===1&&bA.nodeName.toLowerCase()!=="object"){var bB=bA,bC=bA.getAttribute("id"),bz=bC||bx,bL=bA.parentNode,bK=/^\s*[+~]/.test(bJ);if(!bC){bA.setAttribute("id",bz)}else{bz=bz.replace(/'/g,"\\$&")}if(bK&&bL){bA=bA.parentNode}try{if(!bK||bL){return bl(bA.querySelectorAll("[id='"+bz+"'] "+bJ),bE)}}catch(bG){}finally{if(!bC){bB.removeAttribute("id")}}}}}return e(bJ,bA,bE,bI)};for(var bw in e){bf[bw]=e[bw]}by=null})()}(function(){var e=al.documentElement,bx=e.matchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.msMatchesSelector,bw=false;try{bx.call(al.documentElement,"[test!='']:sizzle")}catch(by){bw=true}if(bx){bf.matchesSelector=function(bz,bB){bB=bB.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!bf.isXML(bz)){try{if(bw||!bk.match.PSEUDO.test(bB)&&!/!=/.test(bB)){return bx.call(bz,bB)}}catch(bA){}}return bf(bB,null,null,[bz]).length>0}}})();(function(){var e=al.createElement("div");e.innerHTML="<div class='test e'></div><div class='test'></div>";if(!e.getElementsByClassName||e.getElementsByClassName("e").length===0){return}e.lastChild.className="e";if(e.getElementsByClassName("e").length===1){return}bk.order.splice(1,0,"CLASS");bk.find.CLASS=function(bw,bx,by){if(typeof bx.getElementsByClassName!=="undefined"&&!by){return bx.getElementsByClassName(bw[1])}};e=null})();function bd(bw,bB,bA,bE,bC,bD){for(var by=0,bx=bE.length;by<bx;by++){var e=bE[by];if(e){var bz=false;e=e[bw];while(e){if(e.sizcache===bA){bz=bE[e.sizset];break}if(e.nodeType===1&&!bD){e.sizcache=bA;e.sizset=by}if(e.nodeName.toLowerCase()===bB){bz=e;break}e=e[bw]}bE[by]=bz}}}function bt(bw,bB,bA,bE,bC,bD){for(var by=0,bx=bE.length;by<bx;by++){var e=bE[by];if(e){var bz=false;e=e[bw];while(e){if(e.sizcache===bA){bz=bE[e.sizset];break}if(e.nodeType===1){if(!bD){e.sizcache=bA;e.sizset=by}if(typeof bB!=="string"){if(e===bB){bz=true;break}}else{if(bf.filter(bB,[e]).length>0){bz=e;break}}}e=e[bw]}bE[by]=bz}}}if(al.documentElement.contains){bf.contains=function(bw,e){return bw!==e&&(bw.contains?bw.contains(e):true)}}else{if(al.documentElement.compareDocumentPosition){bf.contains=function(bw,e){return !!(bw.compareDocumentPosition(e)&16)}}else{bf.contains=function(){return false}}}bf.isXML=function(e){var bw=(e?e.ownerDocument||e:0).documentElement;return bw?bw.nodeName!=="HTML":false};var bs=function(e,bC){var bA,by=[],bz="",bx=bC.nodeType?[bC]:bC;while((bA=bk.match.PSEUDO.exec(e))){bz+=bA[0];e=e.replace(bk.match.PSEUDO,"")}e=bk.relative[e]?e+"*":e;for(var bB=0,bw=bx.length;bB<bw;bB++){bf(e,bx[bB],by)}return bf.filter(bz,by)};a.find=bf;a.expr=bf.selectors;a.expr[":"]=a.expr.filters;a.unique=bf.uniqueSort;a.text=bf.getText;a.isXMLDoc=bf.isXML;a.contains=bf.contains})();var W=/Until$/,ai=/^(?:parents|prevUntil|prevAll)/,aW=/,/,a9=/^.[^:#\[\.,]*$/,M=Array.prototype.slice,F=a.expr.match.POS,ao={children:true,contents:true,next:true,prev:true};a.fn.extend({find:function(e){var be=this.pushStack("","find",e),bh=0;for(var bf=0,bd=this.length;bf<bd;bf++){bh=be.length;a.find(e,this[bf],be);if(bf>0){for(var bi=bh;bi<be.length;bi++){for(var bg=0;bg<bh;bg++){if(be[bg]===be[bi]){be.splice(bi--,1);break}}}}}return be},has:function(bd){var e=a(bd);return this.filter(function(){for(var bf=0,be=e.length;bf<be;bf++){if(a.contains(this,e[bf])){return true}}})},not:function(e){return this.pushStack(av(this,e,false),"not",e)},filter:function(e){return this.pushStack(av(this,e,true),"filter",e)},is:function(e){return !!e&&a.filter(e,this).length>0},closest:function(bm,bd){var bj=[],bg,be,bl=this[0];if(a.isArray(bm)){var bi,bf,bh={},e=1;if(bl&&bm.length){for(bg=0,be=bm.length;bg<be;bg++){bf=bm[bg];if(!bh[bf]){bh[bf]=a.expr.match.POS.test(bf)?a(bf,bd||this.context):bf}}while(bl&&bl.ownerDocument&&bl!==bd){for(bf in bh){bi=bh[bf];if(bi.jquery?bi.index(bl)>-1:a(bl).is(bi)){bj.push({selector:bf,elem:bl,level:e})}}bl=bl.parentNode;e++}}return bj}var bk=F.test(bm)?a(bm,bd||this.context):null;for(bg=0,be=this.length;bg<be;bg++){bl=this[bg];while(bl){if(bk?bk.index(bl)>-1:a.find.matchesSelector(bl,bm)){bj.push(bl);break}else{bl=bl.parentNode;if(!bl||!bl.ownerDocument||bl===bd){break}}}}bj=bj.length>1?a.unique(bj):bj;return this.pushStack(bj,"closest",bm)},index:function(e){if(!e||typeof e==="string"){return a.inArray(this[0],e?a(e):this.parent().children())}return a.inArray(e.jquery?e[0]:e,this)},add:function(e,bd){var bf=typeof e==="string"?a(e,bd):a.makeArray(e),be=a.merge(this.get(),bf);return this.pushStack(B(bf[0])||B(be[0])?be:a.unique(be))},andSelf:function(){return this.add(this.prevObject)}});function B(e){return !e||!e.parentNode||e.parentNode.nodeType===11}a.each({parent:function(bd){var e=bd.parentNode;return e&&e.nodeType!==11?e:null},parents:function(e){return a.dir(e,"parentNode")},parentsUntil:function(bd,e,be){return a.dir(bd,"parentNode",be)},next:function(e){return a.nth(e,2,"nextSibling")},prev:function(e){return a.nth(e,2,"previousSibling")},nextAll:function(e){return a.dir(e,"nextSibling")},prevAll:function(e){return a.dir(e,"previousSibling")},nextUntil:function(bd,e,be){return a.dir(bd,"nextSibling",be)},prevUntil:function(bd,e,be){return a.dir(bd,"previousSibling",be)},siblings:function(e){return a.sibling(e.parentNode.firstChild,e)},children:function(e){return a.sibling(e.firstChild)},contents:function(e){return a.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:a.makeArray(e.childNodes)}},function(e,bd){a.fn[e]=function(bh,be){var bg=a.map(this,bd,bh),bf=M.call(arguments);if(!W.test(e)){be=bh}if(be&&typeof be==="string"){bg=a.filter(be,bg)}bg=this.length>1&&!ao[e]?a.unique(bg):bg;if((this.length>1||aW.test(be))&&ai.test(e)){bg=bg.reverse()}return this.pushStack(bg,e,bf.join(","))}});a.extend({filter:function(be,e,bd){if(bd){be=":not("+be+")"}return e.length===1?a.find.matchesSelector(e[0],be)?[e[0]]:[]:a.find.matches(be,e)},dir:function(be,bd,bg){var e=[],bf=be[bd];while(bf&&bf.nodeType!==9&&(bg===H||bf.nodeType!==1||!a(bf).is(bg))){if(bf.nodeType===1){e.push(bf)}bf=bf[bd]}return e},nth:function(bg,e,be,bf){e=e||1;var bd=0;for(;bg;bg=bg[be]){if(bg.nodeType===1&&++bd===e){break}}return bg},sibling:function(be,bd){var e=[];for(;be;be=be.nextSibling){if(be.nodeType===1&&be!==bd){e.push(be)}}return e}});function av(bf,be,e){if(a.isFunction(be)){return a.grep(bf,function(bh,bg){var bi=!!be.call(bh,bg,bh);return bi===e})}else{if(be.nodeType){return a.grep(bf,function(bh,bg){return(bh===be)===e})}else{if(typeof be==="string"){var bd=a.grep(bf,function(bg){return bg.nodeType===1});if(a9.test(be)){return a.filter(be,bd,!e)}else{be=a.filter(be,bd)}}}}return a.grep(bf,function(bh,bg){return(a.inArray(bh,be)>=0)===e})}var ab=/ jQuery\d+="(?:\d+|null)"/g,aj=/^\s+/,O=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,c=/<([\w:]+)/,v=/<tbody/i,T=/<|&#?\w+;/,L=/<(?:script|object|embed|option|style)/i,m=/checked\s*(?:[^=]|=\s*.checked.)/i,an={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,"",""]};an.optgroup=an.option;an.tbody=an.tfoot=an.colgroup=an.caption=an.thead;an.th=an.td;if(!a.support.htmlSerialize){an._default=[1,"div<div>","</div>"]}a.fn.extend({text:function(e){if(a.isFunction(e)){return this.each(function(be){var bd=a(this);bd.text(e.call(this,be,bd.text()))})}if(typeof e!=="object"&&e!==H){return this.empty().append((this[0]&&this[0].ownerDocument||al).createTextNode(e))}return a.text(this)},wrapAll:function(e){if(a.isFunction(e)){return this.each(function(be){a(this).wrapAll(e.call(this,be))})}if(this[0]){var bd=a(e,this[0].ownerDocument).eq(0).clone(true);if(this[0].parentNode){bd.insertBefore(this[0])}bd.map(function(){var be=this;while(be.firstChild&&be.firstChild.nodeType===1){be=be.firstChild}return be}).append(this)}return this},wrapInner:function(e){if(a.isFunction(e)){return this.each(function(bd){a(this).wrapInner(e.call(this,bd))})}return this.each(function(){var bd=a(this),be=bd.contents();if(be.length){be.wrapAll(e)}else{bd.append(e)}})},wrap:function(e){return this.each(function(){a(this).wrapAll(e)})},unwrap:function(){return this.parent().each(function(){if(!a.nodeName(this,"body")){a(this).replaceWith(this.childNodes)}}).end()},append:function(){return this.domManip(arguments,true,function(e){if(this.nodeType===1){this.appendChild(e)}})},prepend:function(){return this.domManip(arguments,true,function(e){if(this.nodeType===1){this.insertBefore(e,this.firstChild)}})},before:function(){if(this[0]&&this[0].parentNode){return this.domManip(arguments,false,function(bd){this.parentNode.insertBefore(bd,this)})}else{if(arguments.length){var e=a(arguments[0]);e.push.apply(e,this.toArray());return this.pushStack(e,"before",arguments)}}},after:function(){if(this[0]&&this[0].parentNode){return this.domManip(arguments,false,function(bd){this.parentNode.insertBefore(bd,this.nextSibling)})}else{if(arguments.length){var e=this.pushStack(this,"after",arguments);e.push.apply(e,a(arguments[0]).toArray());return e}}},remove:function(e,bf){for(var bd=0,be;(be=this[bd])!=null;bd++){if(!e||a.filter(e,[be]).length){if(!bf&&be.nodeType===1){a.cleanData(be.getElementsByTagName("*"));a.cleanData([be])}if(be.parentNode){be.parentNode.removeChild(be)}}}return this},empty:function(){for(var e=0,bd;(bd=this[e])!=null;e++){if(bd.nodeType===1){a.cleanData(bd.getElementsByTagName("*"))}while(bd.firstChild){bd.removeChild(bd.firstChild)}}return this},clone:function(bd,e){bd=bd==null?false:bd;e=e==null?bd:e;return this.map(function(){return a.clone(this,bd,e)})},html:function(bf){if(bf===H){return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(ab,""):null}else{if(typeof bf==="string"&&!L.test(bf)&&(a.support.leadingWhitespace||!aj.test(bf))&&!an[(c.exec(bf)||["",""])[1].toLowerCase()]){bf=bf.replace(O,"<$1></$2>");try{for(var be=0,bd=this.length;be<bd;be++){if(this[be].nodeType===1){a.cleanData(this[be].getElementsByTagName("*"));this[be].innerHTML=bf}}}catch(bg){this.empty().append(bf)}}else{if(a.isFunction(bf)){this.each(function(bh){var e=a(this);e.html(bf.call(this,bh,e.html()))})}else{this.empty().append(bf)}}}return this},replaceWith:function(e){if(this[0]&&this[0].parentNode){if(a.isFunction(e)){return this.each(function(bf){var be=a(this),bd=be.html();be.replaceWith(e.call(this,bf,bd))})}if(typeof e!=="string"){e=a(e).detach()}return this.each(function(){var be=this.nextSibling,bd=this.parentNode;a(this).remove();if(be){a(be).before(e)}else{a(bd).append(e)}})}else{return this.pushStack(a(a.isFunction(e)?e():e),"replaceWith",e)}},detach:function(e){return this.remove(e,true)},domManip:function(bj,bn,bm){var bf,bg,bi,bl,bk=bj[0],bd=[];if(!a.support.checkClone&&arguments.length===3&&typeof bk==="string"&&m.test(bk)){return this.each(function(){a(this).domManip(bj,bn,bm,true)})}if(a.isFunction(bk)){return this.each(function(bp){var bo=a(this);bj[0]=bk.call(this,bp,bn?bo.html():H);bo.domManip(bj,bn,bm)})}if(this[0]){bl=bk&&bk.parentNode;if(a.support.parentNode&&bl&&bl.nodeType===11&&bl.childNodes.length===this.length){bf={fragment:bl}}else{bf=a.buildFragment(bj,this,bd)}bi=bf.fragment;if(bi.childNodes.length===1){bg=bi=bi.firstChild}else{bg=bi.firstChild}if(bg){bn=bn&&a.nodeName(bg,"tr");for(var be=0,e=this.length,bh=e-1;be<e;be++){bm.call(bn?aX(this[be],bg):this[be],bf.cacheable||(e>1&&be<bh)?a.clone(bi,true,true):bi)}}if(bd.length){a.each(bd,a8)}}return this}});function aX(e,bd){return a.nodeName(e,"table")?(e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody"))):e}function s(e,bj){if(bj.nodeType!==1||!a.hasData(e)){return}var bi=a.expando,bf=a.data(e),bg=a.data(bj,bf);if((bf=bf[bi])){var bk=bf.events;bg=bg[bi]=a.extend({},bf);if(bk){delete bg.handle;bg.events={};for(var bh in bk){for(var be=0,bd=bk[bh].length;be<bd;be++){a.event.add(bj,bh+(bk[bh][be].namespace?".":"")+bk[bh][be].namespace,bk[bh][be],bk[bh][be].data)}}}}}function ac(bd,e){if(e.nodeType!==1){return}var be=e.nodeName.toLowerCase();e.clearAttributes();e.mergeAttributes(bd);if(be==="object"){e.outerHTML=bd.outerHTML}else{if(be==="input"&&(bd.type==="checkbox"||bd.type==="radio")){if(bd.checked){e.defaultChecked=e.checked=bd.checked}if(e.value!==bd.value){e.value=bd.value}}else{if(be==="option"){e.selected=bd.defaultSelected}else{if(be==="input"||be==="textarea"){e.defaultValue=bd.defaultValue}}}}e.removeAttribute(a.expando)}a.buildFragment=function(bh,bf,bd){var bg,e,be,bi=(bf&&bf[0]?bf[0].ownerDocument||bf[0]:al);if(bh.length===1&&typeof bh[0]==="string"&&bh[0].length<512&&bi===al&&bh[0].charAt(0)==="<"&&!L.test(bh[0])&&(a.support.checkClone||!m.test(bh[0]))){e=true;be=a.fragments[bh[0]];if(be){if(be!==1){bg=be}}}if(!bg){bg=bi.createDocumentFragment();a.clean(bh,bi,bg,bd)}if(e){a.fragments[bh[0]]=be?bg:1}return{fragment:bg,cacheable:e}};a.fragments={};a.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,bd){a.fn[e]=function(be){var bh=[],bk=a(be),bj=this.length===1&&this[0].parentNode;if(bj&&bj.nodeType===11&&bj.childNodes.length===1&&bk.length===1){bk[bd](this[0]);return this}else{for(var bi=0,bf=bk.length;bi<bf;bi++){var bg=(bi>0?this.clone(true):this).get();a(bk[bi])[bd](bg);bh=bh.concat(bg)}return this.pushStack(bh,e,bk.selector)}}});function a1(e){if("getElementsByTagName" in e){return e.getElementsByTagName("*")}else{if("querySelectorAll" in e){return e.querySelectorAll("*")}else{return[]}}}a.extend({clone:function(bg,bi,be){var bh=bg.cloneNode(true),e,bd,bf;if((!a.support.noCloneEvent||!a.support.noCloneChecked)&&(bg.nodeType===1||bg.nodeType===11)&&!a.isXMLDoc(bg)){ac(bg,bh);e=a1(bg);bd=a1(bh);for(bf=0;e[bf];++bf){ac(e[bf],bd[bf])}}if(bi){s(bg,bh);if(be){e=a1(bg);bd=a1(bh);for(bf=0;e[bf];++bf){s(e[bf],bd[bf])}}}return bh},clean:function(be,bg,bn,bi){bg=bg||al;if(typeof bg.createElement==="undefined"){bg=bg.ownerDocument||bg[0]&&bg[0].ownerDocument||al}var bo=[];for(var bm=0,bh;(bh=be[bm])!=null;bm++){if(typeof bh==="number"){bh+=""}if(!bh){continue}if(typeof bh==="string"&&!T.test(bh)){bh=bg.createTextNode(bh)}else{if(typeof bh==="string"){bh=bh.replace(O,"<$1></$2>");var bp=(c.exec(bh)||["",""])[1].toLowerCase(),bf=an[bp]||an._default,bl=bf[0],bd=bg.createElement("div");bd.innerHTML=bf[1]+bh+bf[2];while(bl--){bd=bd.lastChild}if(!a.support.tbody){var e=v.test(bh),bk=bp==="table"&&!e?bd.firstChild&&bd.firstChild.childNodes:bf[1]==="<table>"&&!e?bd.childNodes:[];for(var bj=bk.length-1;bj>=0;--bj){if(a.nodeName(bk[bj],"tbody")&&!bk[bj].childNodes.length){bk[bj].parentNode.removeChild(bk[bj])}}}if(!a.support.leadingWhitespace&&aj.test(bh)){bd.insertBefore(bg.createTextNode(aj.exec(bh)[0]),bd.firstChild)}bh=bd.childNodes}}if(bh.nodeType){bo.push(bh)}else{bo=a.merge(bo,bh)}}if(bn){for(bm=0;bo[bm];bm++){if(bi&&a.nodeName(bo[bm],"script")&&(!bo[bm].type||bo[bm].type.toLowerCase()==="text/javascript")){bi.push(bo[bm].parentNode?bo[bm].parentNode.removeChild(bo[bm]):bo[bm])}else{if(bo[bm].nodeType===1){bo.splice.apply(bo,[bm+1,0].concat(a.makeArray(bo[bm].getElementsByTagName("script"))))}bn.appendChild(bo[bm])}}}return bo},cleanData:function(bd){var bg,be,e=a.cache,bl=a.expando,bj=a.event.special,bi=a.support.deleteExpando;for(var bh=0,bf;(bf=bd[bh])!=null;bh++){if(bf.nodeName&&a.noData[bf.nodeName.toLowerCase()]){continue}be=bf[a.expando];if(be){bg=e[be]&&e[be][bl];if(bg&&bg.events){for(var bk in bg.events){if(bj[bk]){a.event.remove(bf,bk)}else{a.removeEvent(bf,bk,bg.handle)}}if(bg.handle){bg.handle.elem=null}}if(bi){delete bf[a.expando]}else{if(bf.removeAttribute){bf.removeAttribute(a.expando)}}delete e[be]}}}});function a8(e,bd){if(bd.src){a.ajax({url:bd.src,async:false,dataType:"script"})}else{a.globalEval(bd.text||bd.textContent||bd.innerHTML||"")}if(bd.parentNode){bd.parentNode.removeChild(bd)}}var ae=/alpha\([^)]*\)/i,ak=/opacity=([^)]*)/,aM=/-([a-z])/ig,y=/([A-Z])/g,aZ=/^-?\d+(?:px)?$/i,a7=/^-?\d/,aV={position:"absolute",visibility:"hidden",display:"block"},ag=["Left","Right"],aR=["Top","Bottom"],U,ay,aL,l=function(e,bd){return bd.toUpperCase()};a.fn.css=function(e,bd){if(arguments.length===2&&bd===H){return this}return a.access(this,e,bd,true,function(bf,be,bg){return bg!==H?a.style(bf,be,bg):a.css(bf,be)})};a.extend({cssHooks:{opacity:{get:function(be,bd){if(bd){var e=U(be,"opacity","opacity");return e===""?"1":e}else{return be.style.opacity}}}},cssNumber:{zIndex:true,fontWeight:true,opacity:true,zoom:true,lineHeight:true},cssProps:{"float":a.support.cssFloat?"cssFloat":"styleFloat"},style:function(bf,be,bk,bg){if(!bf||bf.nodeType===3||bf.nodeType===8||!bf.style){return}var bj,bh=a.camelCase(be),bd=bf.style,bl=a.cssHooks[bh];be=a.cssProps[bh]||bh;if(bk!==H){if(typeof bk==="number"&&isNaN(bk)||bk==null){return}if(typeof bk==="number"&&!a.cssNumber[bh]){bk+="px"}if(!bl||!("set" in bl)||(bk=bl.set(bf,bk))!==H){try{bd[be]=bk}catch(bi){}}}else{if(bl&&"get" in bl&&(bj=bl.get(bf,false,bg))!==H){return bj}return bd[be]}},css:function(bh,bg,bd){var bf,be=a.camelCase(bg),e=a.cssHooks[be];bg=a.cssProps[be]||be;if(e&&"get" in e&&(bf=e.get(bh,true,bd))!==H){return bf}else{if(U){return U(bh,bg,be)}}},swap:function(bf,be,bg){var e={};for(var bd in be){e[bd]=bf.style[bd];bf.style[bd]=be[bd]}bg.call(bf);for(bd in be){bf.style[bd]=e[bd]}},camelCase:function(e){return e.replace(aM,l)}});a.curCSS=a.css;a.each(["height","width"],function(bd,e){a.cssHooks[e]={get:function(bg,bf,be){var bh;if(bf){if(bg.offsetWidth!==0){bh=o(bg,e,be)}else{a.swap(bg,aV,function(){bh=o(bg,e,be)})}if(bh<=0){bh=U(bg,e,e);if(bh==="0px"&&aL){bh=aL(bg,e,e)}if(bh!=null){return bh===""||bh==="auto"?"0px":bh}}if(bh<0||bh==null){bh=bg.style[e];return bh===""||bh==="auto"?"0px":bh}return typeof bh==="string"?bh:bh+"px"}},set:function(be,bf){if(aZ.test(bf)){bf=parseFloat(bf);if(bf>=0){return bf+"px"}}else{return bf}}}});if(!a.support.opacity){a.cssHooks.opacity={get:function(bd,e){return ak.test((e&&bd.currentStyle?bd.currentStyle.filter:bd.style.filter)||"")?(parseFloat(RegExp.$1)/100)+"":e?"1":""},set:function(bf,bg){var be=bf.style;be.zoom=1;var e=a.isNaN(bg)?"":"alpha(opacity="+bg*100+")",bd=be.filter||"";be.filter=ae.test(bd)?bd.replace(ae,e):be.filter+" "+e}}}if(al.defaultView&&al.defaultView.getComputedStyle){ay=function(bh,e,bf){var be,bg,bd;bf=bf.replace(y,"-$1").toLowerCase();if(!(bg=bh.ownerDocument.defaultView)){return H}if((bd=bg.getComputedStyle(bh,null))){be=bd.getPropertyValue(bf);if(be===""&&!a.contains(bh.ownerDocument.documentElement,bh)){be=a.style(bh,bf)}}return be}}if(al.documentElement.currentStyle){aL=function(bg,be){var bh,bd=bg.currentStyle&&bg.currentStyle[be],e=bg.runtimeStyle&&bg.runtimeStyle[be],bf=bg.style;if(!aZ.test(bd)&&a7.test(bd)){bh=bf.left;if(e){bg.runtimeStyle.left=bg.currentStyle.left}bf.left=be==="fontSize"?"1em":(bd||0);bd=bf.pixelLeft+"px";bf.left=bh;if(e){bg.runtimeStyle.left=e}}return bd===""?"auto":bd}}U=ay||aL;function o(be,bd,e){var bg=bd==="width"?ag:aR,bf=bd==="width"?be.offsetWidth:be.offsetHeight;if(e==="border"){return bf}a.each(bg,function(){if(!e){bf-=parseFloat(a.css(be,"padding"+this))||0}if(e==="margin"){bf+=parseFloat(a.css(be,"margin"+this))||0}else{bf-=parseFloat(a.css(be,"border"+this+"Width"))||0}});return bf}if(a.expr&&a.expr.filters){a.expr.filters.hidden=function(be){var bd=be.offsetWidth,e=be.offsetHeight;return(bd===0&&e===0)||(!a.support.reliableHiddenOffsets&&(be.style.display||a.css(be,"display"))==="none")};a.expr.filters.visible=function(e){return !a.expr.filters.hidden(e)}}var i=/%20/g,ah=/\[\]$/,bc=/\r?\n/g,ba=/#.*$/,ar=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,aO=/^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,aB=/(?:^file|^widget|\-extension):$/,aD=/^(?:GET|HEAD)$/,b=/^\/\//,I=/\?/,aU=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,p=/^(?:select|textarea)/i,g=/\s+/,bb=/([?&])_=[^&]*/,R=/(^|\-)([a-z])/g,aJ=function(bd,e,be){return e+be.toUpperCase()},G=/^([\w\+\.\-]+:)\/\/([^\/?#:]*)(?::(\d+))?/,z=a.fn.load,V={},q={},au,r;try{au=al.location.href}catch(am){au=al.createElement("a");au.href="";au=au.href}r=G.exec(au.toLowerCase());function d(e){return function(bg,bi){if(typeof bg!=="string"){bi=bg;bg="*"}if(a.isFunction(bi)){var bf=bg.toLowerCase().split(g),be=0,bh=bf.length,bd,bj,bk;for(;be<bh;be++){bd=bf[be];bk=/^\+/.test(bd);if(bk){bd=bd.substr(1)||"*"}bj=e[bd]=e[bd]||[];bj[bk?"unshift":"push"](bi)}}}}function aI(bd,bm,bh,bl,bj,bf){bj=bj||bm.dataTypes[0];bf=bf||{};bf[bj]=true;var bi=bd[bj],be=0,e=bi?bi.length:0,bg=(bd===V),bk;for(;be<e&&(bg||!bk);be++){bk=bi[be](bm,bh,bl);if(typeof bk==="string"){if(!bg||bf[bk]){bk=H}else{bm.dataTypes.unshift(bk);bk=aI(bd,bm,bh,bl,bk,bf)}}}if((bg||!bk)&&!bf["*"]){bk=aI(bd,bm,bh,bl,"*",bf)}return bk}a.fn.extend({load:function(be,bh,bi){if(typeof be!=="string"&&z){return z.apply(this,arguments)}else{if(!this.length){return this}}var bg=be.indexOf(" ");if(bg>=0){var e=be.slice(bg,be.length);be=be.slice(0,bg)}var bf="GET";if(bh){if(a.isFunction(bh)){bi=bh;bh=H}else{if(typeof bh==="object"){bh=a.param(bh,a.ajaxSettings.traditional);bf="POST"}}}var bd=this;a.ajax({url:be,type:bf,dataType:"html",data:bh,complete:function(bk,bj,bl){bl=bk.responseText;if(bk.isResolved()){bk.done(function(bm){bl=bm});bd.html(e?a("<div>").append(bl.replace(aU,"")).find(e):bl)}if(bi){bd.each(bi,[bl,bj,bk])}}});return this},serialize:function(){return a.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?a.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||p.test(this.nodeName)||aO.test(this.type))}).map(function(e,bd){var be=a(this).val();return be==null?null:a.isArray(be)?a.map(be,function(bg,bf){return{name:bd.name,value:bg.replace(bc,"\r\n")}}):{name:bd.name,value:be.replace(bc,"\r\n")}}).get()}});a.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(e,bd){a.fn[bd]=function(be){return this.bind(bd,be)}});a.each(["get","post"],function(e,bd){a[bd]=function(be,bg,bh,bf){if(a.isFunction(bg)){bf=bf||bh;bh=bg;bg=H}return a.ajax({type:bd,url:be,data:bg,success:bh,dataType:bf})}});a.extend({getScript:function(e,bd){return a.get(e,H,bd,"script")},getJSON:function(e,bd,be){return a.get(e,bd,be,"json")},ajaxSetup:function(be,e){if(!e){e=be;be=a.extend(true,a.ajaxSettings,e)}else{a.extend(true,be,a.ajaxSettings,e)}for(var bd in {context:1,url:1}){if(bd in e){be[bd]=e[bd]}else{if(bd in a.ajaxSettings){be[bd]=a.ajaxSettings[bd]}}}return be},ajaxSettings:{url:au,isLocal:aB.test(r[1]),global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":"*/*"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":aY.String,"text html":true,"text json":a.parseJSON,"text xml":a.parseXML}},ajaxPrefilter:d(V),ajaxTransport:d(q),ajax:function(bh,bf){if(typeof bh==="object"){bf=bh;bh=H}bf=bf||{};var bl=a.ajaxSetup({},bf),bz=bl.context||bl,bo=bz!==bl&&(bz.nodeType||bz instanceof a)?a(bz):a.event,by=a.Deferred(),bv=a._Deferred(),bj=bl.statusCode||{},bk,bp={},bx,bg,bt,bm,bq,bi=0,be,bs,br={readyState:0,setRequestHeader:function(e,bA){if(!bi){bp[e.toLowerCase().replace(R,aJ)]=bA}return this},getAllResponseHeaders:function(){return bi===2?bx:null},getResponseHeader:function(bA){var e;if(bi===2){if(!bg){bg={};while((e=ar.exec(bx))){bg[e[1].toLowerCase()]=e[2]}}e=bg[bA.toLowerCase()]}return e===H?null:e},overrideMimeType:function(e){if(!bi){bl.mimeType=e}return this},abort:function(e){e=e||"abort";if(bt){bt.abort(e)}bn(0,e);return this}};function bn(bF,bD,bG,bC){if(bi===2){return}bi=2;if(bm){clearTimeout(bm)}bt=H;bx=bC||"";br.readyState=bF?4:0;var bA,bK,bJ,bE=bG?a4(bl,br,bG):H,bB,bI;if(bF>=200&&bF<300||bF===304){if(bl.ifModified){if((bB=br.getResponseHeader("Last-Modified"))){a.lastModified[bk]=bB}if((bI=br.getResponseHeader("Etag"))){a.etag[bk]=bI}}if(bF===304){bD="notmodified";bA=true}else{try{bK=D(bl,bE);bD="success";bA=true}catch(bH){bD="parsererror";bJ=bH}}}else{bJ=bD;if(!bD||bF){bD="error";if(bF<0){bF=0}}}br.status=bF;br.statusText=bD;if(bA){by.resolveWith(bz,[bK,bD,br])}else{by.rejectWith(bz,[br,bD,bJ])}br.statusCode(bj);bj=H;if(be){bo.trigger("ajax"+(bA?"Success":"Error"),[br,bl,bA?bK:bJ])}bv.resolveWith(bz,[br,bD]);if(be){bo.trigger("ajaxComplete",[br,bl]);if(!(--a.active)){a.event.trigger("ajaxStop")}}}by.promise(br);br.success=br.done;br.error=br.fail;br.complete=bv.done;br.statusCode=function(bA){if(bA){var e;if(bi<2){for(e in bA){bj[e]=[bj[e],bA[e]]}}else{e=bA[br.status];br.then(e,e)}}return this};bl.url=((bh||bl.url)+"").replace(ba,"").replace(b,r[1]+"//");bl.dataTypes=a.trim(bl.dataType||"*").toLowerCase().split(g);if(!bl.crossDomain){bq=G.exec(bl.url.toLowerCase());bl.crossDomain=!!(bq&&(bq[1]!=r[1]||bq[2]!=r[2]||(bq[3]||(bq[1]==="http:"?80:443))!=(r[3]||(r[1]==="http:"?80:443))))}if(bl.data&&bl.processData&&typeof bl.data!=="string"){bl.data=a.param(bl.data,bl.traditional)}aI(V,bl,bf,br);if(bi===2){return false}be=bl.global;bl.type=bl.type.toUpperCase();bl.hasContent=!aD.test(bl.type);if(be&&a.active++===0){a.event.trigger("ajaxStart")}if(!bl.hasContent){if(bl.data){bl.url+=(I.test(bl.url)?"&":"?")+bl.data}bk=bl.url;if(bl.cache===false){var bd=a.now(),bw=bl.url.replace(bb,"$1_="+bd);bl.url=bw+((bw===bl.url)?(I.test(bl.url)?"&":"?")+"_="+bd:"")}}if(bl.data&&bl.hasContent&&bl.contentType!==false||bf.contentType){bp["Content-Type"]=bl.contentType}if(bl.ifModified){bk=bk||bl.url;if(a.lastModified[bk]){bp["If-Modified-Since"]=a.lastModified[bk]}if(a.etag[bk]){bp["If-None-Match"]=a.etag[bk]}}bp.Accept=bl.dataTypes[0]&&bl.accepts[bl.dataTypes[0]]?bl.accepts[bl.dataTypes[0]]+(bl.dataTypes[0]!=="*"?", */*; q=0.01":""):bl.accepts["*"];for(bs in bl.headers){br.setRequestHeader(bs,bl.headers[bs])}if(bl.beforeSend&&(bl.beforeSend.call(bz,br,bl)===false||bi===2)){br.abort();return false}for(bs in {success:1,error:1,complete:1}){br[bs](bl[bs])}bt=aI(q,bl,bf,br);if(!bt){bn(-1,"No Transport")}else{br.readyState=1;if(be){bo.trigger("ajaxSend",[br,bl])}if(bl.async&&bl.timeout>0){bm=setTimeout(function(){br.abort("timeout")},bl.timeout)}try{bi=1;bt.send(bp,bn)}catch(bu){if(status<2){bn(-1,bu)}else{a.error(bu)}}}return br},param:function(e,be){var bd=[],bg=function(bh,bi){bi=a.isFunction(bi)?bi():bi;bd[bd.length]=encodeURIComponent(bh)+"="+encodeURIComponent(bi)};if(be===H){be=a.ajaxSettings.traditional}if(a.isArray(e)||(e.jquery&&!a.isPlainObject(e))){a.each(e,function(){bg(this.name,this.value)})}else{for(var bf in e){u(bf,e[bf],be,bg)}}return bd.join("&").replace(i,"+")}});function u(be,bg,bd,bf){if(a.isArray(bg)&&bg.length){a.each(bg,function(bi,bh){if(bd||ah.test(be)){bf(be,bh)}else{u(be+"["+(typeof bh==="object"||a.isArray(bh)?bi:"")+"]",bh,bd,bf)}})}else{if(!bd&&bg!=null&&typeof bg==="object"){if(a.isArray(bg)||a.isEmptyObject(bg)){bf(be,"")}else{for(var e in bg){u(be+"["+e+"]",bg[e],bd,bf)}}}else{bf(be,bg)}}}a.extend({active:0,lastModified:{},etag:{}});function a4(bl,bk,bh){var bd=bl.contents,bj=bl.dataTypes,be=bl.responseFields,bg,bi,bf,e;for(bi in be){if(bi in bh){bk[be[bi]]=bh[bi]}}while(bj[0]==="*"){bj.shift();if(bg===H){bg=bl.mimeType||bk.getResponseHeader("content-type")}}if(bg){for(bi in bd){if(bd[bi]&&bd[bi].test(bg)){bj.unshift(bi);break}}}if(bj[0] in bh){bf=bj[0]}else{for(bi in bh){if(!bj[0]||bl.converters[bi+" "+bj[0]]){bf=bi;break}if(!e){e=bi}}bf=bf||e}if(bf){if(bf!==bj[0]){bj.unshift(bf)}return bh[bf]}}function D(bp,bh){if(bp.dataFilter){bh=bp.dataFilter(bh,bp.dataType)}var bl=bp.dataTypes,bo={},bi,bm,be=bl.length,bj,bk=bl[0],bf,bg,bn,bd,e;for(bi=1;bi<be;bi++){if(bi===1){for(bm in bp.converters){if(typeof bm==="string"){bo[bm.toLowerCase()]=bp.converters[bm]}}}bf=bk;bk=bl[bi];if(bk==="*"){bk=bf}else{if(bf!=="*"&&bf!==bk){bg=bf+" "+bk;bn=bo[bg]||bo["* "+bk];if(!bn){e=H;for(bd in bo){bj=bd.split(" ");if(bj[0]===bf||bj[0]==="*"){e=bo[bj[1]+" "+bk];if(e){bd=bo[bd];if(bd===true){bn=e}else{if(e===true){bn=bd}}break}}}}if(!(bn||e)){a.error("No conversion from "+bg.replace(" "," to "))}if(bn!==true){bh=bn?bn(bh):e(bd(bh))}}}}return bh}var aq=a.now(),t=/(\=)\?(&|$)|()\?\?()/i;a.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return a.expando+"_"+(aq++)}});a.ajaxPrefilter("json jsonp",function(bm,bi,bl){var bk=(typeof bm.data==="string");if(bm.dataTypes[0]==="jsonp"||bi.jsonpCallback||bi.jsonp!=null||bm.jsonp!==false&&(t.test(bm.url)||bk&&t.test(bm.data))){var bj,be=bm.jsonpCallback=a.isFunction(bm.jsonpCallback)?bm.jsonpCallback():bm.jsonpCallback,bh=aY[be],e=bm.url,bg=bm.data,bd="$1"+be+"$2",bf=function(){aY[be]=bh;if(bj&&a.isFunction(bh)){aY[be](bj[0])}};if(bm.jsonp!==false){e=e.replace(t,bd);if(bm.url===e){if(bk){bg=bg.replace(t,bd)}if(bm.data===bg){e+=(/\?/.test(e)?"&":"?")+bm.jsonp+"="+be}}}bm.url=e;bm.data=bg;aY[be]=function(bn){bj=[bn]};bl.then(bf,bf);bm.converters["script json"]=function(){if(!bj){a.error(be+" was not called")}return bj[0]};bm.dataTypes[0]="json";return"script"}});a.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(e){a.globalEval(e);return e}}});a.ajaxPrefilter("script",function(e){if(e.cache===H){e.cache=false}if(e.crossDomain){e.type="GET";e.global=false}});a.ajaxTransport("script",function(be){if(be.crossDomain){var e,bd=al.head||al.getElementsByTagName("head")[0]||al.documentElement;return{send:function(bf,bg){e=al.createElement("script");e.async="async";if(be.scriptCharset){e.charset=be.scriptCharset}e.src=be.url;e.onload=e.onreadystatechange=function(bi,bh){if(!e.readyState||/loaded|complete/.test(e.readyState)){e.onload=e.onreadystatechange=null;if(bd&&e.parentNode){bd.removeChild(e)}e=H;if(!bh){bg(200,"success")}}};bd.insertBefore(e,bd.firstChild)},abort:function(){if(e){e.onload(0,1)}}}}});var x=a.now(),J,at;function A(){a(aY).unload(function(){for(var e in J){J[e](0,1)}})}function aA(){try{return new aY.XMLHttpRequest()}catch(bd){}}function ad(){try{return new aY.ActiveXObject("Microsoft.XMLHTTP")}catch(bd){}}a.ajaxSettings.xhr=aY.ActiveXObject?function(){return !this.isLocal&&aA()||ad()}:aA;at=a.ajaxSettings.xhr();a.support.ajax=!!at;a.support.cors=at&&("withCredentials" in at);at=H;if(a.support.ajax){a.ajaxTransport(function(e){if(!e.crossDomain||a.support.cors){var bd;return{send:function(bj,be){var bi=e.xhr(),bh,bg;if(e.username){bi.open(e.type,e.url,e.async,e.username,e.password)}else{bi.open(e.type,e.url,e.async)}if(e.xhrFields){for(bg in e.xhrFields){bi[bg]=e.xhrFields[bg]}}if(e.mimeType&&bi.overrideMimeType){bi.overrideMimeType(e.mimeType)}if(!(e.crossDomain&&!e.hasContent)&&!bj["X-Requested-With"]){bj["X-Requested-With"]="XMLHttpRequest"}try{for(bg in bj){bi.setRequestHeader(bg,bj[bg])}}catch(bf){}bi.send((e.hasContent&&e.data)||null);bd=function(bs,bm){var bn,bl,bk,bq,bp;try{if(bd&&(bm||bi.readyState===4)){bd=H;if(bh){bi.onreadystatechange=a.noop;delete J[bh]}if(bm){if(bi.readyState!==4){bi.abort()}}else{bn=bi.status;bk=bi.getAllResponseHeaders();bq={};bp=bi.responseXML;if(bp&&bp.documentElement){bq.xml=bp}bq.text=bi.responseText;try{bl=bi.statusText}catch(br){bl=""}if(!bn&&e.isLocal&&!e.crossDomain){bn=bq.text?200:404}else{if(bn===1223){bn=204}}}}}catch(bo){if(!bm){be(-1,bo)}}if(bq){be(bn,bl,bq,bk)}};if(!e.async||bi.readyState===4){bd()}else{if(!J){J={};A()}bh=x++;bi.onreadystatechange=J[bh]=bd}},abort:function(){if(bd){bd(0,1)}}}}})}var N={},ap=/^(?:toggle|show|hide)$/,aF=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,aS,ax=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];a.fn.extend({show:function(bf,bi,bh){var be,bg;if(bf||bf===0){return this.animate(aQ("show",3),bf,bi,bh)}else{for(var bd=0,e=this.length;bd<e;bd++){be=this[bd];bg=be.style.display;if(!a._data(be,"olddisplay")&&bg==="none"){bg=be.style.display=""}if(bg===""&&a.css(be,"display")==="none"){a._data(be,"olddisplay",w(be.nodeName))}}for(bd=0;bd<e;bd++){be=this[bd];bg=be.style.display;if(bg===""||bg==="none"){be.style.display=a._data(be,"olddisplay")||""}}return this}},hide:function(be,bh,bg){if(be||be===0){return this.animate(aQ("hide",3),be,bh,bg)}else{for(var bd=0,e=this.length;bd<e;bd++){var bf=a.css(this[bd],"display");if(bf!=="none"&&!a._data(this[bd],"olddisplay")){a._data(this[bd],"olddisplay",bf)}}for(bd=0;bd<e;bd++){this[bd].style.display="none"}return this}},_toggle:a.fn.toggle,toggle:function(be,bd,bf){var e=typeof be==="boolean";if(a.isFunction(be)&&a.isFunction(bd)){this._toggle.apply(this,arguments)}else{if(be==null||e){this.each(function(){var bg=e?be:a(this).is(":hidden");a(this)[bg?"show":"hide"]()})}else{this.animate(aQ("toggle",3),be,bd,bf)}}return this},fadeTo:function(e,bf,be,bd){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:bf},e,be,bd)},animate:function(bg,bd,bf,be){var e=a.speed(bd,bf,be);if(a.isEmptyObject(bg)){return this.each(e.complete)}return this[e.queue===false?"each":"queue"](function(){var bj=a.extend({},e),bn,bk=this.nodeType===1,bl=bk&&a(this).is(":hidden"),bh=this;for(bn in bg){var bi=a.camelCase(bn);if(bn!==bi){bg[bi]=bg[bn];delete bg[bn];bn=bi}if(bg[bn]==="hide"&&bl||bg[bn]==="show"&&!bl){return bj.complete.call(this)}if(bk&&(bn==="height"||bn==="width")){bj.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY];if(a.css(this,"display")==="inline"&&a.css(this,"float")==="none"){if(!a.support.inlineBlockNeedsLayout){this.style.display="inline-block"}else{var bm=w(this.nodeName);if(bm==="inline"){this.style.display="inline-block"}else{this.style.display="inline";this.style.zoom=1}}}}if(a.isArray(bg[bn])){(bj.specialEasing=bj.specialEasing||{})[bn]=bg[bn][1];bg[bn]=bg[bn][0]}}if(bj.overflow!=null){this.style.overflow="hidden"}bj.curAnim=a.extend({},bg);a.each(bg,function(bp,bt){var bs=new a.fx(bh,bj,bp);if(ap.test(bt)){bs[bt==="toggle"?bl?"show":"hide":bt](bg)}else{var br=aF.exec(bt),bu=bs.cur();if(br){var bo=parseFloat(br[2]),bq=br[3]||(a.cssNumber[bp]?"":"px");if(bq!=="px"){a.style(bh,bp,(bo||1)+bq);bu=((bo||1)/bs.cur())*bu;a.style(bh,bp,bu+bq)}if(br[1]){bo=((br[1]==="-="?-1:1)*bo)+bu}bs.custom(bu,bo,bq)}else{bs.custom(bu,bt,"")}}});return true})},stop:function(bd,e){var be=a.timers;if(bd){this.queue([])}this.each(function(){for(var bf=be.length-1;bf>=0;bf--){if(be[bf].elem===this){if(e){be[bf](true)}be.splice(bf,1)}}});if(!e){this.dequeue()}return this}});function aQ(bd,e){var be={};a.each(ax.concat.apply([],ax.slice(0,e)),function(){be[this]=bd});return be}a.each({slideDown:aQ("show",1),slideUp:aQ("hide",1),slideToggle:aQ("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,bd){a.fn[e]=function(be,bg,bf){return this.animate(bd,be,bg,bf)}});a.extend({speed:function(be,bf,bd){var e=be&&typeof be==="object"?a.extend({},be):{complete:bd||!bd&&bf||a.isFunction(be)&&be,duration:be,easing:bd&&bf||bf&&!a.isFunction(bf)&&bf};e.duration=a.fx.off?0:typeof e.duration==="number"?e.duration:e.duration in a.fx.speeds?a.fx.speeds[e.duration]:a.fx.speeds._default;e.old=e.complete;e.complete=function(){if(e.queue!==false){a(this).dequeue()}if(a.isFunction(e.old)){e.old.call(this)}};return e},easing:{linear:function(be,bf,e,bd){return e+bd*be},swing:function(be,bf,e,bd){return((-Math.cos(be*Math.PI)/2)+0.5)*bd+e}},timers:[],fx:function(bd,e,be){this.options=e;this.elem=bd;this.prop=be;if(!e.orig){e.orig={}}}});a.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(a.fx.step[this.prop]||a.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 e,bd=a.css(this.elem,this.prop);return isNaN(e=parseFloat(bd))?!bd||bd==="auto"?0:bd:e},custom:function(bh,bg,bf){var e=this,be=a.fx;this.startTime=a.now();this.start=bh;this.end=bg;this.unit=bf||this.unit||(a.cssNumber[this.prop]?"":"px");this.now=this.start;this.pos=this.state=0;function bd(bi){return e.step(bi)}bd.elem=this.elem;if(bd()&&a.timers.push(bd)&&!aS){aS=setInterval(be.tick,be.interval)}},show:function(){this.options.orig[this.prop]=a.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());a(this.elem).show()},hide:function(){this.options.orig[this.prop]=a.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(bf){var bk=a.now(),bg=true;if(bf||bk>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var bh in this.options.curAnim){if(this.options.curAnim[bh]!==true){bg=false}}if(bg){if(this.options.overflow!=null&&!a.support.shrinkWrapBlocks){var be=this.elem,bl=this.options;a.each(["","X","Y"],function(bm,bn){be.style["overflow"+bn]=bl.overflow[bm]})}if(this.options.hide){a(this.elem).hide()}if(this.options.hide||this.options.show){for(var e in this.options.curAnim){a.style(this.elem,e,this.options.orig[e])}}this.options.complete.call(this.elem)}return false}else{var bd=bk-this.startTime;this.state=bd/this.options.duration;var bi=this.options.specialEasing&&this.options.specialEasing[this.prop];var bj=this.options.easing||(a.easing.swing?"swing":"linear");this.pos=a.easing[bi||bj](this.state,bd,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};a.extend(a.fx,{tick:function(){var bd=a.timers;for(var e=0;e<bd.length;e++){if(!bd[e]()){bd.splice(e--,1)}}if(!bd.length){a.fx.stop()}},interval:13,stop:function(){clearInterval(aS);aS=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(e){a.style(e.elem,"opacity",e.now)},_default:function(e){if(e.elem.style&&e.elem.style[e.prop]!=null){e.elem.style[e.prop]=(e.prop==="width"||e.prop==="height"?Math.max(0,e.now):e.now)+e.unit}else{e.elem[e.prop]=e.now}}}});if(a.expr&&a.expr.filters){a.expr.filters.animated=function(e){return a.grep(a.timers,function(bd){return e===bd.elem}).length}}function w(be){if(!N[be]){var e=a("<"+be+">").appendTo("body"),bd=e.css("display");e.remove();if(bd==="none"||bd===""){bd="block"}N[be]=bd}return N[be]}var S=/^t(?:able|d|h)$/i,Y=/^(?:body|html)$/i;if("getBoundingClientRect" in al.documentElement){a.fn.offset=function(bq){var bg=this[0],bj;if(bq){return this.each(function(e){a.offset.setOffset(this,bq,e)})}if(!bg||!bg.ownerDocument){return null}if(bg===bg.ownerDocument.body){return a.offset.bodyOffset(bg)}try{bj=bg.getBoundingClientRect()}catch(bn){}var bp=bg.ownerDocument,be=bp.documentElement;if(!bj||!a.contains(be,bg)){return bj?{top:bj.top,left:bj.left}:{top:0,left:0}}var bk=bp.body,bl=az(bp),bi=be.clientTop||bk.clientTop||0,bm=be.clientLeft||bk.clientLeft||0,bd=(bl.pageYOffset||a.support.boxModel&&be.scrollTop||bk.scrollTop),bh=(bl.pageXOffset||a.support.boxModel&&be.scrollLeft||bk.scrollLeft),bo=bj.top+bd-bi,bf=bj.left+bh-bm;return{top:bo,left:bf}}}else{a.fn.offset=function(bn){var bh=this[0];if(bn){return this.each(function(bo){a.offset.setOffset(this,bn,bo)})}if(!bh||!bh.ownerDocument){return null}if(bh===bh.ownerDocument.body){return a.offset.bodyOffset(bh)}a.offset.initialize();var bk,be=bh.offsetParent,bd=bh,bm=bh.ownerDocument,bf=bm.documentElement,bi=bm.body,bj=bm.defaultView,e=bj?bj.getComputedStyle(bh,null):bh.currentStyle,bl=bh.offsetTop,bg=bh.offsetLeft;while((bh=bh.parentNode)&&bh!==bi&&bh!==bf){if(a.offset.supportsFixedPosition&&e.position==="fixed"){break}bk=bj?bj.getComputedStyle(bh,null):bh.currentStyle;bl-=bh.scrollTop;bg-=bh.scrollLeft;if(bh===be){bl+=bh.offsetTop;bg+=bh.offsetLeft;if(a.offset.doesNotAddBorder&&!(a.offset.doesAddBorderForTableAndCells&&S.test(bh.nodeName))){bl+=parseFloat(bk.borderTopWidth)||0;bg+=parseFloat(bk.borderLeftWidth)||0}bd=be;be=bh.offsetParent}if(a.offset.subtractsBorderForOverflowNotVisible&&bk.overflow!=="visible"){bl+=parseFloat(bk.borderTopWidth)||0;bg+=parseFloat(bk.borderLeftWidth)||0}e=bk}if(e.position==="relative"||e.position==="static"){bl+=bi.offsetTop;bg+=bi.offsetLeft}if(a.offset.supportsFixedPosition&&e.position==="fixed"){bl+=Math.max(bf.scrollTop,bi.scrollTop);bg+=Math.max(bf.scrollLeft,bi.scrollLeft)}return{top:bl,left:bg}}}a.offset={initialize:function(){var e=al.body,bd=al.createElement("div"),bg,bi,bh,bj,be=parseFloat(a.css(e,"marginTop"))||0,bf="<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.extend(bd.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"});bd.innerHTML=bf;e.insertBefore(bd,e.firstChild);bg=bd.firstChild;bi=bg.firstChild;bj=bg.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(bi.offsetTop!==5);this.doesAddBorderForTableAndCells=(bj.offsetTop===5);bi.style.position="fixed";bi.style.top="20px";this.supportsFixedPosition=(bi.offsetTop===20||bi.offsetTop===15);bi.style.position=bi.style.top="";bg.style.overflow="hidden";bg.style.position="relative";this.subtractsBorderForOverflowNotVisible=(bi.offsetTop===-5);this.doesNotIncludeMarginInBodyOffset=(e.offsetTop!==be);e.removeChild(bd);e=bd=bg=bi=bh=bj=null;a.offset.initialize=a.noop},bodyOffset:function(e){var be=e.offsetTop,bd=e.offsetLeft;a.offset.initialize();if(a.offset.doesNotIncludeMarginInBodyOffset){be+=parseFloat(a.css(e,"marginTop"))||0;bd+=parseFloat(a.css(e,"marginLeft"))||0}return{top:be,left:bd}},setOffset:function(bf,bo,bi){var bj=a.css(bf,"position");if(bj==="static"){bf.style.position="relative"}var bh=a(bf),bd=bh.offset(),e=a.css(bf,"top"),bm=a.css(bf,"left"),bn=(bj==="absolute"&&a.inArray("auto",[e,bm])>-1),bl={},bk={},be,bg;if(bn){bk=bh.position()}be=bn?bk.top:parseInt(e,10)||0;bg=bn?bk.left:parseInt(bm,10)||0;if(a.isFunction(bo)){bo=bo.call(bf,bi,bd)}if(bo.top!=null){bl.top=(bo.top-bd.top)+be}if(bo.left!=null){bl.left=(bo.left-bd.left)+bg}if("using" in bo){bo.using.call(bf,bl)}else{bh.css(bl)}}};a.fn.extend({position:function(){if(!this[0]){return null}var be=this[0],bd=this.offsetParent(),bf=this.offset(),e=Y.test(bd[0].nodeName)?{top:0,left:0}:bd.offset();bf.top-=parseFloat(a.css(be,"marginTop"))||0;bf.left-=parseFloat(a.css(be,"marginLeft"))||0;e.top+=parseFloat(a.css(bd[0],"borderTopWidth"))||0;e.left+=parseFloat(a.css(bd[0],"borderLeftWidth"))||0;return{top:bf.top-e.top,left:bf.left-e.left}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||al.body;while(e&&(!Y.test(e.nodeName)&&a.css(e,"position")==="static")){e=e.offsetParent}return e})}});a.each(["Left","Top"],function(bd,e){var be="scroll"+e;a.fn[be]=function(bh){var bf=this[0],bg;if(!bf){return null}if(bh!==H){return this.each(function(){bg=az(this);if(bg){bg.scrollTo(!bd?bh:a(bg).scrollLeft(),bd?bh:a(bg).scrollTop())}else{this[be]=bh}})}else{bg=az(bf);return bg?("pageXOffset" in bg)?bg[bd?"pageYOffset":"pageXOffset"]:a.support.boxModel&&bg.document.documentElement[be]||bg.document.body[be]:bf[be]}}});function az(e){return a.isWindow(e)?e:e.nodeType===9?e.defaultView||e.parentWindow:false}a.each(["Height","Width"],function(bd,e){var be=e.toLowerCase();a.fn["inner"+e]=function(){return this[0]?parseFloat(a.css(this[0],be,"padding")):null};a.fn["outer"+e]=function(bf){return this[0]?parseFloat(a.css(this[0],be,bf?"margin":"border")):null};a.fn[be]=function(bg){var bh=this[0];if(!bh){return bg==null?null:this}if(a.isFunction(bg)){return this.each(function(bl){var bk=a(this);bk[be](bg.call(this,bl,bk[be]()))})}if(a.isWindow(bh)){var bi=bh.document.documentElement["client"+e];return bh.document.compatMode==="CSS1Compat"&&bi||bh.document.body["client"+e]||bi}else{if(bh.nodeType===9){return Math.max(bh.documentElement["client"+e],bh.body["scroll"+e],bh.documentElement["scroll"+e],bh.body["offset"+e],bh.documentElement["offset"+e])}else{if(bg===H){var bj=a.css(bh,be),bf=parseFloat(bj);return a.isNaN(bf)?bj:bf}else{return this.css(be,typeof bg==="string"?bg:bg+"px")}}}}});aY.jQuery=aY.$=a})(window);
@@ -0,0 +1,2675 @@
1
+ /*
2
+ * qTip2 - Pretty powerful tooltips
3
+ * http://craigsworks.com/projects/qtip2/
4
+ *
5
+ * Version: nightly
6
+ * Copyright 2009-2010 Craig Michael Thompson - http://craigsworks.com
7
+ *
8
+ * Dual licensed under MIT or GPLv2 licenses
9
+ * http://en.wikipedia.org/wiki/MIT_License
10
+ * http://en.wikipedia.org/wiki/GNU_General_Public_License
11
+ *
12
+ * Date: Sun Nov 13 11:19:27.0000000000 2011
13
+ */
14
+
15
+ /*jslint browser: true, onevar: true, undef: true, nomen: true, bitwise: true, regexp: true, newcap: true, immed: true, strict: true */
16
+ /*global window: false, jQuery: false, console: false */
17
+
18
+
19
+ (function($, window, undefined) {
20
+
21
+ "use strict"; // Enable ECMAScript "strict" operation for this function. See more: http://ejohn.org/blog/ecmascript-5-strict-mode-json-and-more/
22
+
23
+ // Munge the primitives - Paul Irish tip
24
+ var TRUE = true,
25
+ FALSE = false,
26
+ NULL = null,
27
+
28
+ // Shortcut vars
29
+ QTIP, PLUGINS, MOUSE,
30
+ usedIDs = {},
31
+ uitooltip = 'ui-tooltip',
32
+ widget = 'ui-widget',
33
+ disabled = 'ui-state-disabled',
34
+ selector = 'div.qtip.'+uitooltip,
35
+ defaultClass = uitooltip + '-default',
36
+ focusClass = uitooltip + '-focus',
37
+ hoverClass = uitooltip + '-hover',
38
+ fluidClass = uitooltip + '-fluid',
39
+ hideOffset = '-31000px',
40
+ replaceSuffix = '_replacedByqTip',
41
+ oldtitle = 'oldtitle',
42
+ trackingBound;
43
+
44
+ /* Thanks to Paul Irish for this one: http://paulirish.com/2009/log-a-lightweight-wrapper-for-consolelog/ */
45
+ function log() {
46
+ log.history = log.history || [];
47
+ log.history.push(arguments);
48
+
49
+ // Make sure console is present
50
+ if('object' === typeof console) {
51
+
52
+ // Setup console and arguments
53
+ var c = console[ console.warn ? 'warn' : 'log' ],
54
+ args = Array.prototype.slice.call(arguments), a;
55
+
56
+ // Add qTip2 marker to first argument if it's a string
57
+ if(typeof arguments[0] === 'string') { args[0] = 'qTip2: ' + args[0]; }
58
+
59
+ // Apply console.warn or .log if not supported
60
+ a = c.apply ? c.apply(console, args) : c(args);
61
+ }
62
+ }
63
+
64
+ // Option object sanitizer
65
+ function sanitizeOptions(opts)
66
+ {
67
+ var content;
68
+
69
+ if(!opts || 'object' !== typeof opts) { return FALSE; }
70
+
71
+ if(opts.metadata === NULL || 'object' !== typeof opts.metadata) {
72
+ opts.metadata = {
73
+ type: opts.metadata
74
+ };
75
+ }
76
+
77
+ if('content' in opts) {
78
+ if(opts.content === NULL || 'object' !== typeof opts.content || opts.content.jquery) {
79
+ opts.content = {
80
+ text: opts.content
81
+ };
82
+ }
83
+
84
+ content = opts.content.text || FALSE;
85
+ if(!$.isFunction(content) && ((!content && !content.attr) || content.length < 1 || ('object' === typeof content && !content.jquery))) {
86
+ opts.content.text = FALSE;
87
+ }
88
+
89
+ if('title' in opts.content) {
90
+ if(opts.content.title === NULL || 'object' !== typeof opts.content.title) {
91
+ opts.content.title = {
92
+ text: opts.content.title
93
+ };
94
+ }
95
+
96
+ content = opts.content.title.text || FALSE;
97
+ if(!$.isFunction(content) && ((!content && !content.attr) || content.length < 1 || ('object' === typeof content && !content.jquery))) {
98
+ opts.content.title.text = FALSE;
99
+ }
100
+ }
101
+ }
102
+
103
+ if('position' in opts) {
104
+ if(opts.position === NULL || 'object' !== typeof opts.position) {
105
+ opts.position = {
106
+ my: opts.position,
107
+ at: opts.position
108
+ };
109
+ }
110
+ }
111
+
112
+ if('show' in opts) {
113
+ if(opts.show === NULL || 'object' !== typeof opts.show) {
114
+ if(opts.show.jquery) {
115
+ opts.show = { target: opts.show };
116
+ }
117
+ else {
118
+ opts.show = { event: opts.show };
119
+ }
120
+ }
121
+ }
122
+
123
+ if('hide' in opts) {
124
+ if(opts.hide === NULL || 'object' !== typeof opts.hide) {
125
+ if(opts.hide.jquery) {
126
+ opts.hide = { target: opts.hide };
127
+ }
128
+ else {
129
+ opts.hide = { event: opts.hide };
130
+ }
131
+ }
132
+ }
133
+
134
+ if('style' in opts) {
135
+ if(opts.style === NULL || 'object' !== typeof opts.style) {
136
+ opts.style = {
137
+ classes: opts.style
138
+ };
139
+ }
140
+ }
141
+
142
+ // Sanitize plugin options
143
+ $.each(PLUGINS, function() {
144
+ if(this.sanitize) { this.sanitize(opts); }
145
+ });
146
+
147
+ return opts;
148
+ }
149
+
150
+ /*
151
+ * Core plugin implementation
152
+ */
153
+ function QTip(target, options, id, attr)
154
+ {
155
+ // Declare this reference
156
+ var self = this,
157
+ docBody = document.body,
158
+ tooltipID = uitooltip + '-' + id,
159
+ isPositioning = 0,
160
+ isDrawing = 0,
161
+ tooltip = $(),
162
+ namespace = '.qtip-' + id,
163
+ elements, cache;
164
+
165
+ // Setup class attributes
166
+ self.id = id;
167
+ self.rendered = FALSE;
168
+ self.elements = elements = { target: target };
169
+ self.timers = { img: {} };
170
+ self.options = options;
171
+ self.checks = {};
172
+ self.plugins = {};
173
+ self.cache = cache = {
174
+ event: {},
175
+ target: $(),
176
+ disabled: FALSE,
177
+ attr: attr
178
+ };
179
+
180
+ /*
181
+ * Private core functions
182
+ */
183
+ function convertNotation(notation)
184
+ {
185
+ var i = 0, obj, option = options,
186
+
187
+ // Split notation into array
188
+ levels = notation.split('.');
189
+
190
+ // Loop through
191
+ while( option = option[ levels[i++] ] ) {
192
+ if(i < levels.length) { obj = option; }
193
+ }
194
+
195
+ return [obj || options, levels.pop()];
196
+ }
197
+
198
+ function setWidget() {
199
+ var on = options.style.widget;
200
+
201
+ tooltip.toggleClass(widget, on).toggleClass(defaultClass, !on);
202
+ elements.content.toggleClass(widget+'-content', on);
203
+
204
+ if(elements.titlebar){
205
+ elements.titlebar.toggleClass(widget+'-header', on);
206
+ }
207
+ if(elements.button){
208
+ elements.button.toggleClass(uitooltip+'-icon', !on);
209
+ }
210
+ }
211
+
212
+ function removeTitle(reposition)
213
+ {
214
+ if(elements.title) {
215
+ elements.titlebar.remove();
216
+ elements.titlebar = elements.title = elements.button = NULL;
217
+
218
+ // Reposition if enabled
219
+ if(reposition !== FALSE) { self.reposition(); }
220
+ }
221
+ }
222
+
223
+ function createButton()
224
+ {
225
+ var button = options.content.title.button,
226
+ isString = typeof button === 'string',
227
+ close = isString ? button : 'Close tooltip';
228
+
229
+ if(elements.button) { elements.button.remove(); }
230
+
231
+ // Use custom button if one was supplied by user, else use default
232
+ if(button.jquery) {
233
+ elements.button = button;
234
+ }
235
+ else {
236
+ elements.button = $('<a />', {
237
+ 'class': 'ui-state-default ui-tooltip-close ' + (options.style.widget ? '' : uitooltip+'-icon'),
238
+ 'title': close,
239
+ 'aria-label': close
240
+ })
241
+ .prepend(
242
+ $('<span />', {
243
+ 'class': 'ui-icon ui-icon-close',
244
+ 'html': '&times;'
245
+ })
246
+ );
247
+ }
248
+
249
+ // Create button and setup attributes
250
+ elements.button.appendTo(elements.titlebar)
251
+ .attr('role', 'button')
252
+ .click(function(event) {
253
+ if(!tooltip.hasClass(disabled)) { self.hide(event); }
254
+ return FALSE;
255
+ });
256
+
257
+ // Redraw the tooltip when we're done
258
+ self.redraw();
259
+ }
260
+
261
+ function createTitle()
262
+ {
263
+ var id = tooltipID+'-title';
264
+
265
+ // Destroy previous title element, if present
266
+ if(elements.titlebar) { removeTitle(); }
267
+
268
+ // Create title bar and title elements
269
+ elements.titlebar = $('<div />', {
270
+ 'class': uitooltip + '-titlebar ' + (options.style.widget ? 'ui-widget-header' : '')
271
+ })
272
+ .append(
273
+ elements.title = $('<div />', {
274
+ 'id': id,
275
+ 'class': uitooltip + '-title',
276
+ 'aria-atomic': TRUE
277
+ })
278
+ )
279
+ .insertBefore(elements.content)
280
+
281
+ // Button-specific events
282
+ .delegate('.ui-tooltip-close', 'mousedown keydown mouseup keyup mouseout', function(event) {
283
+ $(this).toggleClass('ui-state-active ui-state-focus', event.type.substr(-4) === 'down');
284
+ })
285
+ .delegate('.ui-tooltip-close', 'mouseover mouseout', function(event){
286
+ $(this).toggleClass('ui-state-hover', event.type === 'mouseover');
287
+ });
288
+
289
+ // Create button if enabled
290
+ if(options.content.title.button) { createButton(); }
291
+
292
+ // Redraw the tooltip dimensions if it's rendered
293
+ else if(self.rendered){ self.redraw(); }
294
+ }
295
+
296
+ function updateButton(button)
297
+ {
298
+ var elem = elements.button,
299
+ title = elements.title;
300
+
301
+ // Make sure tooltip is rendered and if not, return
302
+ if(!self.rendered) { return FALSE; }
303
+
304
+ if(!button) {
305
+ elem.remove();
306
+ }
307
+ else {
308
+ if(!title) {
309
+ createTitle();
310
+ }
311
+ createButton();
312
+ }
313
+ }
314
+
315
+ function updateTitle(content, reposition)
316
+ {
317
+ var elem = elements.title;
318
+
319
+ // Make sure tooltip is rendered and if not, return
320
+ if(!self.rendered || !content) { return FALSE; }
321
+
322
+ // Use function to parse content
323
+ if($.isFunction(content)) {
324
+ content = content.call(target, cache.event, self);
325
+ }
326
+
327
+ // Remove title if callback returns false
328
+ if(content === FALSE) { return removeTitle(FALSE); }
329
+
330
+ // Append new content if its a DOM array and show it if hidden
331
+ else if(content.jquery && content.length > 0) {
332
+ elem.empty().append(content.css({ display: 'block' }));
333
+ }
334
+
335
+ // Content is a regular string, insert the new content
336
+ else { elem.html(content); }
337
+
338
+ // Redraw and reposition
339
+ self.redraw();
340
+ if(reposition !== FALSE && self.rendered && tooltip.is(':visible')) {
341
+ self.reposition(cache.event);
342
+ }
343
+ }
344
+
345
+ function updateContent(content, reposition)
346
+ {
347
+ var elem = elements.content;
348
+
349
+ // Make sure tooltip is rendered and content is defined. If not return
350
+ if(!self.rendered || !content) { return FALSE; }
351
+
352
+ // Use function to parse content
353
+ if($.isFunction(content)) {
354
+ content = content.call(target, cache.event, self) || '';
355
+ }
356
+
357
+ // Append new content if its a DOM array and show it if hidden
358
+ if(content.jquery && content.length > 0) {
359
+ elem.empty().append(content.css({ display: 'block' }));
360
+ }
361
+
362
+ // Content is a regular string, insert the new content
363
+ else { elem.html(content); }
364
+
365
+ // Image detection
366
+ function detectImages(next) {
367
+ var images, srcs = {};
368
+
369
+ function imageLoad(image) {
370
+ // Clear src from object and any timers and events associated with the image
371
+ if(image) {
372
+ delete srcs[image.src];
373
+ clearTimeout(self.timers.img[image.src]);
374
+ $(image).unbind(namespace);
375
+ }
376
+
377
+ // If queue is empty after image removal, update tooltip and continue the queue
378
+ if($.isEmptyObject(srcs)) {
379
+ self.redraw();
380
+ if(reposition !== FALSE) {
381
+ self.reposition(cache.event);
382
+ }
383
+
384
+ next();
385
+ }
386
+ }
387
+
388
+ // Find all content images without dimensions, and if no images were found, continue
389
+ if((images = elem.find('img:not([height]):not([width])')).length === 0) { return imageLoad(); }
390
+
391
+ // Apply timer to each image to poll for dimensions
392
+ images.each(function(i, elem) {
393
+ // Skip if the src is already present
394
+ if(srcs[elem.src] !== undefined) { return; }
395
+
396
+ // Keep track of how many times we poll for image dimensions.
397
+ // If it doesn't return in a reasonable amount of time, it's better
398
+ // to display the tooltip, rather than hold up the queue.
399
+ var iterations = 0, maxIterations = 3;
400
+
401
+ (function timer(){
402
+ // When the dimensions are found, remove the image from the queue
403
+ if(elem.height || elem.width || (iterations > maxIterations)) { return imageLoad(elem); }
404
+
405
+ iterations += 1;
406
+
407
+ // Restart timer
408
+ self.timers.img[elem.src] = setTimeout(timer, 700);
409
+ }());
410
+
411
+ // Also apply regular load/error event handlers
412
+ $(elem).bind('error'+namespace+' load'+namespace, function(){ imageLoad(this); });
413
+
414
+ // Store the src and element in our object
415
+ srcs[elem.src] = elem;
416
+ });
417
+ }
418
+
419
+ /*
420
+ * If we're still rendering... insert into 'fx' queue our image dimension
421
+ * checker which will halt the showing of the tooltip until image dimensions
422
+ * can be detected properly.
423
+ */
424
+ if(self.rendered < 0) { tooltip.queue('fx', detectImages); }
425
+
426
+ // We're fully rendered, so reset isDrawing flag and proceed without queue delay
427
+ else { isDrawing = 0; detectImages($.noop); }
428
+
429
+ return self;
430
+ }
431
+
432
+ function assignEvents()
433
+ {
434
+ var posOptions = options.position,
435
+ targets = {
436
+ show: options.show.target,
437
+ hide: options.hide.target,
438
+ viewport: $(posOptions.viewport),
439
+ document: $(document),
440
+ body: $(document.body),
441
+ window: $(window)
442
+ },
443
+ events = {
444
+ show: $.trim('' + options.show.event).split(' '),
445
+ hide: $.trim('' + options.hide.event).split(' ')
446
+ },
447
+ IE6 = $.browser.msie && parseInt($.browser.version, 10) === 6;
448
+
449
+ // Define show event method
450
+ function showMethod(event)
451
+ {
452
+ if(tooltip.hasClass(disabled)) { return FALSE; }
453
+
454
+ // Clear hide timers
455
+ clearTimeout(self.timers.show);
456
+ clearTimeout(self.timers.hide);
457
+
458
+ // Start show timer
459
+ var callback = function(){ self.toggle(TRUE, event); };
460
+ if(options.show.delay > 0) {
461
+ self.timers.show = setTimeout(callback, options.show.delay);
462
+ }
463
+ else{ callback(); }
464
+ }
465
+
466
+ // Define hide method
467
+ function hideMethod(event)
468
+ {
469
+ if(tooltip.hasClass(disabled) || isPositioning || isDrawing) { return FALSE; }
470
+
471
+ // Check if new target was actually the tooltip element
472
+ var relatedTarget = $(event.relatedTarget || event.target),
473
+ ontoTooltip = relatedTarget.closest(selector)[0] === tooltip[0],
474
+ ontoTarget = relatedTarget[0] === targets.show[0];
475
+
476
+ // Clear timers and stop animation queue
477
+ clearTimeout(self.timers.show);
478
+ clearTimeout(self.timers.hide);
479
+
480
+ // Prevent hiding if tooltip is fixed and event target is the tooltip. Or if mouse positioning is enabled and cursor momentarily overlaps
481
+ if((posOptions.target === 'mouse' && ontoTooltip) || (options.hide.fixed && ((/mouse(out|leave|move)/).test(event.type) && (ontoTooltip || ontoTarget)))) {
482
+ try { event.preventDefault(); event.stopImmediatePropagation(); } catch(e) {} return;
483
+ }
484
+
485
+ // If tooltip has displayed, start hide timer
486
+ if(options.hide.delay > 0) {
487
+ self.timers.hide = setTimeout(function(){ self.hide(event); }, options.hide.delay);
488
+ }
489
+ else{ self.hide(event); }
490
+ }
491
+
492
+ // Define inactive method
493
+ function inactiveMethod(event)
494
+ {
495
+ if(tooltip.hasClass(disabled)) { return FALSE; }
496
+
497
+ // Clear timer
498
+ clearTimeout(self.timers.inactive);
499
+ self.timers.inactive = setTimeout(function(){ self.hide(event); }, options.hide.inactive);
500
+ }
501
+
502
+ function repositionMethod(event) {
503
+ if(tooltip.is(':visible')) { self.reposition(event); }
504
+ }
505
+
506
+ // On mouseenter/mouseleave...
507
+ tooltip.bind('mouseenter'+namespace+' mouseleave'+namespace, function(event) {
508
+ var state = event.type === 'mouseenter';
509
+
510
+ // Focus the tooltip on mouseenter (z-index stacking)
511
+ if(state) { self.focus(event); }
512
+
513
+ // Add hover class
514
+ tooltip.toggleClass(hoverClass, state);
515
+ });
516
+
517
+ // Enable hide.fixed
518
+ if(options.hide.fixed) {
519
+ // Add tooltip as a hide target
520
+ targets.hide = targets.hide.add(tooltip);
521
+
522
+ // Clear hide timer on tooltip hover to prevent it from closing
523
+ tooltip.bind('mouseover'+namespace, function() {
524
+ if(!tooltip.hasClass(disabled)) { clearTimeout(self.timers.hide); }
525
+ });
526
+ }
527
+
528
+ // If using mouseout/mouseleave as a hide event...
529
+ if(/mouse(out|leave)/i.test(options.hide.event)) {
530
+ // Hide tooltips when leaving current window/frame (but not select/option elements)
531
+ if(options.hide.leave === 'window') {
532
+ targets.window.bind('mouseout' + namespace, function(event) {
533
+ if(/select|option/.test(event.target) && !event.relatedTarget) { self.hide(event); }
534
+ });
535
+ }
536
+ }
537
+
538
+ /*
539
+ * Make sure hoverIntent functions properly by using mouseleave to clear show timer if
540
+ * mouseenter/mouseout is used for show.event, even if it isn't in the users options.
541
+ */
542
+ else if(/mouse(over|enter)/i.test(options.show.event)) {
543
+ targets.hide.bind('mouseleave'+namespace, function(event) {
544
+ clearTimeout(self.timers.show);
545
+ });
546
+ }
547
+
548
+ // Hide tooltip on document mousedown if unfocus events are enabled
549
+ if(('' + options.hide.event).indexOf('unfocus') > -1) {
550
+ targets.body.bind('mousedown'+namespace, function(event) {
551
+ var $target = $(event.target),
552
+ enabled = !tooltip.hasClass(disabled) && tooltip.is(':visible');
553
+
554
+ if($target[0] !== tooltip[0] && $target.parents(selector).length === 0 && $target.add(target).length > 1 && !$target.attr('disabled')) {
555
+ self.hide(event);
556
+ }
557
+ });
558
+ }
559
+
560
+ // Check if the tooltip hides when inactive
561
+ if('number' === typeof options.hide.inactive) {
562
+ // Bind inactive method to target as a custom event
563
+ targets.show.bind('qtip-'+id+'-inactive', inactiveMethod);
564
+
565
+ // Define events which reset the 'inactive' event handler
566
+ $.each(QTIP.inactiveEvents, function(index, type){
567
+ targets.hide.add(elements.tooltip).bind(type+namespace+'-inactive', inactiveMethod);
568
+ });
569
+ }
570
+
571
+ // Apply hide events
572
+ $.each(events.hide, function(index, type) {
573
+ var showIndex = $.inArray(type, events.show),
574
+ targetHide = $(targets.hide);
575
+
576
+ // Both events and targets are identical, apply events using a toggle
577
+ if((showIndex > -1 && targetHide.add(targets.show).length === targetHide.length) || type === 'unfocus')
578
+ {
579
+ targets.show.bind(type+namespace, function(event) {
580
+ if(tooltip.is(':visible')) { hideMethod(event); }
581
+ else { showMethod(event); }
582
+ });
583
+
584
+ // Don't bind the event again
585
+ delete events.show[ showIndex ];
586
+ }
587
+
588
+ // Events are not identical, bind normally
589
+ else { targets.hide.bind(type+namespace, hideMethod); }
590
+ });
591
+
592
+ // Apply show events
593
+ $.each(events.show, function(index, type) {
594
+ targets.show.bind(type+namespace, showMethod);
595
+ });
596
+
597
+ // Check if the tooltip hides when mouse is moved a certain distance
598
+ if('number' === typeof options.hide.distance) {
599
+ // Bind mousemove to target to detect distance difference
600
+ targets.show.add(tooltip).bind('mousemove'+namespace, function(event) {
601
+ var origin = cache.origin || {},
602
+ limit = options.hide.distance,
603
+ abs = Math.abs;
604
+
605
+ // Check if the movement has gone beyond the limit, and hide it if so
606
+ if(abs(event.pageX - origin.pageX) >= limit || abs(event.pageY - origin.pageY) >= limit) {
607
+ self.hide(event);
608
+ }
609
+ });
610
+ }
611
+
612
+ // Mouse positioning events
613
+ if(posOptions.target === 'mouse') {
614
+ // Cache mousemove coords on show targets
615
+ targets.show.bind('mousemove'+namespace, function(event) {
616
+ MOUSE = { pageX: event.pageX, pageY: event.pageY, type: 'mousemove' };
617
+ });
618
+
619
+ // If mouse adjustment is on...
620
+ if(posOptions.adjust.mouse) {
621
+ // Apply a mouseleave event so we don't get problems with overlapping
622
+ if(options.hide.event) {
623
+ tooltip.bind('mouseleave'+namespace, function(event) {
624
+ if((event.relatedTarget || event.target) !== targets.show[0]) { self.hide(event); }
625
+ });
626
+ }
627
+
628
+ // Update tooltip position on mousemove
629
+ targets.document.bind('mousemove'+namespace, function(event) {
630
+ // Update the tooltip position only if the tooltip is visible and adjustment is enabled
631
+ if(!tooltip.hasClass(disabled) && tooltip.is(':visible')) {
632
+ self.reposition(event || MOUSE);
633
+ }
634
+ });
635
+ }
636
+ }
637
+
638
+ // Adjust positions of the tooltip on window resize if enabled
639
+ if(posOptions.adjust.resize || targets.viewport.length) {
640
+ ($.event.special.resize ? targets.viewport : targets.window).bind('resize'+namespace, repositionMethod);
641
+ }
642
+
643
+ // Adjust tooltip position on scroll if screen adjustment is enabled
644
+ if(targets.viewport.length || (IE6 && tooltip.css('position') === 'fixed')) {
645
+ targets.viewport.bind('scroll'+namespace, repositionMethod);
646
+ }
647
+ }
648
+
649
+ function unassignEvents()
650
+ {
651
+ var targets = [
652
+ options.show.target[0],
653
+ options.hide.target[0],
654
+ self.rendered && elements.tooltip[0],
655
+ options.position.container[0],
656
+ options.position.viewport[0],
657
+ window,
658
+ document
659
+ ];
660
+
661
+ // Check if tooltip is rendered
662
+ if(self.rendered) {
663
+ $([]).pushStack( $.grep(targets, function(i){ return typeof i === 'object'; }) ).unbind(namespace);
664
+ }
665
+
666
+ // Tooltip isn't yet rendered, remove render event
667
+ else { options.show.target.unbind(namespace+'-create'); }
668
+ }
669
+
670
+ // Setup builtin .set() option checks
671
+ self.checks.builtin = {
672
+ // Core checks
673
+ '^id$': function(obj, o, v) {
674
+ var id = v === TRUE ? QTIP.nextid : v,
675
+ tooltipID = uitooltip + '-' + id;
676
+
677
+ if(id !== FALSE && id.length > 0 && !$('#'+tooltipID).length) {
678
+ tooltip[0].id = tooltipID;
679
+ elements.content[0].id = tooltipID + '-content';
680
+ elements.title[0].id = tooltipID + '-title';
681
+ }
682
+ },
683
+
684
+ // Content checks
685
+ '^content.text$': function(obj, o, v){ updateContent(v); },
686
+ '^content.title.text$': function(obj, o, v) {
687
+ // Remove title if content is null
688
+ if(!v) { return removeTitle(); }
689
+
690
+ // If title isn't already created, create it now and update
691
+ if(!elements.title && v) { createTitle(); }
692
+ updateTitle(v);
693
+ },
694
+ '^content.title.button$': function(obj, o, v){ updateButton(v); },
695
+
696
+ // Position checks
697
+ '^position.(my|at)$': function(obj, o, v){
698
+ // Parse new corner value into Corner objecct
699
+ if('string' === typeof v) {
700
+ obj[o] = new PLUGINS.Corner(v);
701
+ }
702
+ },
703
+ '^position.container$': function(obj, o, v){
704
+ if(self.rendered) { tooltip.appendTo(v); }
705
+ },
706
+
707
+ // Show checks
708
+ '^show.ready$': function() {
709
+ if(!self.rendered) { self.render(1); }
710
+ else { self.toggle(TRUE); }
711
+ },
712
+
713
+ // Style checks
714
+ '^style.classes$': function(obj, o, v) {
715
+ tooltip.attr('class', uitooltip + ' qtip ui-helper-reset ' + v);
716
+ },
717
+ '^style.widget|content.title': setWidget,
718
+
719
+ // Events check
720
+ '^events.(render|show|move|hide|focus|blur)$': function(obj, o, v) {
721
+ tooltip[($.isFunction(v) ? '' : 'un') + 'bind']('tooltip'+o, v);
722
+ },
723
+
724
+ // Properties which require event reassignment
725
+ '^(show|hide|position).(event|target|fixed|inactive|leave|distance|viewport|adjust)': function() {
726
+ var posOptions = options.position;
727
+
728
+ // Set tracking flag
729
+ tooltip.attr('tracking', posOptions.target === 'mouse' && posOptions.adjust.mouse);
730
+
731
+ // Reassign events
732
+ unassignEvents(); assignEvents();
733
+ }
734
+ };
735
+
736
+ /*
737
+ * Public API methods
738
+ */
739
+ $.extend(self, {
740
+ render: function(show)
741
+ {
742
+ if(self.rendered) { return self; } // If tooltip has already been rendered, exit
743
+
744
+ var text = options.content.text,
745
+ title = options.content.title.text,
746
+ posOptions = options.position,
747
+ callback = $.Event('tooltiprender');
748
+
749
+ // Add ARIA attributes to target
750
+ $.attr(target[0], 'aria-describedby', tooltipID);
751
+
752
+ // Create tooltip element
753
+ tooltip = elements.tooltip = $('<div/>', {
754
+ 'id': tooltipID,
755
+ 'class': uitooltip + ' qtip ui-helper-reset ' + defaultClass + ' ' + options.style.classes + ' '+ uitooltip + '-pos-' + options.position.my.abbreviation(),
756
+ 'width': options.style.width || '',
757
+ 'height': options.style.height || '',
758
+ 'tracking': posOptions.target === 'mouse' && posOptions.adjust.mouse,
759
+
760
+ /* ARIA specific attributes */
761
+ 'role': 'alert',
762
+ 'aria-live': 'polite',
763
+ 'aria-atomic': FALSE,
764
+ 'aria-describedby': tooltipID + '-content',
765
+ 'aria-hidden': TRUE
766
+ })
767
+ .toggleClass(disabled, cache.disabled)
768
+ .data('qtip', self)
769
+ .appendTo(options.position.container)
770
+ .append(
771
+ // Create content element
772
+ elements.content = $('<div />', {
773
+ 'class': uitooltip + '-content',
774
+ 'id': tooltipID + '-content',
775
+ 'aria-atomic': TRUE
776
+ })
777
+ );
778
+
779
+ // Set rendered flag and prevent redundant redraw/reposition calls for now
780
+ self.rendered = -1;
781
+ isDrawing = 1; isPositioning = 1;
782
+
783
+ // Create title...
784
+ if(title) {
785
+ createTitle();
786
+
787
+ // Update title only if its not a callback (called in toggle if so)
788
+ if(!$.isFunction(title)) { updateTitle(title, FALSE); }
789
+ }
790
+
791
+ // Set proper rendered flag and update content if not a callback function (called in toggle)
792
+ if(!$.isFunction(text)) { updateContent(text, FALSE); }
793
+ self.rendered = TRUE;
794
+
795
+ // Setup widget classes
796
+ setWidget();
797
+
798
+ // Assign passed event callbacks (before plugins!)
799
+ $.each(options.events, function(name, callback) {
800
+ if($.isFunction(callback)) {
801
+ tooltip.bind(name === 'toggle' ? 'tooltipshow tooltiphide' : 'tooltip'+name, callback);
802
+ }
803
+ });
804
+
805
+ // Initialize 'render' plugins
806
+ $.each(PLUGINS, function() {
807
+ if(this.initialize === 'render') { this(self); }
808
+ });
809
+
810
+ // Assign events
811
+ assignEvents();
812
+
813
+ /* Queue this part of the render process in our fx queue so we can
814
+ * load images before the tooltip renders fully.
815
+ *
816
+ * See: updateContent method
817
+ */
818
+ tooltip.queue('fx', function(next) {
819
+ // Trigger tooltiprender event and pass original triggering event as original
820
+ callback.originalEvent = cache.event;
821
+ tooltip.trigger(callback, [self]);
822
+
823
+ // Reset flags
824
+ isDrawing = 0; isPositioning = 0;
825
+
826
+ // Redraw the tooltip manually now we're fully rendered
827
+ self.redraw();
828
+
829
+ // Show tooltip if needed
830
+ if(options.show.ready || show) {
831
+ self.toggle(TRUE, cache.event);
832
+ }
833
+
834
+ next(); // Move on to next method in queue
835
+ });
836
+
837
+ return self;
838
+ },
839
+
840
+ get: function(notation)
841
+ {
842
+ var result, o;
843
+
844
+ switch(notation.toLowerCase())
845
+ {
846
+ case 'dimensions':
847
+ result = {
848
+ height: tooltip.outerHeight(), width: tooltip.outerWidth()
849
+ };
850
+ break;
851
+
852
+ case 'offset':
853
+ result = PLUGINS.offset(tooltip, options.position.container);
854
+ break;
855
+
856
+ default:
857
+ o = convertNotation(notation.toLowerCase());
858
+ result = o[0][ o[1] ];
859
+ result = result.precedance ? result.string() : result;
860
+ break;
861
+ }
862
+
863
+ return result;
864
+ },
865
+
866
+ set: function(option, value)
867
+ {
868
+ var rmove = /^position\.(my|at|adjust|target|container)|style|content|show\.ready/i,
869
+ rdraw = /^content\.(title|attr)|style/i,
870
+ reposition = FALSE,
871
+ redraw = FALSE,
872
+ checks = self.checks,
873
+ name;
874
+
875
+ function callback(notation, args) {
876
+ var category, rule, match;
877
+
878
+ for(category in checks) {
879
+ for(rule in checks[category]) {
880
+ if(match = (new RegExp(rule, 'i')).exec(notation)) {
881
+ args.push(match);
882
+ checks[category][rule].apply(self, args);
883
+ }
884
+ }
885
+ }
886
+ }
887
+
888
+ // Convert singular option/value pair into object form
889
+ if('string' === typeof option) {
890
+ name = option; option = {}; option[name] = value;
891
+ }
892
+ else { option = $.extend(TRUE, {}, option); }
893
+
894
+ // Set all of the defined options to their new values
895
+ $.each(option, function(notation, value) {
896
+ var obj = convertNotation( notation.toLowerCase() ), previous;
897
+
898
+ // Set new obj value
899
+ previous = obj[0][ obj[1] ];
900
+ obj[0][ obj[1] ] = 'object' === typeof value && value.nodeType ? $(value) : value;
901
+
902
+ // Set the new params for the callback
903
+ option[notation] = [obj[0], obj[1], value, previous];
904
+
905
+ // Also check if we need to reposition / redraw
906
+ reposition = rmove.test(notation) || reposition;
907
+ redraw = rdraw.test(notation) || redraw;
908
+ });
909
+
910
+ // Re-sanitize options
911
+ sanitizeOptions(options);
912
+
913
+ /*
914
+ * Execute any valid callbacks for the set options
915
+ * Also set isPositioning/isDrawing so we don't get loads of redundant repositioning
916
+ * and redraw calls.
917
+ */
918
+ isPositioning = isDrawing = 1; $.each(option, callback); isPositioning = isDrawing = 0;
919
+
920
+ // Update position / redraw if needed
921
+ if(tooltip.is(':visible') && self.rendered) {
922
+ if(reposition) {
923
+ self.reposition( options.position.target === 'mouse' ? NULL : cache.event );
924
+ }
925
+ if(redraw) { self.redraw(); }
926
+ }
927
+
928
+ return self;
929
+ },
930
+
931
+ toggle: function(state, event)
932
+ {
933
+ // Render the tooltip if showing and it isn't already
934
+ if(!self.rendered) { return state ? self.render(1) : self; }
935
+
936
+ var type = state ? 'show' : 'hide',
937
+ opts = options[type],
938
+ visible = tooltip.is(':visible'),
939
+ sameTarget = !event || options[type].target.length < 2 || cache.target[0] === event.target,
940
+ posOptions = options.position,
941
+ contentOptions = options.content,
942
+ delay,
943
+ callback;
944
+
945
+ // Detect state if valid one isn't provided
946
+ if((typeof state).search('boolean|number')) { state = !visible; }
947
+
948
+ // Return if element is already in correct state
949
+ if(!tooltip.is(':animated') && visible === state && sameTarget) { return self; }
950
+
951
+ // Try to prevent flickering when tooltip overlaps show element
952
+ if(event) {
953
+ if((/over|enter/).test(event.type) && (/out|leave/).test(cache.event.type) &&
954
+ event.target === options.show.target[0] && tooltip.has(event.relatedTarget).length) {
955
+ return self;
956
+ }
957
+
958
+ // Cache event
959
+ cache.event = $.extend({}, event);
960
+ }
961
+
962
+ // Call API methods
963
+ callback = $.Event('tooltip'+type);
964
+ callback.originalEvent = event ? cache.event : NULL;
965
+ tooltip.trigger(callback, [self, 90]);
966
+ if(callback.isDefaultPrevented()){ return self; }
967
+
968
+ // Set ARIA hidden status attribute
969
+ $.attr(tooltip[0], 'aria-hidden', !!!state);
970
+
971
+ // Execute state specific properties
972
+ if(state) {
973
+ // Store show origin coordinates
974
+ cache.origin = $.extend({}, MOUSE);
975
+
976
+ // Focus the tooltip
977
+ self.focus(event);
978
+
979
+ // Update tooltip content & title if it's a dynamic function
980
+ if($.isFunction(contentOptions.text)) { updateContent(contentOptions.text, FALSE); }
981
+ if($.isFunction(contentOptions.title.text)) { updateTitle(contentOptions.title.text, FALSE); }
982
+
983
+ // Cache mousemove events for positioning purposes (if not already tracking)
984
+ if(!trackingBound && posOptions.target === 'mouse' && posOptions.adjust.mouse) {
985
+ $(document).bind('mousemove.qtip', function(event) {
986
+ MOUSE = { pageX: event.pageX, pageY: event.pageY, type: 'mousemove' };
987
+ });
988
+ trackingBound = TRUE;
989
+ }
990
+
991
+ // Update the tooltip position
992
+ self.reposition(event);
993
+
994
+ // Hide other tooltips if tooltip is solo, using it as the context
995
+ if((callback.solo = !!opts.solo)) { $(selector, opts.solo).not(tooltip).qtip('hide', callback); }
996
+ }
997
+ else {
998
+ // Clear show timer if we're hiding
999
+ clearTimeout(self.timers.show);
1000
+
1001
+ // Remove cached origin on hide
1002
+ delete cache.origin;
1003
+
1004
+ // Remove mouse tracking event if not needed (all tracking qTips are hidden)
1005
+ if(trackingBound && !$(selector+'[tracking="true"]:visible', opts.solo).not(tooltip).length) {
1006
+ $(document).unbind('mousemove.qtip');
1007
+ trackingBound = FALSE;
1008
+ }
1009
+
1010
+ // Blur the tooltip
1011
+ self.blur(event);
1012
+ }
1013
+
1014
+ // Define post-animation, state specific properties
1015
+ function after() {
1016
+ if(state) {
1017
+ // Prevent antialias from disappearing in IE by removing filter
1018
+ if($.browser.msie) { tooltip[0].style.removeAttribute('filter'); }
1019
+
1020
+ // Remove overflow setting to prevent tip bugs
1021
+ tooltip.css('overflow', '');
1022
+
1023
+ // Autofocus elements if enabled
1024
+ if('string' === typeof opts.autofocus) {
1025
+ $(opts.autofocus, tooltip).focus();
1026
+ }
1027
+
1028
+ // Call API method
1029
+ callback = $.Event('tooltipvisible');
1030
+ callback.originalEvent = event ? cache.event : NULL;
1031
+ tooltip.trigger(callback, [self]);
1032
+
1033
+ // If set, hide tooltip when inactive for delay period
1034
+ opts.target.trigger('qtip-'+id+'-inactive');
1035
+ }
1036
+ else {
1037
+ // Reset CSS states
1038
+ tooltip.css({
1039
+ display: '',
1040
+ visibility: '',
1041
+ opacity: '',
1042
+ left: '',
1043
+ top: ''
1044
+ });
1045
+ }
1046
+ }
1047
+
1048
+ // Clear animation queue if same target
1049
+ if(sameTarget) { tooltip.stop(0, 1); }
1050
+
1051
+ // If no effect type is supplied, use a simple toggle
1052
+ if(opts.effect === FALSE) {
1053
+ tooltip[ type ]();
1054
+ after.call(tooltip);
1055
+ }
1056
+
1057
+ // Use custom function if provided
1058
+ else if($.isFunction(opts.effect)) {
1059
+ opts.effect.call(tooltip, self);
1060
+ tooltip.queue('fx', function(n){ after(); n(); });
1061
+ }
1062
+
1063
+ // Use basic fade function by default
1064
+ else { tooltip.fadeTo(90, state ? 1 : 0, after); }
1065
+
1066
+ // If inactive hide method is set, active it
1067
+ if(state) { opts.target.trigger('qtip-'+id+'-inactive'); }
1068
+
1069
+ return self;
1070
+ },
1071
+
1072
+ show: function(event){ return self.toggle(TRUE, event); },
1073
+
1074
+ hide: function(event){ return self.toggle(FALSE, event); },
1075
+
1076
+ focus: function(event)
1077
+ {
1078
+ if(!self.rendered) { return self; }
1079
+
1080
+ var qtips = $(selector),
1081
+ curIndex = parseInt(tooltip[0].style.zIndex, 10),
1082
+ newIndex = QTIP.zindex + qtips.length,
1083
+ cachedEvent = $.extend({}, event),
1084
+ focusedElem, callback;
1085
+
1086
+ // Only update the z-index if it has changed and tooltip is not already focused
1087
+ if(!tooltip.hasClass(focusClass))
1088
+ {
1089
+ // Call API method
1090
+ callback = $.Event('tooltipfocus');
1091
+ callback.originalEvent = cachedEvent;
1092
+ tooltip.trigger(callback, [self, newIndex]);
1093
+
1094
+ // If default action wasn't prevented...
1095
+ if(!callback.isDefaultPrevented()) {
1096
+ // Only update z-index's if they've changed
1097
+ if(curIndex !== newIndex) {
1098
+ // Reduce our z-index's and keep them properly ordered
1099
+ qtips.each(function() {
1100
+ if(this.style.zIndex > curIndex) {
1101
+ this.style.zIndex = this.style.zIndex - 1;
1102
+ }
1103
+ });
1104
+
1105
+ // Fire blur event for focused tooltip
1106
+ qtips.filter('.' + focusClass).qtip('blur', cachedEvent);
1107
+ }
1108
+
1109
+ // Set the new z-index
1110
+ tooltip.addClass(focusClass)[0].style.zIndex = newIndex;
1111
+ }
1112
+ }
1113
+
1114
+ return self;
1115
+ },
1116
+
1117
+ blur: function(event) {
1118
+ var cachedEvent = $.extend({}, event),
1119
+ callback;
1120
+
1121
+ // Set focused status to FALSE
1122
+ tooltip.removeClass(focusClass);
1123
+
1124
+ // Trigger blur event
1125
+ callback = $.Event('tooltipblur');
1126
+ callback.originalEvent = cachedEvent;
1127
+ tooltip.trigger(callback, [self]);
1128
+
1129
+ return self;
1130
+ },
1131
+
1132
+ reposition: function(event, effect)
1133
+ {
1134
+ if(!self.rendered || isPositioning) { return self; }
1135
+
1136
+ // Set positioning flag
1137
+ isPositioning = 1;
1138
+
1139
+ var target = options.position.target,
1140
+ posOptions = options.position,
1141
+ my = posOptions.my,
1142
+ at = posOptions.at,
1143
+ adjust = posOptions.adjust,
1144
+ method = adjust.method.split(' '),
1145
+ elemWidth = tooltip.outerWidth(),
1146
+ elemHeight = tooltip.outerHeight(),
1147
+ targetWidth = 0,
1148
+ targetHeight = 0,
1149
+ callback = $.Event('tooltipmove'),
1150
+ fixed = tooltip.css('position') === 'fixed',
1151
+ viewport = posOptions.viewport,
1152
+ position = { left: 0, top: 0 },
1153
+ container = posOptions.container,
1154
+ flipoffset = FALSE,
1155
+ tip = self.plugins.tip,
1156
+ readjust = {
1157
+ // Axis detection and readjustment indicator
1158
+ horizontal: method[0],
1159
+ vertical: (method[1] = method[1] || method[0]),
1160
+ enabled: viewport.jquery && target[0] !== window && target[0] !== docBody && adjust.method !== 'none',
1161
+
1162
+ // Reposition methods
1163
+ left: function(posLeft) {
1164
+ var isShift = readjust.horizontal === 'shift',
1165
+ viewportScroll = -container.offset.left + viewport.offset.left + viewport.scrollLeft,
1166
+ myWidth = my.x === 'left' ? elemWidth : my.x === 'right' ? -elemWidth : -elemWidth / 2,
1167
+ atWidth = at.x === 'left' ? targetWidth : at.x === 'right' ? -targetWidth : -targetWidth / 2,
1168
+ tipWidth = tip && tip.size ? tip.size.width || 0 : 0,
1169
+ tipAdjust = tip && tip.corner && tip.corner.precedance === 'x' && !isShift ? tipWidth : 0,
1170
+ overflowLeft = viewportScroll - posLeft + tipAdjust,
1171
+ overflowRight = posLeft + elemWidth - viewport.width - viewportScroll + tipAdjust,
1172
+ offset = myWidth - (my.precedance === 'x' || my.x === my.y ? atWidth : 0),
1173
+ isCenter = my.x === 'center';
1174
+
1175
+ // Optional 'shift' style repositioning
1176
+ if(isShift) {
1177
+ tipAdjust = tip && tip.corner && tip.corner.precedance === 'y' ? tipWidth : 0;
1178
+ offset = (my.x === 'left' ? 1 : -1) * myWidth - tipAdjust;
1179
+
1180
+ // Adjust position but keep it within viewport dimensions
1181
+ position.left += overflowLeft > 0 ? overflowLeft : overflowRight > 0 ? -overflowRight : 0;
1182
+ position.left = Math.max(
1183
+ -container.offset.left + viewport.offset.left + (tipAdjust && tip.corner.x === 'center' ? tip.offset : 0),
1184
+ posLeft - offset,
1185
+ Math.min(
1186
+ Math.max(-container.offset.left + viewport.offset.left + viewport.width, posLeft + offset),
1187
+ position.left
1188
+ )
1189
+ );
1190
+ }
1191
+
1192
+ // Default 'flip' repositioning
1193
+ else {
1194
+ if(overflowLeft > 0 && (my.x !== 'left' || overflowRight > 0)) {
1195
+ position.left -= offset;
1196
+ }
1197
+ else if(overflowRight > 0 && (my.x !== 'right' || overflowLeft > 0) ) {
1198
+ position.left -= isCenter ? -offset : offset;
1199
+ }
1200
+ if(position.left !== posLeft && isCenter) { position.left -= adjust.x; }
1201
+
1202
+ // Make sure we haven't made things worse with the adjustment and return the adjusted difference
1203
+ if(position.left < viewportScroll && -position.left > overflowRight) { position.left = posLeft; }
1204
+ }
1205
+
1206
+ return position.left - posLeft;
1207
+ },
1208
+ top: function(posTop) {
1209
+ var isShift = readjust.vertical === 'shift',
1210
+ viewportScroll = -container.offset.top + viewport.offset.top + viewport.scrollTop,
1211
+ myHeight = my.y === 'top' ? elemHeight : my.y === 'bottom' ? -elemHeight : -elemHeight / 2,
1212
+ atHeight = at.y === 'top' ? targetHeight : at.y === 'bottom' ? -targetHeight : -targetHeight / 2,
1213
+ tipHeight = tip && tip.size ? tip.size.height || 0 : 0,
1214
+ tipAdjust = tip && tip.corner && tip.corner.precedance === 'y' && !isShift ? tipHeight : 0,
1215
+ overflowTop = viewportScroll - posTop + tipAdjust,
1216
+ overflowBottom = posTop + elemHeight - viewport.height - viewportScroll + tipAdjust,
1217
+ offset = myHeight - (my.precedance === 'y' || my.x === my.y ? atHeight : 0),
1218
+ isCenter = my.y === 'center';
1219
+
1220
+ // Optional 'shift' style repositioning
1221
+ if(isShift) {
1222
+ tipAdjust = tip && tip.corner && tip.corner.precedance === 'x' ? tipHeight : 0;
1223
+ offset = (my.y === 'top' ? 1 : -1) * myHeight - tipAdjust;
1224
+
1225
+ // Adjust position but keep it within viewport dimensions
1226
+ position.top += overflowTop > 0 ? overflowTop : overflowBottom > 0 ? -overflowBottom : 0;
1227
+ position.top = Math.max(
1228
+ -container.offset.top + viewport.offset.top + (tipAdjust && tip.corner.x === 'center' ? tip.offset : 0),
1229
+ posTop - offset,
1230
+ Math.min(
1231
+ Math.max(-container.offset.top + viewport.offset.top + viewport.height, posTop + offset),
1232
+ position.top
1233
+ )
1234
+ );
1235
+ }
1236
+
1237
+ // Default 'flip' repositioning
1238
+ else {
1239
+ if(overflowTop > 0 && (my.y !== 'top' || overflowBottom > 0)) {
1240
+ position.top -= offset;
1241
+ }
1242
+ else if(overflowBottom > 0 && (my.y !== 'bottom' || overflowTop > 0) ) {
1243
+ position.top -= isCenter ? -offset : offset;
1244
+ }
1245
+ if(position.top !== posTop && isCenter) { position.top -= adjust.y; }
1246
+
1247
+ // Make sure we haven't made things worse with the adjustment and return the adjusted difference
1248
+ if(position.top < 0 && -position.top > overflowBottom) { position.top = posTop; }
1249
+ }
1250
+
1251
+ return position.top - posTop;
1252
+ }
1253
+ },
1254
+ win;
1255
+
1256
+ // Check if absolute position was passed
1257
+ if($.isArray(target) && target.length === 2) {
1258
+ // Force left top and set position
1259
+ at = { x: 'left', y: 'top' };
1260
+ position = { left: target[0], top: target[1] };
1261
+ }
1262
+
1263
+ // Check if mouse was the target
1264
+ else if(target === 'mouse' && ((event && event.pageX) || cache.event.pageX)) {
1265
+ // Force left top to allow flipping
1266
+ at = { x: 'left', y: 'top' };
1267
+
1268
+ // Use cached event if one isn't available for positioning
1269
+ event = (event && (event.type === 'resize' || event.type === 'scroll') ? cache.event :
1270
+ event && event.pageX && event.type === 'mousemove' ? event :
1271
+ MOUSE && MOUSE.pageX && (adjust.mouse || !event || !event.pageX) ? { pageX: MOUSE.pageX, pageY: MOUSE.pageY } :
1272
+ !adjust.mouse && cache.origin && cache.origin.pageX ? cache.origin :
1273
+ event) || event || cache.event || MOUSE || {};
1274
+
1275
+ // Use event coordinates for position
1276
+ position = { top: event.pageY, left: event.pageX };
1277
+ }
1278
+
1279
+ // Target wasn't mouse or absolute...
1280
+ else {
1281
+ // Check if event targetting is being used
1282
+ if(target === 'event') {
1283
+ if(event && event.target && event.type !== 'scroll' && event.type !== 'resize') {
1284
+ target = cache.target = $(event.target);
1285
+ }
1286
+ else {
1287
+ target = cache.target;
1288
+ }
1289
+ }
1290
+ else { cache.target = $(target); }
1291
+
1292
+ // Parse the target into a jQuery object and make sure there's an element present
1293
+ target = $(target).eq(0);
1294
+ if(target.length === 0) { return self; }
1295
+
1296
+ // Check if window or document is the target
1297
+ else if(target[0] === document || target[0] === window) {
1298
+ targetWidth = PLUGINS.iOS ? window.innerWidth : target.width();
1299
+ targetHeight = PLUGINS.iOS ? window.innerHeight : target.height();
1300
+
1301
+ if(target[0] === window) {
1302
+ position = {
1303
+ top: !fixed || PLUGINS.iOS ? (viewport || target).scrollTop() : 0,
1304
+ left: !fixed || PLUGINS.iOS ? (viewport || target).scrollLeft() : 0
1305
+ };
1306
+ }
1307
+ }
1308
+
1309
+ // Use Imagemap/SVG plugins if needed
1310
+ else if(target.is('area') && PLUGINS.imagemap) {
1311
+ position = PLUGINS.imagemap(target, at, readjust.enabled ? method : FALSE);
1312
+ }
1313
+ else if(target[0].namespaceURI === 'http://www.w3.org/2000/svg' && PLUGINS.svg) {
1314
+ position = PLUGINS.svg(target, at);
1315
+ }
1316
+
1317
+ else {
1318
+ targetWidth = target.outerWidth();
1319
+ targetHeight = target.outerHeight();
1320
+
1321
+ position = PLUGINS.offset(target, container);
1322
+ }
1323
+
1324
+ // Parse returned plugin values into proper variables
1325
+ if(position.offset) {
1326
+ targetWidth = position.width;
1327
+ targetHeight = position.height;
1328
+ flipoffset = position.flipoffset;
1329
+ position = position.offset;
1330
+ }
1331
+
1332
+ // Adjust for position.fixed tooltips (and also iOS scroll bug in v3.2 - v4.0)
1333
+ if((PLUGINS.iOS < 4.1 && PLUGINS.iOS > 3.1) || PLUGINS.iOS == 4.3 || (!PLUGINS.iOS && fixed)) {
1334
+ win = $(window);
1335
+ position.left -= win.scrollLeft();
1336
+ position.top -= win.scrollTop();
1337
+ }
1338
+
1339
+ // Adjust position relative to target
1340
+ position.left += at.x === 'right' ? targetWidth : at.x === 'center' ? targetWidth / 2 : 0;
1341
+ position.top += at.y === 'bottom' ? targetHeight : at.y === 'center' ? targetHeight / 2 : 0;
1342
+ }
1343
+
1344
+ // Adjust position relative to tooltip
1345
+ position.left += adjust.x + (my.x === 'right' ? -elemWidth : my.x === 'center' ? -elemWidth / 2 : 0);
1346
+ position.top += adjust.y + (my.y === 'bottom' ? -elemHeight : my.y === 'center' ? -elemHeight / 2 : 0);
1347
+
1348
+ // Calculate collision offset values if viewport positioning is enabled
1349
+ if(readjust.enabled) {
1350
+ // Cache our viewport details
1351
+ viewport = {
1352
+ elem: viewport,
1353
+ height: viewport[ (viewport[0] === window ? 'h' : 'outerH') + 'eight' ](),
1354
+ width: viewport[ (viewport[0] === window ? 'w' : 'outerW') + 'idth' ](),
1355
+ scrollLeft: fixed ? 0 : viewport.scrollLeft(),
1356
+ scrollTop: fixed ? 0 : viewport.scrollTop(),
1357
+ offset: viewport.offset() || { left: 0, top: 0 }
1358
+ };
1359
+ container = {
1360
+ elem: container,
1361
+ scrollLeft: container.scrollLeft(),
1362
+ scrollTop: container.scrollTop(),
1363
+ offset: container.offset() || { left: 0, top: 0 }
1364
+ };
1365
+
1366
+ // Adjust position based onviewport and adjustment options
1367
+ position.adjusted = {
1368
+ left: readjust.horizontal !== 'none' ? readjust.left(position.left) : 0,
1369
+ top: readjust.vertical !== 'none' ? readjust.top(position.top) : 0
1370
+ };
1371
+
1372
+ // Set tooltip position class
1373
+ if(position.adjusted.left + position.adjusted.top) {
1374
+ tooltip.attr('class', tooltip[0].className.replace(/ui-tooltip-pos-\w+/i, uitooltip + '-pos-' + my.abbreviation()));
1375
+ }
1376
+
1377
+ // Apply flip offsets supplied by positioning plugins
1378
+ if(flipoffset && position.adjusted.left) { position.left += flipoffset.left; }
1379
+ if(flipoffset && position.adjusted.top) { position.top += flipoffset.top; }
1380
+ }
1381
+
1382
+ //Viewport adjustment is disabled, set values to zero
1383
+ else { position.adjusted = { left: 0, top: 0 }; }
1384
+
1385
+ // Call API method
1386
+ callback.originalEvent = $.extend({}, event);
1387
+ tooltip.trigger(callback, [self, position, viewport.elem || viewport]);
1388
+ if(callback.isDefaultPrevented()){ return self; }
1389
+ delete position.adjusted;
1390
+
1391
+ // If effect is disabled, target it mouse, no animation is defined or positioning gives NaN out, set CSS directly
1392
+ if(effect === FALSE || isNaN(position.left) || isNaN(position.top) || target === 'mouse' || !$.isFunction(posOptions.effect)) {
1393
+ tooltip.css(position);
1394
+ }
1395
+
1396
+ // Use custom function if provided
1397
+ else if($.isFunction(posOptions.effect)) {
1398
+ posOptions.effect.call(tooltip, self, $.extend({}, position));
1399
+ tooltip.queue(function(next) {
1400
+ // Reset attributes to avoid cross-browser rendering bugs
1401
+ $(this).css({ opacity: '', height: '' });
1402
+ if($.browser.msie) { this.style.removeAttribute('filter'); }
1403
+
1404
+ next();
1405
+ });
1406
+ }
1407
+
1408
+ // Set positioning flag
1409
+ isPositioning = 0;
1410
+
1411
+ return self;
1412
+ },
1413
+
1414
+ // Max/min width simulator function for all browsers.. yeaaah!
1415
+ redraw: function()
1416
+ {
1417
+ if(self.rendered < 1 || isDrawing) { return self; }
1418
+
1419
+ var container = options.position.container,
1420
+ perc, width, max, min;
1421
+
1422
+ // Set drawing flag
1423
+ isDrawing = 1;
1424
+
1425
+ // If tooltip has a set height, just set it... like a boss!
1426
+ if(options.style.height) { tooltip.css('height', options.style.height); }
1427
+
1428
+ // If tooltip has a set width, just set it... like a boss!
1429
+ if(options.style.width) { tooltip.css('width', options.style.width); }
1430
+
1431
+ // Otherwise simualte max/min width...
1432
+ else {
1433
+ // Reset width and add fluid class
1434
+ tooltip.css('width', '').addClass(fluidClass);
1435
+
1436
+ // Grab our tooltip width (add 1 so we don't get wrapping problems.. huzzah!)
1437
+ width = tooltip.width() + 1;
1438
+
1439
+ // Grab our max/min properties
1440
+ max = tooltip.css('max-width') || '';
1441
+ min = tooltip.css('min-width') || '';
1442
+
1443
+ // Parse into proper pixel values
1444
+ perc = (max + min).indexOf('%') > -1 ? container.width() / 100 : 0;
1445
+ max = ((max.indexOf('%') > -1 ? perc : 1) * parseInt(max, 10)) || width;
1446
+ min = ((min.indexOf('%') > -1 ? perc : 1) * parseInt(min, 10)) || 0;
1447
+
1448
+ // Determine new dimension size based on max/min/current values
1449
+ width = max + min ? Math.min(Math.max(width, min), max) : width;
1450
+
1451
+ // Set the newly calculated width and remvoe fluid class
1452
+ tooltip.css('width', Math.round(width)).removeClass(fluidClass);
1453
+ }
1454
+
1455
+ // Set drawing flag
1456
+ isDrawing = 0;
1457
+
1458
+ return self;
1459
+ },
1460
+
1461
+ disable: function(state)
1462
+ {
1463
+ if('boolean' !== typeof state) {
1464
+ state = !(tooltip.hasClass(disabled) || cache.disabled);
1465
+ }
1466
+
1467
+ if(self.rendered) {
1468
+ tooltip.toggleClass(disabled, state);
1469
+ $.attr(tooltip[0], 'aria-disabled', state);
1470
+ }
1471
+ else {
1472
+ cache.disabled = !!state;
1473
+ }
1474
+
1475
+ return self;
1476
+ },
1477
+
1478
+ enable: function() { return self.disable(FALSE); },
1479
+
1480
+ destroy: function()
1481
+ {
1482
+ var t = target[0],
1483
+ title = $.attr(t, oldtitle),
1484
+ elemAPI = target.data('qtip');
1485
+
1486
+ // Destroy tooltip and any associated plugins if rendered
1487
+ if(self.rendered) {
1488
+ tooltip.remove();
1489
+
1490
+ $.each(self.plugins, function() {
1491
+ if(this.destroy) { this.destroy(); }
1492
+ });
1493
+ }
1494
+
1495
+ // Clear timers and remove bound events
1496
+ clearTimeout(self.timers.show);
1497
+ clearTimeout(self.timers.hide);
1498
+ unassignEvents();
1499
+
1500
+ // If the API if actually this qTip API...
1501
+ if(!elemAPI || self === elemAPI) {
1502
+ // Remove api object
1503
+ $.removeData(t, 'qtip');
1504
+
1505
+ // Reset old title attribute if removed
1506
+ if(options.suppress && title) {
1507
+ $.attr(t, 'title', title);
1508
+ target.removeAttr(oldtitle);
1509
+ }
1510
+
1511
+ // Remove ARIA attributes
1512
+ target.removeAttr('aria-describedby');
1513
+ }
1514
+
1515
+ // Remove qTip events associated with this API
1516
+ target.unbind('.qtip-'+id);
1517
+
1518
+ // Remove ID from sued id object
1519
+ delete usedIDs[self.id];
1520
+
1521
+ return target;
1522
+ }
1523
+ });
1524
+ }
1525
+
1526
+ // Initialization method
1527
+ function init(id, opts)
1528
+ {
1529
+ var obj, posOptions, attr, config, title,
1530
+
1531
+ // Setup element references
1532
+ elem = $(this),
1533
+ docBody = $(document.body),
1534
+
1535
+ // Use document body instead of document element if needed
1536
+ newTarget = this === document ? docBody : elem,
1537
+
1538
+ // Grab metadata from element if plugin is present
1539
+ metadata = (elem.metadata) ? elem.metadata(opts.metadata) : NULL,
1540
+
1541
+ // If metadata type if HTML5, grab 'name' from the object instead, or use the regular data object otherwise
1542
+ metadata5 = opts.metadata.type === 'html5' && metadata ? metadata[opts.metadata.name] : NULL,
1543
+
1544
+ // Grab data from metadata.name (or data-qtipopts as fallback) using .data() method,
1545
+ html5 = elem.data(opts.metadata.name || 'qtipopts');
1546
+
1547
+ // If we don't get an object returned attempt to parse it manualyl without parseJSON
1548
+ try { html5 = typeof html5 === 'string' ? (new Function("return " + html5))() : html5; }
1549
+ catch(e) { log('Unable to parse HTML5 attribute data: ' + html5); }
1550
+
1551
+ // Merge in and sanitize metadata
1552
+ config = $.extend(TRUE, {}, QTIP.defaults, opts,
1553
+ typeof html5 === 'object' ? sanitizeOptions(html5) : NULL,
1554
+ sanitizeOptions(metadata5 || metadata));
1555
+
1556
+ // Re-grab our positioning options now we've merged our metadata and set id to passed value
1557
+ posOptions = config.position;
1558
+ config.id = id;
1559
+
1560
+ // Setup missing content if none is detected
1561
+ if('boolean' === typeof config.content.text) {
1562
+ attr = elem.attr(config.content.attr);
1563
+
1564
+ // Grab from supplied attribute if available
1565
+ if(config.content.attr !== FALSE && attr) { config.content.text = attr; }
1566
+
1567
+ // No valid content was found, abort render
1568
+ else {
1569
+ log('Unable to locate content for tooltip! Aborting render of tooltip on element: ', elem);
1570
+ return FALSE;
1571
+ }
1572
+ }
1573
+
1574
+ // Setup target options
1575
+ if(posOptions.container === FALSE) { posOptions.container = docBody; }
1576
+ if(posOptions.target === FALSE) { posOptions.target = newTarget; }
1577
+ if(config.show.target === FALSE) { config.show.target = newTarget; }
1578
+ if(config.show.solo === TRUE) { config.show.solo = docBody; }
1579
+ if(config.hide.target === FALSE) { config.hide.target = newTarget; }
1580
+ if(config.position.viewport === TRUE) { config.position.viewport = posOptions.container; }
1581
+
1582
+ // Convert position corner values into x and y strings
1583
+ posOptions.at = new PLUGINS.Corner(posOptions.at);
1584
+ posOptions.my = new PLUGINS.Corner(posOptions.my);
1585
+
1586
+ // Destroy previous tooltip if overwrite is enabled, or skip element if not
1587
+ if($.data(this, 'qtip')) {
1588
+ if(config.overwrite) {
1589
+ elem.qtip('destroy');
1590
+ }
1591
+ else if(config.overwrite === FALSE) {
1592
+ return FALSE;
1593
+ }
1594
+ }
1595
+
1596
+ // Remove title attribute and store it if present
1597
+ if(config.suppress && (title = $.attr(this, 'title'))) {
1598
+ $(this).removeAttr('title').attr(oldtitle, title);
1599
+ }
1600
+
1601
+ // Initialize the tooltip and add API reference
1602
+ obj = new QTip(elem, config, id, !!attr);
1603
+ $.data(this, 'qtip', obj);
1604
+
1605
+ // Catch remove events on target element to destroy redundant tooltip
1606
+ elem.bind('remove.qtip-'+id, function(){ obj.destroy(); });
1607
+
1608
+ return obj;
1609
+ }
1610
+
1611
+ // jQuery $.fn extension method
1612
+ QTIP = $.fn.qtip = function(options, notation, newValue)
1613
+ {
1614
+ var command = ('' + options).toLowerCase(), // Parse command
1615
+ returned = NULL,
1616
+ args = command === 'disable' ? [TRUE] : $.makeArray(arguments).slice(1),
1617
+ event = args[args.length - 1],
1618
+ opts = this[0] ? $.data(this[0], 'qtip') : NULL;
1619
+
1620
+ // Check for API request
1621
+ if((!arguments.length && opts) || command === 'api') {
1622
+ return opts;
1623
+ }
1624
+
1625
+ // Execute API command if present
1626
+ else if('string' === typeof options)
1627
+ {
1628
+ this.each(function()
1629
+ {
1630
+ var api = $.data(this, 'qtip');
1631
+ if(!api) { return TRUE; }
1632
+
1633
+ // Cache the event if possible
1634
+ if(event && event.timeStamp) { api.cache.event = event; }
1635
+
1636
+ // Check for specific API commands
1637
+ if((command === 'option' || command === 'options') && notation) {
1638
+ if($.isPlainObject(notation) || newValue !== undefined) {
1639
+ api.set(notation, newValue);
1640
+ }
1641
+ else {
1642
+ returned = api.get(notation);
1643
+ return FALSE;
1644
+ }
1645
+ }
1646
+
1647
+ // Execute API command
1648
+ else if(api[command]) {
1649
+ api[command].apply(api[command], args);
1650
+ }
1651
+ });
1652
+
1653
+ return returned !== NULL ? returned : this;
1654
+ }
1655
+
1656
+ // No API commands. validate provided options and setup qTips
1657
+ else if('object' === typeof options || !arguments.length)
1658
+ {
1659
+ opts = sanitizeOptions($.extend(TRUE, {}, options));
1660
+
1661
+ // Bind the qTips
1662
+ return QTIP.bind.call(this, opts, event);
1663
+ }
1664
+ };
1665
+
1666
+ // $.fn.qtip Bind method
1667
+ QTIP.bind = function(opts, event)
1668
+ {
1669
+ return this.each(function(i) {
1670
+ var options, targets, events, namespace, api, id;
1671
+
1672
+ // Find next available ID, or use custom ID if provided
1673
+ id = $.isArray(opts.id) ? opts.id[i] : opts.id;
1674
+ id = !id || id === FALSE || id.length < 1 || usedIDs[id] ? QTIP.nextid++ : (usedIDs[id] = id);
1675
+
1676
+ // Setup events namespace
1677
+ namespace = '.qtip-'+id+'-create';
1678
+
1679
+ // Initialize the qTip and re-grab newly sanitized options
1680
+ api = init.call(this, id, opts);
1681
+ if(api === FALSE) { return TRUE; }
1682
+ options = api.options;
1683
+
1684
+ // Initialize plugins
1685
+ $.each(PLUGINS, function() {
1686
+ if(this.initialize === 'initialize') { this(api); }
1687
+ });
1688
+
1689
+ // Determine hide and show targets
1690
+ targets = { show: options.show.target, hide: options.hide.target };
1691
+ events = {
1692
+ show: $.trim('' + options.show.event).replace(/ /g, namespace+' ') + namespace,
1693
+ hide: $.trim('' + options.hide.event).replace(/ /g, namespace+' ') + namespace
1694
+ };
1695
+
1696
+ /*
1697
+ * Make sure hoverIntent functions properly by using mouseleave as a hide event if
1698
+ * mouseenter/mouseout is used for show.event, even if it isn't in the users options.
1699
+ */
1700
+ if(/mouse(over|enter)/i.test(events.show) && !/mouse(out|leave)/i.test(events.hide)) {
1701
+ events.hide += ' mouseleave' + namespace;
1702
+ }
1703
+
1704
+ /*
1705
+ * Also make sure initial mouse targetting works correctly by caching mousemove coords
1706
+ * on show targets before the tooltip has rendered.
1707
+ */
1708
+ targets.show.bind('mousemove'+namespace, function(event) {
1709
+ MOUSE = { pageX: event.pageX, pageY: event.pageY, type: 'mousemove' };
1710
+ });
1711
+
1712
+ // Define hoverIntent function
1713
+ function hoverIntent(event) {
1714
+ function render() {
1715
+ // Cache mouse coords,render and render the tooltip
1716
+ api.render(typeof event === 'object' || options.show.ready);
1717
+
1718
+ // Unbind show and hide events
1719
+ targets.show.add(targets.hide).unbind(namespace);
1720
+ }
1721
+
1722
+ // Only continue if tooltip isn't disabled
1723
+ if(api.cache.disabled) { return FALSE; }
1724
+
1725
+ // Cache the event data
1726
+ api.cache.event = $.extend({}, event);
1727
+ api.cache.target = event ? $(event.target) : [undefined];
1728
+
1729
+ // Start the event sequence
1730
+ if(options.show.delay > 0) {
1731
+ clearTimeout(api.timers.show);
1732
+ api.timers.show = setTimeout(render, options.show.delay);
1733
+ if(events.show !== events.hide) {
1734
+ targets.hide.bind(events.hide, function() { clearTimeout(api.timers.show); });
1735
+ }
1736
+ }
1737
+ else { render(); }
1738
+ }
1739
+
1740
+ // Bind show events to target
1741
+ targets.show.bind(events.show, hoverIntent);
1742
+
1743
+ // Prerendering is enabled, create tooltip now
1744
+ if(options.show.ready || options.prerender) { hoverIntent(event); }
1745
+ });
1746
+ };
1747
+
1748
+ // Setup base plugins
1749
+ PLUGINS = QTIP.plugins = {
1750
+ // Corner object parser
1751
+ Corner: function(corner) {
1752
+ corner = ('' + corner).replace(/([A-Z])/, ' $1').replace(/middle/gi, 'center').toLowerCase();
1753
+ this.x = (corner.match(/left|right/i) || corner.match(/center/) || ['inherit'])[0].toLowerCase();
1754
+ this.y = (corner.match(/top|bottom|center/i) || ['inherit'])[0].toLowerCase();
1755
+
1756
+ this.precedance = (corner.charAt(0).search(/^(t|b)/) > -1) ? 'y' : 'x';
1757
+ this.string = function() { return this.precedance === 'y' ? this.y+this.x : this.x+this.y; };
1758
+ this.abbreviation = function() {
1759
+ var x = this.x.substr(0,1), y = this.y.substr(0,1);
1760
+ return x === y ? x : (x === 'c' || (x !== 'c' && y !== 'c')) ? y + x : x + y;
1761
+ };
1762
+ },
1763
+
1764
+ // Custom (more correct for qTip!) offset calculator
1765
+ offset: function(elem, container) {
1766
+ var pos = elem.offset(),
1767
+ parent = container,
1768
+ deep = 0,
1769
+ docBody = document.body,
1770
+ coffset, overflow;
1771
+
1772
+ function scroll(e, i) {
1773
+ pos.left += i * e.scrollLeft();
1774
+ pos.top += i * e.scrollTop();
1775
+ }
1776
+
1777
+ if(parent) {
1778
+ // Compensate for non-static containers offset
1779
+ do {
1780
+ if(parent.css('position') !== 'static') {
1781
+ coffset = parent[0] === docBody ?
1782
+ { left: parseInt(parent.css('left'), 10) || 0, top: parseInt(parent.css('top'), 10) || 0 } :
1783
+ parent.position();
1784
+
1785
+ pos.left -= coffset.left + (parseInt(parent.css('borderLeftWidth'), 10) || 0) + (parseInt(parent.css('marginLeft'), 10) || 0);
1786
+ pos.top -= coffset.top + (parseInt(parent.css('borderTopWidth'), 10) || 0);
1787
+
1788
+ overflow = parent.css('overflow');
1789
+ if(overflow === 'scroll' || overflow === 'auto') { deep++; }
1790
+ }
1791
+
1792
+ if(parent[0] === docBody) { break; }
1793
+ }
1794
+ while(parent = parent.offsetParent());
1795
+
1796
+ // Compensate for containers scroll if it also has an offsetParent
1797
+ if(container[0] !== docBody && deep) { scroll( container, 1 ); }
1798
+ }
1799
+
1800
+ return pos;
1801
+ },
1802
+
1803
+ /*
1804
+ * iOS 3.2 - 4.0 scroll fix detection used in offset() function.
1805
+ */
1806
+ iOS: parseFloat(
1807
+ ('' + (/CPU.*OS ([0-9_]{1,3})|(CPU like).*AppleWebKit.*Mobile/i.exec(navigator.userAgent) || [0,''])[1])
1808
+ .replace('undefined', '3_2').replace('_','.')
1809
+ ) || FALSE,
1810
+
1811
+ /*
1812
+ * jQuery-specific $.fn overrides
1813
+ */
1814
+ fn: {
1815
+ /* Allow other plugins to successfully retrieve the title of an element with a qTip applied */
1816
+ attr: function(attr, val) {
1817
+ if(this.length) {
1818
+ var self = this[0],
1819
+ title = 'title',
1820
+ api = $.data(self, 'qtip');
1821
+
1822
+ if(attr === title && api && 'object' === typeof api && api.options.suppress) {
1823
+ if(arguments.length < 2) {
1824
+ return $.attr(self, oldtitle);
1825
+ }
1826
+ else {
1827
+ // If qTip is rendered and title was originally used as content, update it
1828
+ if(api && api.options.content.attr === title && api.cache.attr) {
1829
+ api.set('content.text', val);
1830
+ }
1831
+
1832
+ // Use the regular attr method to set, then cache the result
1833
+ return this.attr(oldtitle, val);
1834
+ }
1835
+ }
1836
+ }
1837
+
1838
+ return $.fn['attr'+replaceSuffix].apply(this, arguments);
1839
+ },
1840
+
1841
+ /* Allow clone to correctly retrieve cached title attributes */
1842
+ clone: function(keepData) {
1843
+ var titles = $([]), title = 'title',
1844
+
1845
+ // Clone our element using the real clone method
1846
+ elems = $.fn['clone'+replaceSuffix].apply(this, arguments);
1847
+
1848
+ // Grab all elements with an oldtitle set, and change it to regular title attribute, if keepData is false
1849
+ if(!keepData) {
1850
+ elems.filter('['+oldtitle+']').attr('title', function() {
1851
+ return $.attr(this, oldtitle);
1852
+ })
1853
+ .removeAttr(oldtitle);
1854
+ }
1855
+
1856
+ return elems;
1857
+ },
1858
+
1859
+ /*
1860
+ * Taken directly from jQuery 1.8.2 widget source code
1861
+ * Trigger 'remove' event on all elements on removal
1862
+ */
1863
+ remove: $.ui ? NULL : function( selector, keepData ) {
1864
+ if($.ui) { return; } // We don't need to do this if jQuery UI is present!
1865
+
1866
+ $(this).each(function() {
1867
+ if (!keepData) {
1868
+ if (!selector || $.filter( selector, [ this ] ).length) {
1869
+ $('*', this).add(this).each(function() {
1870
+ $(this).triggerHandler('remove');
1871
+ });
1872
+ }
1873
+ }
1874
+ });
1875
+ }
1876
+ }
1877
+ };
1878
+
1879
+ // Apply the fn overrides above
1880
+ $.each(PLUGINS.fn, function(name, func) {
1881
+ if(!func || $.fn[name+replaceSuffix]) { return TRUE; }
1882
+
1883
+ var old = $.fn[name+replaceSuffix] = $.fn[name];
1884
+ $.fn[name] = function() {
1885
+ return func.apply(this, arguments) || old.apply(this, arguments);
1886
+ };
1887
+ });
1888
+
1889
+ // Set global qTip properties
1890
+ QTIP.version = 'nightly';
1891
+ QTIP.nextid = 0;
1892
+ QTIP.inactiveEvents = 'click dblclick mousedown mouseup mousemove mouseleave mouseenter'.split(' ');
1893
+ QTIP.zindex = 15000;
1894
+
1895
+ // Define configuration defaults
1896
+ QTIP.defaults = {
1897
+ prerender: FALSE,
1898
+ id: FALSE,
1899
+ overwrite: TRUE,
1900
+ suppress: TRUE,
1901
+ content: {
1902
+ text: TRUE,
1903
+ attr: 'title',
1904
+ title: {
1905
+ text: FALSE,
1906
+ button: FALSE
1907
+ }
1908
+ },
1909
+ position: {
1910
+ my: 'top left',
1911
+ at: 'bottom right',
1912
+ target: FALSE,
1913
+ container: FALSE,
1914
+ viewport: FALSE,
1915
+ adjust: {
1916
+ x: 0, y: 0,
1917
+ mouse: TRUE,
1918
+ resize: TRUE,
1919
+ method: 'flip flip'
1920
+ },
1921
+ effect: function(api, pos, viewport) {
1922
+ $(this).animate(pos, {
1923
+ duration: 200,
1924
+ queue: FALSE
1925
+ });
1926
+ }
1927
+ },
1928
+ show: {
1929
+ target: FALSE,
1930
+ event: 'mouseenter',
1931
+ effect: TRUE,
1932
+ delay: 90,
1933
+ solo: FALSE,
1934
+ ready: FALSE,
1935
+ autofocus: FALSE
1936
+ },
1937
+ hide: {
1938
+ target: FALSE,
1939
+ event: 'mouseleave',
1940
+ effect: TRUE,
1941
+ delay: 0,
1942
+ fixed: FALSE,
1943
+ inactive: FALSE,
1944
+ leave: 'window',
1945
+ distance: FALSE
1946
+ },
1947
+ style: {
1948
+ classes: '',
1949
+ widget: FALSE,
1950
+ width: FALSE,
1951
+ height: FALSE
1952
+ },
1953
+ events: {
1954
+ render: NULL,
1955
+ move: NULL,
1956
+ show: NULL,
1957
+ hide: NULL,
1958
+ toggle: NULL,
1959
+ visible: NULL,
1960
+ focus: NULL,
1961
+ blur: NULL
1962
+ }
1963
+ };
1964
+
1965
+ function Ajax(api)
1966
+ {
1967
+ var self = this,
1968
+ tooltip = api.elements.tooltip,
1969
+ opts = api.options.content.ajax,
1970
+ namespace = '.qtip-ajax',
1971
+ rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
1972
+ first = TRUE;
1973
+
1974
+ api.checks.ajax = {
1975
+ '^content.ajax': function(obj, name, v) {
1976
+ // If content.ajax object was reset, set our local var
1977
+ if(name === 'ajax') { opts = v; }
1978
+
1979
+ if(name === 'once') {
1980
+ self.init();
1981
+ }
1982
+ else if(opts && opts.url) {
1983
+ self.load();
1984
+ }
1985
+ else {
1986
+ tooltip.unbind(namespace);
1987
+ }
1988
+ }
1989
+ };
1990
+
1991
+ $.extend(self, {
1992
+ init: function() {
1993
+ // Make sure ajax options are enabled and bind event
1994
+ if(opts && opts.url) {
1995
+ tooltip.unbind(namespace)[ opts.once ? 'one' : 'bind' ]('tooltipshow'+namespace, self.load);
1996
+ }
1997
+
1998
+ return self;
1999
+ },
2000
+
2001
+ load: function(event, first) {
2002
+ var hasSelector = opts.url.indexOf(' '),
2003
+ url = opts.url,
2004
+ selector,
2005
+ hideFirst = opts.once && !opts.loading && first;
2006
+
2007
+ // If loading option is disabled, prevent the tooltip showing until we've completed the request
2008
+ if(hideFirst) { try{ event.preventDefault(); } catch(e) {} }
2009
+
2010
+ // Make sure default event hasn't been prevented
2011
+ else if(event && event.isDefaultPrevented()) { return self; }
2012
+
2013
+ // Check if user delcared a content selector like in .load()
2014
+ if(hasSelector > -1) {
2015
+ selector = url.substr(hasSelector);
2016
+ url = url.substr(0, hasSelector);
2017
+ }
2018
+
2019
+ // Define common after callback for both success/error handlers
2020
+ function after() {
2021
+ // Re-display tip if loading and first time, and reset first flag
2022
+ if(hideFirst) { api.show(event.originalEvent); first = FALSE; }
2023
+
2024
+ // Call users complete if it was defined
2025
+ if($.isFunction(opts.complete)) { opts.complete.apply(this, arguments); }
2026
+ }
2027
+
2028
+ // Define success handler
2029
+ function successHandler(content) {
2030
+ if(selector) {
2031
+ // Create a dummy div to hold the results and grab the selector element
2032
+ content = $('<div/>')
2033
+ // inject the contents of the document in, removing the scripts
2034
+ // to avoid any 'Permission Denied' errors in IE
2035
+ .append(content.replace(rscript, ""))
2036
+
2037
+ // Locate the specified elements
2038
+ .find(selector);
2039
+ }
2040
+
2041
+ // Set the content
2042
+ api.set('content.text', content);
2043
+ }
2044
+
2045
+ // Error handler
2046
+ function errorHandler(xh, status, error) {
2047
+ if (xh.status === 0) { return; }
2048
+ api.set('content.text', status + ': ' + error);
2049
+ }
2050
+
2051
+ // Setup $.ajax option object and process the request
2052
+ $.ajax( $.extend({ success: successHandler, error: errorHandler, context: api }, opts, { url: url, complete: after }) );
2053
+ }
2054
+ });
2055
+
2056
+ self.init();
2057
+ }
2058
+
2059
+
2060
+ PLUGINS.ajax = function(api)
2061
+ {
2062
+ var self = api.plugins.ajax;
2063
+
2064
+ return 'object' === typeof self ? self : (api.plugins.ajax = new Ajax(api));
2065
+ };
2066
+
2067
+ PLUGINS.ajax.initialize = 'render';
2068
+
2069
+ // Setup plugin sanitization
2070
+ PLUGINS.ajax.sanitize = function(options)
2071
+ {
2072
+ var content = options.content, opts;
2073
+ if(content && 'ajax' in content) {
2074
+ opts = content.ajax;
2075
+ if(typeof opts !== 'object') { opts = options.content.ajax = { url: opts }; }
2076
+ if('boolean' !== typeof opts.once && opts.once) { opts.once = !!opts.once; }
2077
+ }
2078
+ };
2079
+
2080
+ // Extend original api defaults
2081
+ $.extend(TRUE, QTIP.defaults, {
2082
+ content: {
2083
+ ajax: {
2084
+ loading: TRUE,
2085
+ once: TRUE
2086
+ }
2087
+ }
2088
+ });
2089
+
2090
+ // Tip coordinates calculator
2091
+ function calculateTip(corner, width, height)
2092
+ {
2093
+ var width2 = Math.ceil(width / 2), height2 = Math.ceil(height / 2),
2094
+
2095
+ // Define tip coordinates in terms of height and width values
2096
+ tips = {
2097
+ bottomright: [[0,0], [width,height], [width,0]],
2098
+ bottomleft: [[0,0], [width,0], [0,height]],
2099
+ topright: [[0,height], [width,0], [width,height]],
2100
+ topleft: [[0,0], [0,height], [width,height]],
2101
+ topcenter: [[0,height], [width2,0], [width,height]],
2102
+ bottomcenter: [[0,0], [width,0], [width2,height]],
2103
+ rightcenter: [[0,0], [width,height2], [0,height]],
2104
+ leftcenter: [[width,0], [width,height], [0,height2]]
2105
+ };
2106
+
2107
+ // Set common side shapes
2108
+ tips.lefttop = tips.bottomright; tips.righttop = tips.bottomleft;
2109
+ tips.leftbottom = tips.topright; tips.rightbottom = tips.topleft;
2110
+
2111
+ return tips[ corner.string() ];
2112
+ }
2113
+
2114
+
2115
+ function Tip(qTip, command)
2116
+ {
2117
+ var self = this,
2118
+ opts = qTip.options.style.tip,
2119
+ elems = qTip.elements,
2120
+ tooltip = elems.tooltip,
2121
+ cache = {
2122
+ top: 0,
2123
+ left: 0,
2124
+ corner: ''
2125
+ },
2126
+ size = {
2127
+ width: opts.width,
2128
+ height: opts.height
2129
+ },
2130
+ color = { },
2131
+ border = opts.border || 0,
2132
+ namespace = '.qtip-tip',
2133
+ hasCanvas = !!($('<canvas />')[0] || {}).getContext;
2134
+
2135
+ self.corner = NULL;
2136
+ self.mimic = NULL;
2137
+ self.border = border;
2138
+ self.offset = opts.offset;
2139
+ self.size = size;
2140
+
2141
+ // Add new option checks for the plugin
2142
+ qTip.checks.tip = {
2143
+ '^position.my|style.tip.(corner|mimic|border)$': function() {
2144
+ // Make sure a tip can be drawn
2145
+ if(!self.init()) {
2146
+ self.destroy();
2147
+ }
2148
+
2149
+ // Reposition the tooltip
2150
+ qTip.reposition();
2151
+ },
2152
+ '^style.tip.(height|width)$': function() {
2153
+ // Re-set dimensions and redraw the tip
2154
+ size = {
2155
+ width: opts.width,
2156
+ height: opts.height
2157
+ };
2158
+ self.create();
2159
+ self.update();
2160
+
2161
+ // Reposition the tooltip
2162
+ qTip.reposition();
2163
+ },
2164
+ '^content.title.text|style.(classes|widget)$': function() {
2165
+ if(elems.tip) {
2166
+ self.update();
2167
+ }
2168
+ }
2169
+ };
2170
+
2171
+ function reposition(event, api, pos, viewport) {
2172
+ if(!elems.tip) { return; }
2173
+
2174
+ var newCorner = $.extend({}, self.corner),
2175
+ adjust = pos.adjusted,
2176
+ method = qTip.options.position.adjust.method.split(' '),
2177
+ horizontal = method[0],
2178
+ vertical = method[1] || method[0],
2179
+ shift = { left: FALSE, top: FALSE, x: 0, y: 0 },
2180
+ offset, css = {}, props;
2181
+
2182
+ // Make sure our tip position isn't fixed e.g. doesn't adjust with viewport
2183
+ if(self.corner.fixed !== TRUE) {
2184
+ // Horizontal - Shift or flip method
2185
+ if(horizontal === 'shift' && newCorner.precedance === 'x' && adjust.left && newCorner.y !== 'center') {
2186
+ newCorner.precedance = newCorner.precedance === 'x' ? 'y' : 'x';
2187
+ }
2188
+ else if(horizontal === 'flip' && adjust.left){
2189
+ newCorner.x = newCorner.x === 'center' ? (adjust.left > 0 ? 'left' : 'right') : (newCorner.x === 'left' ? 'right' : 'left');
2190
+ }
2191
+
2192
+ // Vertical - Shift or flip method
2193
+ if(vertical === 'shift' && newCorner.precedance === 'y' && adjust.top && newCorner.x !== 'center') {
2194
+ newCorner.precedance = newCorner.precedance === 'y' ? 'x' : 'y';
2195
+ }
2196
+ else if(vertical === 'flip' && adjust.top) {
2197
+ newCorner.y = newCorner.y === 'center' ? (adjust.top > 0 ? 'top' : 'bottom') : (newCorner.y === 'top' ? 'bottom' : 'top');
2198
+ }
2199
+
2200
+ // Update and redraw the tip if needed (check cached details of last drawn tip)
2201
+ if(newCorner.string() !== cache.corner && (cache.top !== adjust.top || cache.left !== adjust.left)) {
2202
+ self.update(newCorner, FALSE);
2203
+ }
2204
+ }
2205
+
2206
+ // Setup tip offset properties
2207
+ offset = self.position(newCorner, adjust);
2208
+ if(offset.right !== undefined) { offset.left = -offset.right; }
2209
+ if(offset.bottom !== undefined) { offset.top = -offset.bottom; }
2210
+ offset.user = Math.max(0, opts.offset);
2211
+
2212
+ // Viewport "shift" specific adjustments
2213
+ if(shift.left = (horizontal === 'shift' && !!adjust.left)) {
2214
+ if(newCorner.x === 'center') {
2215
+ css['margin-left'] = shift.x = offset['margin-left'] - adjust.left;
2216
+ }
2217
+ else {
2218
+ props = offset.right !== undefined ?
2219
+ [ adjust.left, -offset.left ] : [ -adjust.left, offset.left ];
2220
+
2221
+ if( (shift.x = Math.max(props[0], props[1])) > props[0] ) {
2222
+ pos.left -= adjust.left;
2223
+ shift.left = FALSE;
2224
+ }
2225
+
2226
+ css[ offset.right !== undefined ? 'right' : 'left' ] = shift.x;
2227
+ }
2228
+ }
2229
+ if(shift.top = (vertical === 'shift' && !!adjust.top)) {
2230
+ if(newCorner.y === 'center') {
2231
+ css['margin-top'] = shift.y = offset['margin-top'] - adjust.top;
2232
+ }
2233
+ else {
2234
+ props = offset.bottom !== undefined ?
2235
+ [ adjust.top, -offset.top ] : [ -adjust.top, offset.top ];
2236
+
2237
+ if( (shift.y = Math.max(props[0], props[1])) > props[0] ) {
2238
+ pos.top -= adjust.top;
2239
+ shift.top = FALSE;
2240
+ }
2241
+
2242
+ css[ offset.bottom !== undefined ? 'bottom' : 'top' ] = shift.y;
2243
+ }
2244
+ }
2245
+
2246
+ /*
2247
+ * If the tip is adjusted in both dimensions, or in a
2248
+ * direction that would cause it to be anywhere but the
2249
+ * outer border, hide it!
2250
+ */
2251
+ elems.tip.css(css).toggle(
2252
+ !((shift.x && shift.y) || (newCorner.x === 'center' && shift.y) || (newCorner.y === 'center' && shift.x))
2253
+ );
2254
+
2255
+ // Adjust position to accomodate tip dimensions
2256
+ pos.left -= offset.left.charAt ? offset.user : horizontal !== 'shift' || shift.top || !shift.left && !shift.top ? offset.left : 0;
2257
+ pos.top -= offset.top.charAt ? offset.user : vertical !== 'shift' || shift.left || !shift.left && !shift.top ? offset.top : 0;
2258
+
2259
+ // Cache details
2260
+ cache.left = adjust.left; cache.top = adjust.top;
2261
+ cache.corner = newCorner.string();
2262
+ }
2263
+
2264
+ /* border width calculator */
2265
+ function borderWidth(corner, side, backup) {
2266
+ side = !side ? corner[corner.precedance] : side;
2267
+
2268
+ var isFluid = tooltip.hasClass(fluidClass),
2269
+ isTitleTop = elems.titlebar && corner.y === 'top',
2270
+ elem = isTitleTop ? elems.titlebar : elems.content,
2271
+ css = 'border-' + side + '-width',
2272
+ val;
2273
+
2274
+ // Grab the border-width value (add fluid class if needed)
2275
+ tooltip.addClass(fluidClass);
2276
+ val = parseInt(elem.css(css), 10);
2277
+ val = (backup ? val || parseInt(tooltip.css(css), 10) : val) || 0;
2278
+ tooltip.toggleClass(fluidClass, isFluid);
2279
+
2280
+ return val;
2281
+ }
2282
+
2283
+ function borderRadius(corner) {
2284
+ var isTitleTop = elems.titlebar && corner.y === 'top',
2285
+ elem = isTitleTop ? elems.titlebar : elems.content,
2286
+ moz = $.browser.mozilla,
2287
+ prefix = moz ? '-moz-' : $.browser.webkit ? '-webkit-' : '',
2288
+ side = corner.y + (moz ? '' : '-') + corner.x,
2289
+ css = prefix + (moz ? 'border-radius-' + side : 'border-' + side + '-radius');
2290
+
2291
+ return parseInt(elem.css(css), 10) || parseInt(tooltip.css(css), 10) || 0;
2292
+ }
2293
+
2294
+ function calculateSize(corner) {
2295
+ var y = corner.precedance === 'y',
2296
+ width = size [ y ? 'width' : 'height' ],
2297
+ height = size [ y ? 'height' : 'width' ],
2298
+ isCenter = corner.string().indexOf('center') > -1,
2299
+ base = width * (isCenter ? 0.5 : 1),
2300
+ pow = Math.pow,
2301
+ round = Math.round,
2302
+ bigHyp, ratio, result,
2303
+
2304
+ smallHyp = Math.sqrt( pow(base, 2) + pow(height, 2) ),
2305
+
2306
+ hyp = [
2307
+ (border / base) * smallHyp, (border / height) * smallHyp
2308
+ ];
2309
+ hyp[2] = Math.sqrt( pow(hyp[0], 2) - pow(border, 2) );
2310
+ hyp[3] = Math.sqrt( pow(hyp[1], 2) - pow(border, 2) );
2311
+
2312
+ bigHyp = smallHyp + hyp[2] + hyp[3] + (isCenter ? 0 : hyp[0]);
2313
+ ratio = bigHyp / smallHyp;
2314
+
2315
+ result = [ round(ratio * height), round(ratio * width) ];
2316
+ return { height: result[ y ? 0 : 1 ], width: result[ y ? 1 : 0 ] };
2317
+ }
2318
+
2319
+ $.extend(self, {
2320
+ init: function()
2321
+ {
2322
+ var enabled = self.detectCorner() && (hasCanvas || $.browser.msie);
2323
+
2324
+ // Determine tip corner and type
2325
+ if(enabled) {
2326
+ // Create a new tip and draw it
2327
+ self.create();
2328
+ self.update();
2329
+
2330
+ // Bind update events
2331
+ tooltip.unbind(namespace).bind('tooltipmove'+namespace, reposition);
2332
+ }
2333
+
2334
+ return enabled;
2335
+ },
2336
+
2337
+ detectCorner: function()
2338
+ {
2339
+ var corner = opts.corner,
2340
+ posOptions = qTip.options.position,
2341
+ at = posOptions.at,
2342
+ my = posOptions.my.string ? posOptions.my.string() : posOptions.my;
2343
+
2344
+ // Detect corner and mimic properties
2345
+ if(corner === FALSE || (my === FALSE && at === FALSE)) {
2346
+ return FALSE;
2347
+ }
2348
+ else {
2349
+ if(corner === TRUE) {
2350
+ self.corner = new PLUGINS.Corner(my);
2351
+ }
2352
+ else if(!corner.string) {
2353
+ self.corner = new PLUGINS.Corner(corner);
2354
+ self.corner.fixed = TRUE;
2355
+ }
2356
+ }
2357
+
2358
+ return self.corner.string() !== 'centercenter';
2359
+ },
2360
+
2361
+ detectColours: function(actual) {
2362
+ var i, fill, border,
2363
+ tip = elems.tip.css('cssText', ''),
2364
+ corner = actual || self.corner,
2365
+ precedance = corner[ corner.precedance ],
2366
+
2367
+ borderSide = 'border-' + precedance + '-color',
2368
+ borderSideCamel = 'border' + precedance.charAt(0) + precedance.substr(1) + 'Color',
2369
+
2370
+ invalid = /rgba?\(0, 0, 0(, 0)?\)|transparent|#123456/i,
2371
+ backgroundColor = 'background-color',
2372
+ transparent = 'transparent',
2373
+ important = ' !important',
2374
+
2375
+ bodyBorder = $(document.body).css('color'),
2376
+ contentColour = qTip.elements.content.css('color'),
2377
+
2378
+ useTitle = elems.titlebar && (corner.y === 'top' || (corner.y === 'center' && tip.position().top + (size.height / 2) + opts.offset < elems.titlebar.outerHeight(1))),
2379
+ colorElem = useTitle ? elems.titlebar : elems.content;
2380
+
2381
+ // Apply the fluid class so we can see our CSS values properly
2382
+ tooltip.addClass(fluidClass);
2383
+
2384
+ // Detect tip colours from CSS styles
2385
+ color.fill = fill = tip.css(backgroundColor);
2386
+ color.border = border = tip[0].style[ borderSideCamel ] || tip.css(borderSide) || tooltip.css(borderSide);
2387
+
2388
+ // Make sure colours are valid
2389
+ if(!fill || invalid.test(fill)) {
2390
+ color.fill = colorElem.css(backgroundColor) || transparent;
2391
+ if(invalid.test(color.fill)) {
2392
+ color.fill = tooltip.css(backgroundColor) || fill;
2393
+ }
2394
+ }
2395
+ if(!border || invalid.test(border) || border === bodyBorder) {
2396
+ color.border = colorElem.css(borderSide) || transparent;
2397
+ if(invalid.test(color.border)) {
2398
+ color.border = border;
2399
+ }
2400
+ }
2401
+
2402
+ // Reset background and border colours
2403
+ $('*', tip).add(tip).css('cssText', backgroundColor+':'+transparent+important+';border:0'+important+';');
2404
+
2405
+ // Remove fluid class
2406
+ tooltip.removeClass(fluidClass);
2407
+ },
2408
+
2409
+ create: function()
2410
+ {
2411
+ var width = size.width,
2412
+ height = size.height,
2413
+ vml;
2414
+
2415
+ // Remove previous tip element if present
2416
+ if(elems.tip) { elems.tip.remove(); }
2417
+
2418
+ // Create tip element and prepend to the tooltip
2419
+ elems.tip = $('<div />', { 'class': 'ui-tooltip-tip' }).css({ width: width, height: height }).prependTo(tooltip);
2420
+
2421
+ // Create tip drawing element(s)
2422
+ if(hasCanvas) {
2423
+ // save() as soon as we create the canvas element so FF2 doesn't bork on our first restore()!
2424
+ $('<canvas />').appendTo(elems.tip)[0].getContext('2d').save();
2425
+ }
2426
+ else {
2427
+ vml = '<vml:shape coordorigin="0,0" style="display:inline-block; position:absolute; behavior:url(#default#VML);"></vml:shape>';
2428
+ elems.tip.html(vml + vml);
2429
+ }
2430
+ },
2431
+
2432
+ update: function(corner, position)
2433
+ {
2434
+ var tip = elems.tip,
2435
+ inner = tip.children(),
2436
+ width = size.width,
2437
+ height = size.height,
2438
+ regular = 'px solid ',
2439
+ transparent = 'px dashed transparent', // Dashed IE6 border-transparency hack. Awesome!
2440
+ mimic = opts.mimic,
2441
+ round = Math.round,
2442
+ precedance, context, coords, translate, newSize;
2443
+
2444
+ // Re-determine tip if not already set
2445
+ if(!corner) { corner = self.corner; }
2446
+
2447
+ // Use corner property if we detect an invalid mimic value
2448
+ if(mimic === FALSE) { mimic = corner; }
2449
+
2450
+ // Otherwise inherit mimic properties from the corner object as necessary
2451
+ else {
2452
+ mimic = new PLUGINS.Corner(mimic);
2453
+ mimic.precedance = corner.precedance;
2454
+
2455
+ if(mimic.x === 'inherit') { mimic.x = corner.x; }
2456
+ else if(mimic.y === 'inherit') { mimic.y = corner.y; }
2457
+ else if(mimic.x === mimic.y) {
2458
+ mimic[ corner.precedance ] = corner[ corner.precedance ];
2459
+ }
2460
+ }
2461
+ precedance = mimic.precedance;
2462
+
2463
+ // Update our colours
2464
+ self.detectColours(corner);
2465
+
2466
+ // Detect border width, taking into account colours
2467
+ if(color.border !== 'transparent' && color.border !== '#123456') {
2468
+ // Grab border width
2469
+ border = borderWidth(corner, NULL, TRUE);
2470
+
2471
+ // If border width isn't zero, use border color as fill (1.0 style tips)
2472
+ if(opts.border === 0 && border > 0) { color.fill = color.border; }
2473
+
2474
+ // Set border width (use detected border width if opts.border is true)
2475
+ self.border = border = opts.border !== TRUE ? opts.border : border;
2476
+ }
2477
+
2478
+ // Border colour was invalid, set border to zero
2479
+ else { self.border = border = 0; }
2480
+
2481
+ // Calculate coordinates
2482
+ coords = calculateTip(mimic, width , height);
2483
+
2484
+ // Determine tip size
2485
+ self.size = newSize = calculateSize(corner);
2486
+ tip.css(newSize);
2487
+
2488
+ // Calculate tip translation
2489
+ if(corner.precedance === 'y') {
2490
+ translate = [
2491
+ round(mimic.x === 'left' ? border : mimic.x === 'right' ? newSize.width - width - border : (newSize.width - width) / 2),
2492
+ round(mimic.y === 'top' ? newSize.height - height : 0)
2493
+ ];
2494
+ }
2495
+ else {
2496
+ translate = [
2497
+ round(mimic.x === 'left' ? newSize.width - width : 0),
2498
+ round(mimic.y === 'top' ? border : mimic.y === 'bottom' ? newSize.height - height - border : (newSize.height - height) / 2)
2499
+ ];
2500
+ }
2501
+
2502
+ // Canvas drawing implementation
2503
+ if(hasCanvas) {
2504
+ // Set the canvas size using calculated size
2505
+ inner.attr(newSize);
2506
+
2507
+ // Grab canvas context and clear/save it
2508
+ context = inner[0].getContext('2d');
2509
+ context.restore(); context.save();
2510
+ context.clearRect(0,0,3000,3000);
2511
+
2512
+ // Translate origin
2513
+ context.translate(translate[0], translate[1]);
2514
+
2515
+ // Draw the tip
2516
+ context.beginPath();
2517
+ context.moveTo(coords[0][0], coords[0][1]);
2518
+ context.lineTo(coords[1][0], coords[1][1]);
2519
+ context.lineTo(coords[2][0], coords[2][1]);
2520
+ context.closePath();
2521
+ context.fillStyle = color.fill;
2522
+ context.strokeStyle = color.border;
2523
+ context.lineWidth = border * 2;
2524
+ context.lineJoin = 'miter';
2525
+ context.miterLimit = 100;
2526
+ if(border) { context.stroke(); }
2527
+ context.fill();
2528
+ }
2529
+
2530
+ // VML (IE Proprietary implementation)
2531
+ else {
2532
+ // Setup coordinates string
2533
+ coords = 'm' + coords[0][0] + ',' + coords[0][1] + ' l' + coords[1][0] +
2534
+ ',' + coords[1][1] + ' ' + coords[2][0] + ',' + coords[2][1] + ' xe';
2535
+
2536
+ // Setup VML-specific offset for pixel-perfection
2537
+ translate[2] = border && /^(r|b)/i.test(corner.string()) ?
2538
+ parseFloat($.browser.version, 10) === 8 ? 2 : 1 : 0;
2539
+
2540
+ // Set initial CSS
2541
+ inner.css({
2542
+ antialias: ''+(mimic.string().indexOf('center') > -1),
2543
+ left: translate[0] - (translate[2] * Number(precedance === 'x')),
2544
+ top: translate[1] - (translate[2] * Number(precedance === 'y')),
2545
+ width: width + border,
2546
+ height: height + border
2547
+ })
2548
+ .each(function(i) {
2549
+ var $this = $(this);
2550
+
2551
+ // Set shape specific attributes
2552
+ $this[ $this.prop ? 'prop' : 'attr' ]({
2553
+ coordsize: (width+border) + ' ' + (height+border),
2554
+ path: coords,
2555
+ fillcolor: color.fill,
2556
+ filled: !!i,
2557
+ stroked: !!!i
2558
+ })
2559
+ .css({ display: border || i ? 'block' : 'none' });
2560
+
2561
+ // Check if border is enabled and add stroke element
2562
+ if(!i && $this.html() === '') {
2563
+ $this.html(
2564
+ '<vml:stroke weight="'+(border*2)+'px" color="'+color.border+'" miterlimit="1000" joinstyle="miter" ' +
2565
+ ' style="behavior:url(#default#VML); display:inline-block;" />'
2566
+ );
2567
+ }
2568
+ });
2569
+ }
2570
+
2571
+ // Position if needed
2572
+ if(position !== FALSE) { self.position(corner); }
2573
+ },
2574
+
2575
+ // Tip positioning method
2576
+ position: function(corner)
2577
+ {
2578
+ var tip = elems.tip,
2579
+ position = {},
2580
+ userOffset = Math.max(0, opts.offset),
2581
+ precedance, dimensions, corners;
2582
+
2583
+ // Return if tips are disabled or tip is not yet rendered
2584
+ if(opts.corner === FALSE || !tip) { return FALSE; }
2585
+
2586
+ // Inherit corner if not provided
2587
+ corner = corner || self.corner;
2588
+ precedance = corner.precedance;
2589
+
2590
+ // Determine which tip dimension to use for adjustment
2591
+ dimensions = calculateSize(corner);
2592
+
2593
+ // Setup corners and offset array
2594
+ corners = [ corner.x, corner.y ];
2595
+ if(precedance === 'x') { corners.reverse(); }
2596
+
2597
+ // Calculate tip position
2598
+ $.each(corners, function(i, side) {
2599
+ var b, br;
2600
+
2601
+ if(side === 'center') {
2602
+ b = precedance === 'y' ? 'left' : 'top';
2603
+ position[ b ] = '50%';
2604
+ position['margin-' + b] = -Math.round(dimensions[ precedance === 'y' ? 'width' : 'height' ] / 2) + userOffset;
2605
+ }
2606
+ else {
2607
+ b = borderWidth(corner, side, TRUE);
2608
+ br = borderRadius(corner);
2609
+
2610
+ position[ side ] = i ?
2611
+ border ? borderWidth(corner, side) : 0 :
2612
+ userOffset + (br > b ? br : 0);
2613
+ }
2614
+ });
2615
+
2616
+ // Adjust for tip dimensions
2617
+ position[ corner[precedance] ] -= dimensions[ precedance === 'x' ? 'width' : 'height' ];
2618
+
2619
+ // Set and return new position
2620
+ tip.css({ top: '', bottom: '', left: '', right: '', margin: '' }).css(position);
2621
+ return position;
2622
+ },
2623
+
2624
+ destroy: function()
2625
+ {
2626
+ // Remov tip and bound events
2627
+ if(elems.tip) { elems.tip.remove(); }
2628
+ tooltip.unbind(namespace);
2629
+ }
2630
+ });
2631
+
2632
+ self.init();
2633
+ }
2634
+
2635
+ PLUGINS.tip = function(api)
2636
+ {
2637
+ var self = api.plugins.tip;
2638
+
2639
+ return 'object' === typeof self ? self : (api.plugins.tip = new Tip(api));
2640
+ };
2641
+
2642
+ // Initialize tip on render
2643
+ PLUGINS.tip.initialize = 'render';
2644
+
2645
+ // Setup plugin sanitization options
2646
+ PLUGINS.tip.sanitize = function(options)
2647
+ {
2648
+ var style = options.style, opts;
2649
+ if(style && 'tip' in style) {
2650
+ opts = options.style.tip;
2651
+ if(typeof opts !== 'object'){ options.style.tip = { corner: opts }; }
2652
+ if(!(/string|boolean/i).test(typeof opts.corner)) { opts.corner = TRUE; }
2653
+ if(typeof opts.width !== 'number'){ delete opts.width; }
2654
+ if(typeof opts.height !== 'number'){ delete opts.height; }
2655
+ if(typeof opts.border !== 'number' && opts.border !== TRUE){ delete opts.border; }
2656
+ if(typeof opts.offset !== 'number'){ delete opts.offset; }
2657
+ }
2658
+ };
2659
+
2660
+ // Extend original qTip defaults
2661
+ $.extend(TRUE, QTIP.defaults, {
2662
+ style: {
2663
+ tip: {
2664
+ corner: TRUE,
2665
+ mimic: FALSE,
2666
+ width: 6,
2667
+ height: 6,
2668
+ border: TRUE,
2669
+ offset: 0
2670
+ }
2671
+ }
2672
+ });
2673
+
2674
+
2675
+ }(jQuery, window));