4c8b60ebd827fef794aaaef208429a9f6e11e068.svn-base 92 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363
  1. (function(){
  2. /*
  3. * jQuery 1.2.2b2 - New Wave Javascript
  4. *
  5. * Copyright (c) 2007 John Resig (jquery.com)
  6. * Dual licensed under the MIT (MIT-LICENSE.txt)
  7. * and GPL (GPL-LICENSE.txt) licenses.
  8. *
  9. * $Date: 2007-12-20 14:36:56 +0100 (Don, 20 Dez 2007) $
  10. * $Rev: 4251 $
  11. */
  12. // Map over jQuery in case of overwrite
  13. if ( window.jQuery )
  14. var _jQuery = window.jQuery;
  15. var jQuery = window.jQuery = function( selector, context ) {
  16. // The jQuery object is actually just the init constructor 'enhanced'
  17. return new jQuery.prototype.init( selector, context );
  18. };
  19. // Map over the $ in case of overwrite
  20. if ( window.$ )
  21. var _$ = window.$;
  22. // Map the jQuery namespace to the '$' one
  23. window.$ = jQuery;
  24. // A simple way to check for HTML strings or ID strings
  25. // (both of which we optimize for)
  26. var quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/;
  27. // Is it a simple selector
  28. var isSimple = /^.[^:#\[\.]*$/;
  29. jQuery.fn = jQuery.prototype = {
  30. init: function( selector, context ) {
  31. // Make sure that a selection was provided
  32. selector = selector || document;
  33. // Handle $(DOMElement)
  34. if ( selector.nodeType ) {
  35. this[0] = selector;
  36. this.length = 1;
  37. return this;
  38. // Handle HTML strings
  39. } else if ( typeof selector == "string" ) {
  40. // Are we dealing with HTML string or an ID?
  41. var match = quickExpr.exec( selector );
  42. // Verify a match, and that no context was specified for #id
  43. if ( match && (match[1] || !context) ) {
  44. // HANDLE: $(html) -> $(array)
  45. if ( match[1] )
  46. selector = jQuery.clean( [ match[1] ], context );
  47. // HANDLE: $("#id")
  48. else {
  49. var elem = document.getElementById( match[3] );
  50. // Make sure an element was located
  51. if ( elem )
  52. // Handle the case where IE and Opera return items
  53. // by name instead of ID
  54. if ( elem.id != match[3] )
  55. return jQuery().find( selector );
  56. // Otherwise, we inject the element directly into the jQuery object
  57. else {
  58. this[0] = elem;
  59. this.length = 1;
  60. return this;
  61. }
  62. else
  63. selector = [];
  64. }
  65. // HANDLE: $(expr, [context])
  66. // (which is just equivalent to: $(content).find(expr)
  67. } else
  68. return new jQuery( context ).find( selector );
  69. // HANDLE: $(function)
  70. // Shortcut for document ready
  71. } else if ( jQuery.isFunction( selector ) )
  72. return new jQuery( document )[ jQuery.fn.ready ? "ready" : "load" ]( selector );
  73. return this.setArray(
  74. // HANDLE: $(array)
  75. selector.constructor == Array && selector ||
  76. // HANDLE: $(arraylike)
  77. // Watch for when an array-like object, contains DOM nodes, is passed in as the selector
  78. (selector.jquery || selector.length && selector != window && !selector.nodeType && selector[0] != undefined && selector[0].nodeType) && jQuery.makeArray( selector ) ||
  79. // HANDLE: $(*)
  80. [ selector ] );
  81. },
  82. // The current version of jQuery being used
  83. jquery: "@VERSION",
  84. // The number of elements contained in the matched element set
  85. size: function() {
  86. return this.length;
  87. },
  88. // The number of elements contained in the matched element set
  89. length: 0,
  90. // Get the Nth element in the matched element set OR
  91. // Get the whole matched element set as a clean array
  92. get: function( num ) {
  93. return num == undefined ?
  94. // Return a 'clean' array
  95. jQuery.makeArray( this ) :
  96. // Return just the object
  97. this[ num ];
  98. },
  99. // Take an array of elements and push it onto the stack
  100. // (returning the new matched element set)
  101. pushStack: function( elems ) {
  102. // Build a new jQuery matched element set
  103. var ret = jQuery( elems );
  104. // Add the old object onto the stack (as a reference)
  105. ret.prevObject = this;
  106. // Return the newly-formed element set
  107. return ret;
  108. },
  109. // Force the current matched set of elements to become
  110. // the specified array of elements (destroying the stack in the process)
  111. // You should use pushStack() in order to do this, but maintain the stack
  112. setArray: function( elems ) {
  113. // Resetting the length to 0, then using the native Array push
  114. // is a super-fast way to populate an object with array-like properties
  115. this.length = 0;
  116. Array.prototype.push.apply( this, elems );
  117. return this;
  118. },
  119. // Execute a callback for every element in the matched set.
  120. // (You can seed the arguments with an array of args, but this is
  121. // only used internally.)
  122. each: function( callback, args ) {
  123. return jQuery.each( this, callback, args );
  124. },
  125. // Determine the position of an element within
  126. // the matched set of elements
  127. index: function( elem ) {
  128. var ret = -1;
  129. // Locate the position of the desired element
  130. this.each(function(i){
  131. if ( this == elem )
  132. ret = i;
  133. });
  134. return ret;
  135. },
  136. attr: function( name, value, type ) {
  137. var options = name;
  138. // Look for the case where we're accessing a style value
  139. if ( name.constructor == String )
  140. if ( value == undefined )
  141. return this.length && jQuery[ type || "attr" ]( this[0], name ) || undefined;
  142. else {
  143. options = {};
  144. options[ name ] = value;
  145. }
  146. // Check to see if we're setting style values
  147. return this.each(function(i){
  148. // Set all the styles
  149. for ( name in options )
  150. jQuery.attr(
  151. type ?
  152. this.style :
  153. this,
  154. name, jQuery.prop( this, options[ name ], type, i, name )
  155. );
  156. });
  157. },
  158. css: function( key, value ) {
  159. // ignore negative width and height values
  160. if ( (key == 'width' || key == 'height') && parseFloat(value) < 0 )
  161. value = undefined;
  162. return this.attr( key, value, "curCSS" );
  163. },
  164. text: function( text ) {
  165. if ( typeof text != "object" && text != null )
  166. return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) );
  167. var ret = "";
  168. jQuery.each( text || this, function(){
  169. jQuery.each( this.childNodes, function(){
  170. if ( this.nodeType != 8 )
  171. ret += this.nodeType != 1 ?
  172. this.nodeValue :
  173. jQuery.fn.text( [ this ] );
  174. });
  175. });
  176. return ret;
  177. },
  178. wrapAll: function( html ) {
  179. if ( this[0] )
  180. // The elements to wrap the target around
  181. jQuery( html, this[0].ownerDocument )
  182. .clone()
  183. .insertBefore( this[0] )
  184. .map(function(){
  185. var elem = this;
  186. while ( elem.firstChild )
  187. elem = elem.firstChild;
  188. return elem;
  189. })
  190. .append(this);
  191. return this;
  192. },
  193. wrapInner: function( html ) {
  194. return this.each(function(){
  195. jQuery( this ).contents().wrapAll( html );
  196. });
  197. },
  198. wrap: function( html ) {
  199. return this.each(function(){
  200. jQuery( this ).wrapAll( html );
  201. });
  202. },
  203. append: function() {
  204. return this.domManip(arguments, true, false, function(elem){
  205. if (this.nodeType == 1)
  206. this.appendChild( elem );
  207. });
  208. },
  209. prepend: function() {
  210. return this.domManip(arguments, true, true, function(elem){
  211. if (this.nodeType == 1)
  212. this.insertBefore( elem, this.firstChild );
  213. });
  214. },
  215. before: function() {
  216. return this.domManip(arguments, false, false, function(elem){
  217. this.parentNode.insertBefore( elem, this );
  218. });
  219. },
  220. after: function() {
  221. return this.domManip(arguments, false, true, function(elem){
  222. this.parentNode.insertBefore( elem, this.nextSibling );
  223. });
  224. },
  225. end: function() {
  226. return this.prevObject || jQuery( [] );
  227. },
  228. find: function( selector ) {
  229. var elems = jQuery.map(this, function(elem){
  230. return jQuery.find( selector, elem );
  231. });
  232. return this.pushStack( /[^+>] [^+>]/.test( selector ) || selector.indexOf("..") > -1 ?
  233. jQuery.unique( elems ) :
  234. elems );
  235. },
  236. clone: function( events ) {
  237. // Do the clone
  238. var ret = this.map(function(){
  239. if ( jQuery.browser.msie && !jQuery.isXMLDoc(this) ) {
  240. // IE copies events bound via attachEvent when
  241. // using cloneNode. Calling detachEvent on the
  242. // clone will also remove the events from the orignal
  243. // In order to get around this, we use innerHTML.
  244. // Unfortunately, this means some modifications to
  245. // attributes in IE that are actually only stored
  246. // as properties will not be copied (such as the
  247. // the name attribute on an input).
  248. var clone = this.cloneNode(true),
  249. container = document.createElement("div"),
  250. container2 = document.createElement("div");
  251. container.appendChild(clone);
  252. container2.innerHTML = container.innerHTML;
  253. return container2.firstChild;
  254. } else
  255. return this.cloneNode(true);
  256. });
  257. // Need to set the expando to null on the cloned set if it exists
  258. // removeData doesn't work here, IE removes it from the original as well
  259. // this is primarily for IE but the data expando shouldn't be copied over in any browser
  260. var clone = ret.find("*").andSelf().each(function(){
  261. if ( this[ expando ] != undefined )
  262. this[ expando ] = null;
  263. });
  264. // Copy the events from the original to the clone
  265. if ( events === true )
  266. this.find("*").andSelf().each(function(i){
  267. var events = jQuery.data( this, "events" );
  268. for ( var type in events )
  269. for ( var handler in events[ type ] )
  270. jQuery.event.add( clone[ i ], type, events[ type ][ handler ], events[ type ][ handler ].data );
  271. });
  272. // Return the cloned set
  273. return ret;
  274. },
  275. filter: function( selector ) {
  276. return this.pushStack(
  277. jQuery.isFunction( selector ) &&
  278. jQuery.grep(this, function(elem, i){
  279. return selector.call( elem, i );
  280. }) ||
  281. jQuery.multiFilter( selector, this ) );
  282. },
  283. not: function( selector ) {
  284. if ( selector.constructor == String )
  285. // test special case where just one selector is passed in
  286. if ( isSimple.test( selector ) )
  287. return this.pushStack( jQuery.multiFilter( selector, this, true ) );
  288. else
  289. selector = jQuery.multiFilter( selector, this );
  290. var isArrayLike = selector.length && selector[selector.length - 1] !== undefined && !selector.nodeType;
  291. return this.filter(function() {
  292. return isArrayLike ? jQuery.inArray( this, selector ) < 0 : this != selector;
  293. });
  294. },
  295. add: function( selector ) {
  296. return !selector ? this : this.pushStack( jQuery.merge(
  297. this.get(),
  298. selector.constructor == String ?
  299. jQuery( selector ).get() :
  300. selector.length != undefined && (!selector.nodeName || jQuery.nodeName(selector, "form")) ?
  301. selector : [selector] ) );
  302. },
  303. is: function( selector ) {
  304. return selector ?
  305. jQuery.multiFilter( selector, this ).length > 0 :
  306. false;
  307. },
  308. hasClass: function( selector ) {
  309. return this.is( "." + selector );
  310. },
  311. val: function( value ) {
  312. if ( value == undefined ) {
  313. if ( this.length ) {
  314. var elem = this[0];
  315. // We need to handle select boxes special
  316. if ( jQuery.nodeName( elem, "select" ) ) {
  317. var index = elem.selectedIndex,
  318. values = [],
  319. options = elem.options,
  320. one = elem.type == "select-one";
  321. // Nothing was selected
  322. if ( index < 0 )
  323. return null;
  324. // Loop through all the selected options
  325. for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) {
  326. var option = options[ i ];
  327. if ( option.selected ) {
  328. // Get the specifc value for the option
  329. value = jQuery.browser.msie && !option.attributes.value.specified ? option.text : option.value;
  330. // We don't need an array for one selects
  331. if ( one )
  332. return value;
  333. // Multi-Selects return an array
  334. values.push( value );
  335. }
  336. }
  337. return values;
  338. // Everything else, we just grab the value
  339. } else
  340. return (this[0].value || "").replace(/\r/g, "");
  341. }
  342. return undefined;
  343. }
  344. return this.each(function(){
  345. if ( this.nodeType != 1 )
  346. return;
  347. if ( value.constructor == Array && /radio|checkbox/.test( this.type ) )
  348. this.checked = (jQuery.inArray(this.value, value) >= 0 ||
  349. jQuery.inArray(this.name, value) >= 0);
  350. else if ( jQuery.nodeName( this, "select" ) ) {
  351. var values = value.constructor == Array ?
  352. value :
  353. [ value ];
  354. jQuery( "option", this ).each(function(){
  355. this.selected = (jQuery.inArray( this.value, values ) >= 0 ||
  356. jQuery.inArray( this.text, values ) >= 0);
  357. });
  358. if ( !values.length )
  359. this.selectedIndex = -1;
  360. } else
  361. this.value = value;
  362. });
  363. },
  364. html: function( value ) {
  365. return value == undefined ?
  366. (this.length ?
  367. this[0].innerHTML :
  368. null) :
  369. this.empty().append( value );
  370. },
  371. replaceWith: function( value ) {
  372. return this.after( value ).remove();
  373. },
  374. eq: function( i ) {
  375. return this.slice( i, i + 1 );
  376. },
  377. slice: function() {
  378. return this.pushStack( Array.prototype.slice.apply( this, arguments ) );
  379. },
  380. map: function( callback ) {
  381. return this.pushStack( jQuery.map(this, function(elem, i){
  382. return callback.call( elem, i, elem );
  383. }));
  384. },
  385. andSelf: function() {
  386. return this.add( this.prevObject );
  387. },
  388. domManip: function( args, table, reverse, callback ) {
  389. var clone = this.length > 1, elems;
  390. return this.each(function(){
  391. if ( !elems ) {
  392. elems = jQuery.clean( args, this.ownerDocument );
  393. if ( reverse )
  394. elems.reverse();
  395. }
  396. var obj = this;
  397. if ( table && jQuery.nodeName( this, "table" ) && jQuery.nodeName( elems[0], "tr" ) )
  398. obj = this.getElementsByTagName("tbody")[0] || this.appendChild( this.ownerDocument.createElement("tbody") );
  399. var scripts = jQuery( [] );
  400. jQuery.each(elems, function(){
  401. var elem = clone ?
  402. jQuery( this ).clone( true )[0] :
  403. this;
  404. // execute all scripts after the elements have been injected
  405. if ( jQuery.nodeName( elem, "script" ) ) {
  406. scripts = scripts.add( elem );
  407. } else {
  408. // Remove any inner scripts for later evaluation
  409. if ( elem.nodeType == 1 )
  410. scripts = scripts.add( jQuery( "script", elem ).remove() );
  411. // Inject the elements into the document
  412. callback.call( obj, elem );
  413. }
  414. });
  415. scripts.each( evalScript );
  416. });
  417. }
  418. };
  419. // Give the init function the jQuery prototype for later instantiation
  420. jQuery.prototype.init.prototype = jQuery.prototype;
  421. function evalScript( i, elem ) {
  422. if ( elem.src )
  423. jQuery.ajax({
  424. url: elem.src,
  425. async: false,
  426. dataType: "script"
  427. });
  428. else
  429. jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" );
  430. if ( elem.parentNode )
  431. elem.parentNode.removeChild( elem );
  432. }
  433. jQuery.extend = jQuery.fn.extend = function() {
  434. // copy reference to target object
  435. var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options;
  436. // Handle a deep copy situation
  437. if ( target.constructor == Boolean ) {
  438. deep = target;
  439. target = arguments[1] || {};
  440. // skip the boolean and the target
  441. i = 2;
  442. }
  443. // Handle case when target is a string or something (possible in deep copy)
  444. if ( typeof target != "object" && typeof target != "function" )
  445. target = {};
  446. // extend jQuery itself if only one argument is passed
  447. if ( length == 1 ) {
  448. target = this;
  449. i = 0;
  450. }
  451. for ( ; i < length; i++ )
  452. // Only deal with non-null/undefined values
  453. if ( (options = arguments[ i ]) != null )
  454. // Extend the base object
  455. for ( var name in options ) {
  456. // Prevent never-ending loop
  457. if ( target === options[ name ] )
  458. continue;
  459. // Recurse if we're merging object values
  460. if ( deep && options[ name ] && typeof options[ name ] == "object" && target[ name ] && !options[ name ].nodeType )
  461. target[ name ] = jQuery.extend( target[ name ], options[ name ] );
  462. // Don't bring in undefined values
  463. else if ( options[ name ] != undefined )
  464. target[ name ] = options[ name ];
  465. }
  466. // Return the modified object
  467. return target;
  468. };
  469. var expando = "jQuery" + (new Date()).getTime(), uuid = 0, windowData = {};
  470. // exclude the following css properties to add px
  471. var exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i;
  472. jQuery.extend({
  473. noConflict: function( deep ) {
  474. window.$ = _$;
  475. if ( deep )
  476. window.jQuery = _jQuery;
  477. return jQuery;
  478. },
  479. // This may seem like some crazy code, but trust me when I say that this
  480. // is the only cross-browser way to do this. --John
  481. isFunction: function( fn ) {
  482. return !!fn && typeof fn != "string" && !fn.nodeName &&
  483. fn.constructor != Array && /function/i.test( fn + "" );
  484. },
  485. // check if an element is in a (or is an) XML document
  486. isXMLDoc: function( elem ) {
  487. return elem.documentElement && !elem.body ||
  488. elem.tagName && elem.ownerDocument && !elem.ownerDocument.body;
  489. },
  490. // Evalulates a script in a global context
  491. globalEval: function( data ) {
  492. data = jQuery.trim( data );
  493. if ( data ) {
  494. // Inspired by code by Andrea Giammarchi
  495. // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html
  496. var head = document.getElementsByTagName("head")[0] || document.documentElement,
  497. script = document.createElement("script");
  498. script.type = "text/javascript";
  499. if ( jQuery.browser.msie )
  500. script.text = data;
  501. else
  502. script.appendChild( document.createTextNode( data ) );
  503. head.appendChild( script );
  504. head.removeChild( script );
  505. }
  506. },
  507. nodeName: function( elem, name ) {
  508. return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase();
  509. },
  510. cache: {},
  511. data: function( elem, name, data ) {
  512. elem = elem == window ?
  513. windowData :
  514. elem;
  515. var id = elem[ expando ];
  516. // Compute a unique ID for the element
  517. if ( !id )
  518. id = elem[ expando ] = ++uuid;
  519. // Only generate the data cache if we're
  520. // trying to access or manipulate it
  521. if ( name && !jQuery.cache[ id ] )
  522. jQuery.cache[ id ] = {};
  523. // Prevent overriding the named cache with undefined values
  524. if ( data != undefined )
  525. jQuery.cache[ id ][ name ] = data;
  526. // Return the named cache data, or the ID for the element
  527. return name ?
  528. jQuery.cache[ id ][ name ] :
  529. id;
  530. },
  531. removeData: function( elem, name ) {
  532. elem = elem == window ?
  533. windowData :
  534. elem;
  535. var id = elem[ expando ];
  536. // If we want to remove a specific section of the element's data
  537. if ( name ) {
  538. if ( jQuery.cache[ id ] ) {
  539. // Remove the section of cache data
  540. delete jQuery.cache[ id ][ name ];
  541. // If we've removed all the data, remove the element's cache
  542. name = "";
  543. for ( name in jQuery.cache[ id ] )
  544. break;
  545. if ( !name )
  546. jQuery.removeData( elem );
  547. }
  548. // Otherwise, we want to remove all of the element's data
  549. } else {
  550. // Clean up the element expando
  551. try {
  552. delete elem[ expando ];
  553. } catch(e){
  554. // IE has trouble directly removing the expando
  555. // but it's ok with using removeAttribute
  556. if ( elem.removeAttribute )
  557. elem.removeAttribute( expando );
  558. }
  559. // Completely remove the data cache
  560. delete jQuery.cache[ id ];
  561. }
  562. },
  563. // args is for internal usage only
  564. each: function( object, callback, args ) {
  565. if ( args ) {
  566. if ( object.length == undefined )
  567. for ( var name in object )
  568. callback.apply( object[ name ], args );
  569. else
  570. for ( var i = 0, length = object.length; i < length; i++ )
  571. if ( callback.apply( object[ i ], args ) === false )
  572. break;
  573. // A special, fast, case for the most common use of each
  574. } else {
  575. if ( object.length == undefined )
  576. for ( var name in object )
  577. callback.call( object[ name ], name, object[ name ] );
  578. else
  579. for ( var i = 0, length = object.length, value = object[0];
  580. i < length && callback.call( value, i, value ) !== false; value = object[++i] ){}
  581. }
  582. return object;
  583. },
  584. prop: function( elem, value, type, i, name ) {
  585. // Handle executable functions
  586. if ( jQuery.isFunction( value ) )
  587. value = value.call( elem, i );
  588. // Handle passing in a number to a CSS property
  589. return value && value.constructor == Number && type == "curCSS" && !exclude.test( name ) ?
  590. value + "px" :
  591. value;
  592. },
  593. className: {
  594. // internal only, use addClass("class")
  595. add: function( elem, classNames ) {
  596. jQuery.each((classNames || "").split(/\s+/), function(i, className){
  597. if ( elem.nodeType == 1 && !jQuery.className.has( elem.className, className ) )
  598. elem.className += (elem.className ? " " : "") + className;
  599. });
  600. },
  601. // internal only, use removeClass("class")
  602. remove: function( elem, classNames ) {
  603. if (elem.nodeType == 1)
  604. elem.className = classNames != undefined ?
  605. jQuery.grep(elem.className.split(/\s+/), function(className){
  606. return !jQuery.className.has( classNames, className );
  607. }).join(" ") :
  608. "";
  609. },
  610. // internal only, use is(".class")
  611. has: function( elem, className ) {
  612. return jQuery.inArray( className, (elem.className || elem).toString().split(/\s+/) ) > -1;
  613. }
  614. },
  615. // A method for quickly swapping in/out CSS properties to get correct calculations
  616. swap: function( elem, options, callback ) {
  617. var old = {};
  618. // Remember the old values, and insert the new ones
  619. for ( var name in options ) {
  620. old[ name ] = elem.style[ name ];
  621. elem.style[ name ] = options[ name ];
  622. }
  623. callback.call( elem );
  624. // Revert the old values
  625. for ( var name in options )
  626. elem.style[ name ] = old[ name ];
  627. },
  628. css: function( elem, name, force ) {
  629. if ( name == "width" || name == "height" ) {
  630. var val, props = { position: "absolute", visibility: "hidden", display:"block" }, which = name == "width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ];
  631. function getWH() {
  632. val = name == "width" ? elem.offsetWidth : elem.offsetHeight;
  633. var padding = 0, border = 0;
  634. jQuery.each( which, function() {
  635. padding += parseFloat(jQuery.curCSS( elem, "padding" + this, true)) || 0;
  636. border += parseFloat(jQuery.curCSS( elem, "border" + this + "Width", true)) || 0;
  637. });
  638. val -= Math.round(padding + border);
  639. }
  640. if ( jQuery(elem).is(":visible") )
  641. getWH();
  642. else
  643. jQuery.swap( elem, props, getWH );
  644. return Math.max(0, val);
  645. }
  646. return jQuery.curCSS( elem, name, force );
  647. },
  648. curCSS: function( elem, name, force ) {
  649. var ret;
  650. // A helper method for determining if an element's values are broken
  651. function color( elem ) {
  652. if ( !jQuery.browser.safari )
  653. return false;
  654. var ret = document.defaultView.getComputedStyle( elem, null );
  655. return !ret || ret.getPropertyValue("color") == "";
  656. }
  657. // We need to handle opacity special in IE
  658. if ( name == "opacity" && jQuery.browser.msie ) {
  659. ret = jQuery.attr( elem.style, "opacity" );
  660. return ret == "" ?
  661. "1" :
  662. ret;
  663. }
  664. // Opera sometimes will give the wrong display answer, this fixes it, see #2037
  665. if ( jQuery.browser.opera && name == "display" ) {
  666. var save = elem.style.display;
  667. elem.style.display = "block";
  668. elem.style.display = save;
  669. }
  670. // Make sure we're using the right name for getting the float value
  671. if ( name.match( /float/i ) )
  672. name = styleFloat;
  673. if ( !force && elem.style[ name ] )
  674. ret = elem.style[ name ];
  675. else if ( document.defaultView && document.defaultView.getComputedStyle ) {
  676. // Only "float" is needed here
  677. if ( name.match( /float/i ) )
  678. name = "float";
  679. name = name.replace( /([A-Z])/g, "-$1" ).toLowerCase();
  680. var getComputedStyle = document.defaultView.getComputedStyle( elem, null );
  681. if ( getComputedStyle && !color( elem ) )
  682. ret = getComputedStyle.getPropertyValue( name );
  683. // If the element isn't reporting its values properly in Safari
  684. // then some display: none elements are involved
  685. else {
  686. var swap = [], stack = [];
  687. // Locate all of the parent display: none elements
  688. for ( var a = elem; a && color(a); a = a.parentNode )
  689. stack.unshift(a);
  690. // Go through and make them visible, but in reverse
  691. // (It would be better if we knew the exact display type that they had)
  692. for ( var i = 0; i < stack.length; i++ )
  693. if ( color( stack[ i ] ) ) {
  694. swap[ i ] = stack[ i ].style.display;
  695. stack[ i ].style.display = "block";
  696. }
  697. // Since we flip the display style, we have to handle that
  698. // one special, otherwise get the value
  699. ret = name == "display" && swap[ stack.length - 1 ] != null ?
  700. "none" :
  701. ( getComputedStyle && getComputedStyle.getPropertyValue( name ) ) || "";
  702. // Finally, revert the display styles back
  703. for ( var i = 0; i < swap.length; i++ )
  704. if ( swap[ i ] != null )
  705. stack[ i ].style.display = swap[ i ];
  706. }
  707. // We should always get a number back from opacity
  708. if ( name == "opacity" && ret == "" )
  709. ret = "1";
  710. } else if ( elem.currentStyle ) {
  711. var camelCase = name.replace(/\-(\w)/g, function(all, letter){
  712. return letter.toUpperCase();
  713. });
  714. ret = elem.currentStyle[ name ] || elem.currentStyle[ camelCase ];
  715. // From the awesome hack by Dean Edwards
  716. // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
  717. // If we're not dealing with a regular pixel number
  718. // but a number that has a weird ending, we need to convert it to pixels
  719. if ( !/^\d+(px)?$/i.test( ret ) && /^\d/.test( ret ) ) {
  720. // Remember the original values
  721. var style = elem.style.left, runtimeStyle = elem.runtimeStyle.left;
  722. // Put in the new values to get a computed value out
  723. elem.runtimeStyle.left = elem.currentStyle.left;
  724. elem.style.left = ret || 0;
  725. ret = elem.style.pixelLeft + "px";
  726. // Revert the changed values
  727. elem.style.left = style;
  728. elem.runtimeStyle.left = runtimeStyle;
  729. }
  730. }
  731. return ret;
  732. },
  733. clean: function( elems, context ) {
  734. var ret = [];
  735. context = context || document;
  736. // !context.createElement fails in IE with an error but returns typeof 'object'
  737. if (typeof context.createElement == 'undefined')
  738. context = context.ownerDocument || context[0] && context[0].ownerDocument || document;
  739. jQuery.each(elems, function(i, elem){
  740. if ( !elem )
  741. return;
  742. if ( elem.constructor == Number )
  743. elem = elem.toString();
  744. // Convert html string into DOM nodes
  745. if ( typeof elem == "string" ) {
  746. // Fix "XHTML"-style tags in all browsers
  747. elem = elem.replace(/(<(\w+)[^>]*?)\/>/g, function(all, front, tag){
  748. return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area)$/i) ?
  749. all :
  750. front + "></" + tag + ">";
  751. });
  752. // Trim whitespace, otherwise indexOf won't work as expected
  753. var tags = jQuery.trim( elem ).toLowerCase(), div = context.createElement("div");
  754. var wrap =
  755. // option or optgroup
  756. !tags.indexOf("<opt") &&
  757. [ 1, "<select multiple='multiple'>", "</select>" ] ||
  758. !tags.indexOf("<leg") &&
  759. [ 1, "<fieldset>", "</fieldset>" ] ||
  760. tags.match(/^<(thead|tbody|tfoot|colg|cap)/) &&
  761. [ 1, "<table>", "</table>" ] ||
  762. !tags.indexOf("<tr") &&
  763. [ 2, "<table><tbody>", "</tbody></table>" ] ||
  764. // <thead> matched above
  765. (!tags.indexOf("<td") || !tags.indexOf("<th")) &&
  766. [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ] ||
  767. !tags.indexOf("<col") &&
  768. [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ] ||
  769. // IE can't serialize <link> and <script> tags normally
  770. jQuery.browser.msie &&
  771. [ 1, "div<div>", "</div>" ] ||
  772. [ 0, "", "" ];
  773. // Go to html and back, then peel off extra wrappers
  774. div.innerHTML = wrap[1] + elem + wrap[2];
  775. // Move to the right depth
  776. while ( wrap[0]-- )
  777. div = div.lastChild;
  778. // Remove IE's autoinserted <tbody> from table fragments
  779. if ( jQuery.browser.msie ) {
  780. // String was a <table>, *may* have spurious <tbody>
  781. var tbody = !tags.indexOf("<table") && tags.indexOf("<tbody") < 0 ?
  782. div.firstChild && div.firstChild.childNodes :
  783. // String was a bare <thead> or <tfoot>
  784. wrap[1] == "<table>" && tags.indexOf("<tbody") < 0 ?
  785. div.childNodes :
  786. [];
  787. for ( var j = tbody.length - 1; j >= 0 ; --j )
  788. if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length )
  789. tbody[ j ].parentNode.removeChild( tbody[ j ] );
  790. // IE completely kills leading whitespace when innerHTML is used
  791. if ( /^\s/.test( elem ) )
  792. div.insertBefore( context.createTextNode( elem.match(/^\s*/)[0] ), div.firstChild );
  793. }
  794. elem = jQuery.makeArray( div.childNodes );
  795. }
  796. if ( elem.length === 0 && (!jQuery.nodeName( elem, "form" ) && !jQuery.nodeName( elem, "select" )) )
  797. return;
  798. if ( elem[0] == undefined || jQuery.nodeName( elem, "form" ) || elem.options )
  799. ret.push( elem );
  800. else
  801. ret = jQuery.merge( ret, elem );
  802. });
  803. return ret;
  804. },
  805. attr: function( elem, name, value ) {
  806. // don't set attributes on text and comment nodes
  807. if (!elem || elem.nodeType == 3 || elem.nodeType == 8)
  808. return undefined;
  809. var fix = jQuery.isXMLDoc( elem ) ?
  810. {} :
  811. jQuery.props;
  812. // Safari mis-reports the default selected property of a hidden option
  813. // Accessing the parent's selectedIndex property fixes it
  814. if ( name == "selected" && jQuery.browser.safari )
  815. elem.parentNode.selectedIndex;
  816. // Certain attributes only work when accessed via the old DOM 0 way
  817. if ( fix[ name ] ) {
  818. if ( value != undefined )
  819. elem[ fix[ name ] ] = value;
  820. return elem[ fix[ name ] ];
  821. } else if ( jQuery.browser.msie && name == "style" )
  822. return jQuery.attr( elem.style, "cssText", value );
  823. else if ( value == undefined && jQuery.browser.msie && jQuery.nodeName( elem, "form" ) && (name == "action" || name == "method") )
  824. return elem.getAttributeNode( name ).nodeValue;
  825. // IE elem.getAttribute passes even for style
  826. else if ( elem.tagName ) {
  827. if ( value != undefined ) {
  828. // We can't allow the type property to be changed (since it causes problems in IE)
  829. if ( name == "type" && jQuery.nodeName( elem, "input" ) && elem.parentNode )
  830. throw "type property can't be changed";
  831. // convert the value to a string (all browsers do this but IE) see #1070
  832. elem.setAttribute( name, "" + value );
  833. }
  834. if ( jQuery.browser.msie && /href|src/.test( name ) && !jQuery.isXMLDoc( elem ) )
  835. return elem.getAttribute( name, 2 );
  836. return elem.getAttribute( name );
  837. // elem is actually elem.style ... set the style
  838. } else {
  839. // IE actually uses filters for opacity
  840. if ( name == "opacity" && jQuery.browser.msie ) {
  841. if ( value != undefined ) {
  842. // IE has trouble with opacity if it does not have layout
  843. // Force it by setting the zoom level
  844. elem.zoom = 1;
  845. // Set the alpha filter to set the opacity
  846. elem.filter = (elem.filter || "").replace( /alpha\([^)]*\)/, "" ) +
  847. (parseFloat( value ).toString() == "NaN" ? "" : "alpha(opacity=" + value * 100 + ")");
  848. }
  849. return elem.filter && elem.filter.indexOf("opacity=") >= 0 ?
  850. (parseFloat( elem.filter.match(/opacity=([^)]*)/)[1] ) / 100).toString() :
  851. "";
  852. }
  853. name = name.replace(/-([a-z])/ig, function(all, letter){
  854. return letter.toUpperCase();
  855. });
  856. if ( value != undefined )
  857. elem[ name ] = value;
  858. return elem[ name ];
  859. }
  860. },
  861. trim: function( text ) {
  862. return (text || "").replace( /^\s+|\s+$/g, "" );
  863. },
  864. makeArray: function( array ) {
  865. var ret = [];
  866. // Need to use typeof to fight Safari childNodes crashes
  867. if ( typeof array != "array" )
  868. for ( var i = 0, length = array.length; i < length; i++ )
  869. ret.push( array[ i ] );
  870. else
  871. ret = array.slice( 0 );
  872. return ret;
  873. },
  874. inArray: function( elem, array ) {
  875. for ( var i = 0, length = array.length; i < length; i++ )
  876. if ( array[ i ] == elem )
  877. return i;
  878. return -1;
  879. },
  880. merge: function( first, second ) {
  881. // We have to loop this way because IE & Opera overwrite the length
  882. // expando of getElementsByTagName
  883. // Also, we need to make sure that the correct elements are being returned
  884. // (IE returns comment nodes in a '*' query)
  885. if ( jQuery.browser.msie ) {
  886. for ( var i = 0; second[ i ]; i++ )
  887. if ( second[ i ].nodeType != 8 )
  888. first.push( second[ i ] );
  889. } else
  890. for ( var i = 0; second[ i ]; i++ )
  891. first.push( second[ i ] );
  892. return first;
  893. },
  894. unique: function( array ) {
  895. var ret = [], done = {};
  896. try {
  897. for ( var i = 0, length = array.length; i < length; i++ ) {
  898. var id = jQuery.data( array[ i ] );
  899. if ( !done[ id ] ) {
  900. done[ id ] = true;
  901. ret.push( array[ i ] );
  902. }
  903. }
  904. } catch( e ) {
  905. ret = array;
  906. }
  907. return ret;
  908. },
  909. grep: function( elems, callback, inv ) {
  910. // If a string is passed in for the function, make a function
  911. // for it (a handy shortcut)
  912. if ( typeof callback == "string" )
  913. callback = eval("false||function(a,i){return " + callback + "}");
  914. var ret = [];
  915. // Go through the array, only saving the items
  916. // that pass the validator function
  917. for ( var i = 0, length = elems.length; i < length; i++ )
  918. if ( !inv && callback( elems[ i ], i ) || inv && !callback( elems[ i ], i ) )
  919. ret.push( elems[ i ] );
  920. return ret;
  921. },
  922. map: function( elems, callback ) {
  923. var ret = [];
  924. // Go through the array, translating each of the items to their
  925. // new value (or values).
  926. for ( var i = 0, length = elems.length; i < length; i++ ) {
  927. var value = callback( elems[ i ], i );
  928. if ( value !== null && value != undefined ) {
  929. if ( value.constructor != Array )
  930. value = [ value ];
  931. ret = ret.concat( value );
  932. }
  933. }
  934. return ret;
  935. }
  936. });
  937. var userAgent = navigator.userAgent.toLowerCase();
  938. // Figure out what browser is being used
  939. jQuery.browser = {
  940. version: (userAgent.match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [])[1],
  941. safari: /webkit/.test( userAgent ),
  942. opera: /opera/.test( userAgent ),
  943. msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ),
  944. mozilla: /mozilla/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent )
  945. };
  946. var styleFloat = jQuery.browser.msie ?
  947. "styleFloat" :
  948. "cssFloat";
  949. jQuery.extend({
  950. // Check to see if the W3C box model is being used
  951. boxModel: !jQuery.browser.msie || document.compatMode == "CSS1Compat",
  952. props: {
  953. "for": "htmlFor",
  954. "class": "className",
  955. "float": styleFloat,
  956. cssFloat: styleFloat,
  957. styleFloat: styleFloat,
  958. innerHTML: "innerHTML",
  959. className: "className",
  960. value: "value",
  961. disabled: "disabled",
  962. checked: "checked",
  963. readonly: "readOnly",
  964. selected: "selected",
  965. maxlength: "maxLength",
  966. selectedIndex: "selectedIndex",
  967. defaultValue: "defaultValue",
  968. tagName: "tagName",
  969. nodeName: "nodeName"
  970. }
  971. });
  972. jQuery.each({
  973. parent: "elem.parentNode",
  974. parents: "jQuery.dir(elem,'parentNode')",
  975. next: "jQuery.nth(elem,2,'nextSibling')",
  976. prev: "jQuery.nth(elem,2,'previousSibling')",
  977. nextAll: "jQuery.dir(elem,'nextSibling')",
  978. prevAll: "jQuery.dir(elem,'previousSibling')",
  979. siblings: "jQuery.sibling(elem.parentNode.firstChild,elem)",
  980. children: "jQuery.sibling(elem.firstChild)",
  981. contents: "jQuery.nodeName(elem,'iframe')?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes)"
  982. }, function(name, fn){
  983. fn = eval("false||function(elem){return " + fn + "}");
  984. jQuery.fn[ name ] = function( selector ) {
  985. var ret = jQuery.map( this, fn );
  986. if ( selector && typeof selector == "string" )
  987. ret = jQuery.multiFilter( selector, ret );
  988. return this.pushStack( jQuery.unique( ret ) );
  989. };
  990. });
  991. jQuery.each({
  992. appendTo: "append",
  993. prependTo: "prepend",
  994. insertBefore: "before",
  995. insertAfter: "after",
  996. replaceAll: "replaceWith"
  997. }, function(name, original){
  998. jQuery.fn[ name ] = function() {
  999. var args = arguments;
  1000. return this.each(function(){
  1001. for ( var i = 0, length = args.length; i < length; i++ )
  1002. jQuery( args[ i ] )[ original ]( this );
  1003. });
  1004. };
  1005. });
  1006. jQuery.each({
  1007. removeAttr: function( name ) {
  1008. jQuery.attr( this, name, "" );
  1009. if (this.nodeType == 1)
  1010. this.removeAttribute( name );
  1011. },
  1012. addClass: function( classNames ) {
  1013. jQuery.className.add( this, classNames );
  1014. },
  1015. removeClass: function( classNames ) {
  1016. jQuery.className.remove( this, classNames );
  1017. },
  1018. toggleClass: function( classNames ) {
  1019. jQuery.className[ jQuery.className.has( this, classNames ) ? "remove" : "add" ]( this, classNames );
  1020. },
  1021. remove: function( selector ) {
  1022. if ( !selector || jQuery.filter( selector, [ this ] ).r.length ) {
  1023. // Prevent memory leaks
  1024. jQuery( "*", this ).add(this).each(function(){
  1025. jQuery.event.remove(this);
  1026. jQuery.removeData(this);
  1027. });
  1028. if (this.parentNode)
  1029. this.parentNode.removeChild( this );
  1030. }
  1031. },
  1032. empty: function() {
  1033. // Remove element nodes and prevent memory leaks
  1034. jQuery( ">*", this ).remove();
  1035. // Remove any remaining nodes
  1036. while ( this.firstChild )
  1037. this.removeChild( this.firstChild );
  1038. }
  1039. }, function(name, fn){
  1040. jQuery.fn[ name ] = function(){
  1041. return this.each( fn, arguments );
  1042. };
  1043. });
  1044. jQuery.each([ "Height", "Width" ], function(i, name){
  1045. var type = name.toLowerCase();
  1046. jQuery.fn[ type ] = function( size ) {
  1047. // Get window width or height
  1048. return this[0] == window ?
  1049. // Opera reports document.body.client[Width/Height] properly in both quirks and standards
  1050. jQuery.browser.opera && document.body[ "client" + name ] ||
  1051. // Safari reports inner[Width/Height] just fine (Mozilla and Opera include scroll bar widths)
  1052. jQuery.browser.safari && window[ "inner" + name ] ||
  1053. // Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode
  1054. document.compatMode == "CSS1Compat" && document.documentElement[ "client" + name ] || document.body[ "client" + name ] :
  1055. // Get document width or height
  1056. this[0] == document ?
  1057. // Either scroll[Width/Height] or offset[Width/Height], whichever is greater
  1058. Math.max(
  1059. Math.max(document.body["scroll" + name], document.documentElement["scroll" + name]),
  1060. Math.max(document.body["offset" + name], document.documentElement["offset" + name])
  1061. ) :
  1062. // Get or set width or height on the element
  1063. size == undefined ?
  1064. // Get width or height on the element
  1065. (this.length ? jQuery.css( this[0], type ) : null) :
  1066. // Set the width or height on the element (default to pixels if value is unitless)
  1067. this.css( type, size.constructor == String ? size : size + "px" );
  1068. };
  1069. });
  1070. var chars = jQuery.browser.safari && parseInt(jQuery.browser.version) < 417 ?
  1071. "(?:[\\w*_-]|\\\\.)" :
  1072. "(?:[\\w\u0128-\uFFFF*_-]|\\\\.)",
  1073. quickChild = new RegExp("^>\\s*(" + chars + "+)"),
  1074. quickID = new RegExp("^(" + chars + "+)(#)(" + chars + "+)"),
  1075. quickClass = new RegExp("^([#.]?)(" + chars + "*)");
  1076. jQuery.extend({
  1077. expr: {
  1078. "": "m[2]=='*'||jQuery.nodeName(a,m[2])",
  1079. "#": "a.getAttribute('id')==m[2]",
  1080. ":": {
  1081. // Position Checks
  1082. lt: "i<m[3]-0",
  1083. gt: "i>m[3]-0",
  1084. nth: "m[3]-0==i",
  1085. eq: "m[3]-0==i",
  1086. first: "i==0",
  1087. last: "i==r.length-1",
  1088. even: "i%2==0",
  1089. odd: "i%2",
  1090. // Child Checks
  1091. "first-child": "a.parentNode.getElementsByTagName('*')[0]==a",
  1092. "last-child": "jQuery.nth(a.parentNode.lastChild,1,'previousSibling')==a",
  1093. "only-child": "!jQuery.nth(a.parentNode.lastChild,2,'previousSibling')",
  1094. // Parent Checks
  1095. parent: "a.firstChild",
  1096. empty: "!a.firstChild",
  1097. // Text Check
  1098. contains: "(a.textContent||a.innerText||jQuery(a).text()||'').indexOf(m[3])>=0",
  1099. // Visibility
  1100. visible: '"hidden"!=a.type&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden"',
  1101. hidden: '"hidden"==a.type||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden"',
  1102. // Form attributes
  1103. enabled: "!a.disabled",
  1104. disabled: "a.disabled",
  1105. checked: "a.checked",
  1106. selected: "a.selected||jQuery.attr(a,'selected')",
  1107. // Form elements
  1108. text: "'text'==a.type",
  1109. radio: "'radio'==a.type",
  1110. checkbox: "'checkbox'==a.type",
  1111. file: "'file'==a.type",
  1112. password: "'password'==a.type",
  1113. submit: "'submit'==a.type",
  1114. image: "'image'==a.type",
  1115. reset: "'reset'==a.type",
  1116. button: '"button"==a.type||jQuery.nodeName(a,"button")',
  1117. input: "/input|select|textarea|button/i.test(a.nodeName)",
  1118. // :has()
  1119. has: "jQuery.find(m[3],a).length",
  1120. // :header
  1121. header: "/h\\d/i.test(a.nodeName)",
  1122. // :animated
  1123. animated: "jQuery.grep(jQuery.timers,function(fn){return a==fn.elem;}).length"
  1124. }
  1125. },
  1126. // The regular expressions that power the parsing engine
  1127. parse: [
  1128. // Match: [@value='test'], [@foo]
  1129. /^(\[) *@?([\w-]+) *([!*$^~=]*) *('?"?)(.*?)\4 *\]/,
  1130. // Match: :contains('foo')
  1131. /^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/,
  1132. // Match: :even, :last-chlid, #id, .class
  1133. new RegExp("^([:.#]*)(" + chars + "+)")
  1134. ],
  1135. multiFilter: function( expr, elems, not ) {
  1136. var old, cur = [];
  1137. while ( expr && expr != old ) {
  1138. old = expr;
  1139. var f = jQuery.filter( expr, elems, not );
  1140. expr = f.t.replace(/^\s*,\s*/, "" );
  1141. cur = not ? elems = f.r : jQuery.merge( cur, f.r );
  1142. }
  1143. return cur;
  1144. },
  1145. find: function( t, context ) {
  1146. // Quickly handle non-string expressions
  1147. if ( typeof t != "string" )
  1148. return [ t ];
  1149. // check to make sure context is a DOM element or a document
  1150. if ( context && context.nodeType != 1 && context.nodeType != 9)
  1151. return [ ];
  1152. // Set the correct context (if none is provided)
  1153. context = context || document;
  1154. // Initialize the search
  1155. var ret = [context], done = [], last, nodeName;
  1156. // Continue while a selector expression exists, and while
  1157. // we're no longer looping upon ourselves
  1158. while ( t && last != t ) {
  1159. var r = [];
  1160. last = t;
  1161. t = jQuery.trim(t);
  1162. var foundToken = false;
  1163. // An attempt at speeding up child selectors that
  1164. // point to a specific element tag
  1165. var re = quickChild;
  1166. var m = re.exec(t);
  1167. if ( m ) {
  1168. nodeName = m[1].toUpperCase();
  1169. // Perform our own iteration and filter
  1170. for ( var i = 0; ret[i]; i++ )
  1171. for ( var c = ret[i].firstChild; c; c = c.nextSibling )
  1172. if ( c.nodeType == 1 && (nodeName == "*" || c.nodeName.toUpperCase() == nodeName) )
  1173. r.push( c );
  1174. ret = r;
  1175. t = t.replace( re, "" );
  1176. if ( t.indexOf(" ") == 0 ) continue;
  1177. foundToken = true;
  1178. } else {
  1179. re = /^([>+~])\s*(\w*)/i;
  1180. if ( (m = re.exec(t)) != null ) {
  1181. r = [];
  1182. var merge = {};
  1183. nodeName = m[2].toUpperCase();
  1184. m = m[1];
  1185. for ( var j = 0, rl = ret.length; j < rl; j++ ) {
  1186. var n = m == "~" || m == "+" ? ret[j].nextSibling : ret[j].firstChild;
  1187. for ( ; n; n = n.nextSibling )
  1188. if ( n.nodeType == 1 ) {
  1189. var id = jQuery.data(n);
  1190. if ( m == "~" && merge[id] ) break;
  1191. if (!nodeName || n.nodeName.toUpperCase() == nodeName ) {
  1192. if ( m == "~" ) merge[id] = true;
  1193. r.push( n );
  1194. }
  1195. if ( m == "+" ) break;
  1196. }
  1197. }
  1198. ret = r;
  1199. // And remove the token
  1200. t = jQuery.trim( t.replace( re, "" ) );
  1201. foundToken = true;
  1202. }
  1203. }
  1204. // See if there's still an expression, and that we haven't already
  1205. // matched a token
  1206. if ( t && !foundToken ) {
  1207. // Handle multiple expressions
  1208. if ( !t.indexOf(",") ) {
  1209. // Clean the result set
  1210. if ( context == ret[0] ) ret.shift();
  1211. // Merge the result sets
  1212. done = jQuery.merge( done, ret );
  1213. // Reset the context
  1214. r = ret = [context];
  1215. // Touch up the selector string
  1216. t = " " + t.substr(1,t.length);
  1217. } else {
  1218. // Optimize for the case nodeName#idName
  1219. var re2 = quickID;
  1220. var m = re2.exec(t);
  1221. // Re-organize the results, so that they're consistent
  1222. if ( m ) {
  1223. m = [ 0, m[2], m[3], m[1] ];
  1224. } else {
  1225. // Otherwise, do a traditional filter check for
  1226. // ID, class, and element selectors
  1227. re2 = quickClass;
  1228. m = re2.exec(t);
  1229. }
  1230. m[2] = m[2].replace(/\\/g, "");
  1231. var elem = ret[ret.length-1];
  1232. // Try to do a global search by ID, where we can
  1233. if ( m[1] == "#" && elem && elem.getElementById && !jQuery.isXMLDoc(elem) ) {
  1234. // Optimization for HTML document case
  1235. var oid = elem.getElementById(m[2]);
  1236. // Do a quick check for the existence of the actual ID attribute
  1237. // to avoid selecting by the name attribute in IE
  1238. // also check to insure id is a string to avoid selecting an element with the name of 'id' inside a form
  1239. if ( (jQuery.browser.msie||jQuery.browser.opera) && oid && typeof oid.id == "string" && oid.id != m[2] )
  1240. oid = jQuery('[@id="'+m[2]+'"]', elem)[0];
  1241. // Do a quick check for node name (where applicable) so
  1242. // that div#foo searches will be really fast
  1243. ret = r = oid && (!m[3] || jQuery.nodeName(oid, m[3])) ? [oid] : [];
  1244. } else {
  1245. // We need to find all descendant elements
  1246. for ( var i = 0; ret[i]; i++ ) {
  1247. // Grab the tag name being searched for
  1248. var tag = m[1] == "#" && m[3] ? m[3] : m[1] != "" || m[0] == "" ? "*" : m[2];
  1249. // Handle IE7 being really dumb about <object>s
  1250. if ( tag == "*" && ret[i].nodeName.toLowerCase() == "object" )
  1251. tag = "param";
  1252. r = jQuery.merge( r, ret[i].getElementsByTagName( tag ));
  1253. }
  1254. // It's faster to filter by class and be done with it
  1255. if ( m[1] == "." )
  1256. r = jQuery.classFilter( r, m[2] );
  1257. // Same with ID filtering
  1258. if ( m[1] == "#" ) {
  1259. var tmp = [];
  1260. // Try to find the element with the ID
  1261. for ( var i = 0; r[i]; i++ )
  1262. if ( r[i].getAttribute("id") == m[2] ) {
  1263. tmp = [ r[i] ];
  1264. break;
  1265. }
  1266. r = tmp;
  1267. }
  1268. ret = r;
  1269. }
  1270. t = t.replace( re2, "" );
  1271. }
  1272. }
  1273. // If a selector string still exists
  1274. if ( t ) {
  1275. // Attempt to filter it
  1276. var val = jQuery.filter(t,r);
  1277. ret = r = val.r;
  1278. t = jQuery.trim(val.t);
  1279. }
  1280. }
  1281. // An error occurred with the selector;
  1282. // just return an empty set instead
  1283. if ( t )
  1284. ret = [];
  1285. // Remove the root context
  1286. if ( ret && context == ret[0] )
  1287. ret.shift();
  1288. // And combine the results
  1289. done = jQuery.merge( done, ret );
  1290. return done;
  1291. },
  1292. classFilter: function(r,m,not){
  1293. m = " " + m + " ";
  1294. var tmp = [];
  1295. for ( var i = 0; r[i]; i++ ) {
  1296. var pass = (" " + r[i].className + " ").indexOf( m ) >= 0;
  1297. if ( !not && pass || not && !pass )
  1298. tmp.push( r[i] );
  1299. }
  1300. return tmp;
  1301. },
  1302. filter: function(t,r,not) {
  1303. var last;
  1304. // Look for common filter expressions
  1305. while ( t && t != last ) {
  1306. last = t;
  1307. var p = jQuery.parse, m;
  1308. for ( var i = 0; p[i]; i++ ) {
  1309. m = p[i].exec( t );
  1310. if ( m ) {
  1311. // Remove what we just matched
  1312. t = t.substring( m[0].length );
  1313. m[2] = m[2].replace(/\\/g, "");
  1314. break;
  1315. }
  1316. }
  1317. if ( !m )
  1318. break;
  1319. // :not() is a special case that can be optimized by
  1320. // keeping it out of the expression list
  1321. if ( m[1] == ":" && m[2] == "not" )
  1322. // optimize if only one selector found (most common case)
  1323. r = isSimple.test( m[3] ) ?
  1324. jQuery.filter(m[3], r, true).r :
  1325. jQuery( r ).not( m[3] );
  1326. // We can get a big speed boost by filtering by class here
  1327. else if ( m[1] == "." )
  1328. r = jQuery.classFilter(r, m[2], not);
  1329. else if ( m[1] == "[" ) {
  1330. var tmp = [], type = m[3];
  1331. for ( var i = 0, rl = r.length; i < rl; i++ ) {
  1332. var a = r[i], z = a[ jQuery.props[m[2]] || m[2] ];
  1333. if ( z == null || /href|src|selected/.test(m[2]) )
  1334. z = jQuery.attr(a,m[2]) || '';
  1335. if ( (type == "" && !!z ||
  1336. type == "=" && z == m[5] ||
  1337. type == "!=" && z != m[5] ||
  1338. type == "^=" && z && !z.indexOf(m[5]) ||
  1339. type == "$=" && z.substr(z.length - m[5].length) == m[5] ||
  1340. (type == "*=" || type == "~=") && z.indexOf(m[5]) >= 0) ^ not )
  1341. tmp.push( a );
  1342. }
  1343. r = tmp;
  1344. // We can get a speed boost by handling nth-child here
  1345. } else if ( m[1] == ":" && m[2] == "nth-child" ) {
  1346. var merge = {}, tmp = [],
  1347. // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
  1348. test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec(
  1349. m[3] == "even" && "2n" || m[3] == "odd" && "2n+1" ||
  1350. !/\D/.test(m[3]) && "0n+" + m[3] || m[3]),
  1351. // calculate the numbers (first)n+(last) including if they are negative
  1352. first = (test[1] + (test[2] || 1)) - 0, last = test[3] - 0;
  1353. // loop through all the elements left in the jQuery object
  1354. for ( var i = 0, rl = r.length; i < rl; i++ ) {
  1355. var node = r[i], parentNode = node.parentNode, id = jQuery.data(parentNode);
  1356. if ( !merge[id] ) {
  1357. var c = 1;
  1358. for ( var n = parentNode.firstChild; n; n = n.nextSibling )
  1359. if ( n.nodeType == 1 )
  1360. n.nodeIndex = c++;
  1361. merge[id] = true;
  1362. }
  1363. var add = false;
  1364. if ( first == 0 ) {
  1365. if ( node.nodeIndex == last )
  1366. add = true;
  1367. } else if ( (node.nodeIndex - last) % first == 0 && (node.nodeIndex - last) / first >= 0 )
  1368. add = true;
  1369. if ( add ^ not )
  1370. tmp.push( node );
  1371. }
  1372. r = tmp;
  1373. // Otherwise, find the expression to execute
  1374. } else {
  1375. var f = jQuery.expr[m[1]];
  1376. if ( typeof f != "string" )
  1377. f = jQuery.expr[m[1]][m[2]];
  1378. // Build a custom macro to enclose it
  1379. f = eval("false||function(a,i){return " + f + "}");
  1380. // Execute it against the current filter
  1381. r = jQuery.grep( r, f, not );
  1382. }
  1383. }
  1384. // Return an array of filtered elements (r)
  1385. // and the modified expression string (t)
  1386. return { r: r, t: t };
  1387. },
  1388. dir: function( elem, dir ){
  1389. var matched = [];
  1390. var cur = elem[dir];
  1391. while ( cur && cur != document ) {
  1392. if ( cur.nodeType == 1 )
  1393. matched.push( cur );
  1394. cur = cur[dir];
  1395. }
  1396. return matched;
  1397. },
  1398. nth: function(cur,result,dir,elem){
  1399. result = result || 1;
  1400. var num = 0;
  1401. for ( ; cur; cur = cur[dir] )
  1402. if ( cur.nodeType == 1 && ++num == result )
  1403. break;
  1404. return cur;
  1405. },
  1406. sibling: function( n, elem ) {
  1407. var r = [];
  1408. for ( ; n; n = n.nextSibling ) {
  1409. if ( n.nodeType == 1 && (!elem || n != elem) )
  1410. r.push( n );
  1411. }
  1412. return r;
  1413. }
  1414. });
  1415. /*
  1416. * A number of helper functions used for managing events.
  1417. * Many of the ideas behind this code orignated from
  1418. * Dean Edwards' addEvent library.
  1419. */
  1420. jQuery.event = {
  1421. // Bind an event to an element
  1422. // Original by Dean Edwards
  1423. add: function(elem, types, handler, data) {
  1424. if ( elem.nodeType == 3 || elem.nodeType == 8 )
  1425. return;
  1426. // For whatever reason, IE has trouble passing the window object
  1427. // around, causing it to be cloned in the process
  1428. if ( jQuery.browser.msie && elem.setInterval != undefined )
  1429. elem = window;
  1430. // Make sure that the function being executed has a unique ID
  1431. if ( !handler.guid )
  1432. handler.guid = this.guid++;
  1433. // if data is passed, bind to handler
  1434. if( data != undefined ) {
  1435. // Create temporary function pointer to original handler
  1436. var fn = handler;
  1437. // Create unique handler function, wrapped around original handler
  1438. handler = function() {
  1439. // Pass arguments and context to original handler
  1440. return fn.apply(this, arguments);
  1441. };
  1442. // Store data in unique handler
  1443. handler.data = data;
  1444. // Set the guid of unique handler to the same of original handler, so it can be removed
  1445. handler.guid = fn.guid;
  1446. }
  1447. // Init the element's event structure
  1448. var events = jQuery.data(elem, "events") || jQuery.data(elem, "events", {}),
  1449. handle = jQuery.data(elem, "handle") || jQuery.data(elem, "handle", function(){
  1450. // returned undefined or false
  1451. var val;
  1452. // Handle the second event of a trigger and when
  1453. // an event is called after a page has unloaded
  1454. if ( typeof jQuery == "undefined" || jQuery.event.triggered )
  1455. return val;
  1456. val = jQuery.event.handle.apply(elem, arguments);
  1457. return val;
  1458. });
  1459. // Handle multiple events seperated by a space
  1460. // jQuery(...).bind("mouseover mouseout", fn);
  1461. jQuery.each(types.split(/\s+/), function(index, type) {
  1462. // Namespaced event handlers
  1463. var parts = type.split(".");
  1464. type = parts[0];
  1465. handler.type = parts[1];
  1466. // Get the current list of functions bound to this event
  1467. var handlers = events[type];
  1468. // Init the event handler queue
  1469. if (!handlers) {
  1470. handlers = events[type] = {};
  1471. // Check for a special event handler
  1472. // Only use addEventListener/attachEvent if the special
  1473. // events handler returns false
  1474. if ( !jQuery.event.special[type] || jQuery.event.special[type].setup.call(elem) === false ) {
  1475. // Bind the global event handler to the element
  1476. if (elem.addEventListener)
  1477. elem.addEventListener(type, handle, false);
  1478. else if (elem.attachEvent)
  1479. elem.attachEvent("on" + type, handle);
  1480. }
  1481. }
  1482. // Add the function to the element's handler list
  1483. handlers[handler.guid] = handler;
  1484. // Keep track of which events have been used, for global triggering
  1485. jQuery.event.global[type] = true;
  1486. });
  1487. },
  1488. guid: 1,
  1489. global: {},
  1490. // Detach an event or set of events from an element
  1491. remove: function(elem, types, handler) {
  1492. // don't do events on text and comment nodes
  1493. if ( elem.nodeType == 3 || elem.nodeType == 8 )
  1494. return;
  1495. var events = jQuery.data(elem, "events"), ret, index;
  1496. if ( events ) {
  1497. // Unbind all events for the element
  1498. if ( types == undefined )
  1499. for ( var type in events )
  1500. this.remove( elem, type );
  1501. else {
  1502. // types is actually an event object here
  1503. if ( types.type ) {
  1504. handler = types.handler;
  1505. types = types.type;
  1506. }
  1507. // Handle multiple events seperated by a space
  1508. // jQuery(...).unbind("mouseover mouseout", fn);
  1509. jQuery.each(types.split(/\s+/), function(index, type){
  1510. // Namespaced event handlers
  1511. var parts = type.split(".");
  1512. type = parts[0];
  1513. if ( events[type] ) {
  1514. // remove the given handler for the given type
  1515. if ( handler )
  1516. delete events[type][handler.guid];
  1517. // remove all handlers for the given type
  1518. else
  1519. for ( handler in events[type] )
  1520. // Handle the removal of namespaced events
  1521. if ( !parts[1] || events[type][handler].type == parts[1] )
  1522. delete events[type][handler];
  1523. // remove generic event handler if no more handlers exist
  1524. for ( ret in events[type] ) break;
  1525. if ( !ret ) {
  1526. if ( !jQuery.event.special[type] || jQuery.event.special[type].teardown.call(elem) === false ) {
  1527. if (elem.removeEventListener)
  1528. elem.removeEventListener(type, jQuery.data(elem, "handle"), false);
  1529. else if (elem.detachEvent)
  1530. elem.detachEvent("on" + type, jQuery.data(elem, "handle"));
  1531. }
  1532. ret = null;
  1533. delete events[type];
  1534. }
  1535. }
  1536. });
  1537. }
  1538. // Remove the expando if it's no longer used
  1539. for ( ret in events ) break;
  1540. if ( !ret ) {
  1541. jQuery.removeData( elem, "events" );
  1542. jQuery.removeData( elem, "handle" );
  1543. }
  1544. }
  1545. },
  1546. trigger: function(type, data, elem, donative, extra) {
  1547. // Clone the incoming data, if any
  1548. data = jQuery.makeArray(data || []);
  1549. // Handle a global trigger
  1550. if ( !elem ) {
  1551. // Only trigger if we've ever bound an event for it
  1552. if ( this.global[type] )
  1553. jQuery("*").add([window, document]).trigger(type, data);
  1554. // Handle triggering a single element
  1555. } else {
  1556. // don't do events on text and comment nodes
  1557. if ( elem.nodeType == 3 || elem.nodeType == 8 )
  1558. return undefined;
  1559. var val, ret, fn = jQuery.isFunction( elem[ type ] || null ),
  1560. // Check to see if we need to provide a fake event, or not
  1561. event = !data[0] || !data[0].preventDefault;
  1562. // Pass along a fake event
  1563. if ( event )
  1564. data.unshift( this.fix({ type: type, target: elem }) );
  1565. // Enforce the right trigger type
  1566. data[0].type = type;
  1567. // Trigger the event
  1568. if ( jQuery.isFunction( jQuery.data(elem, "handle") ) )
  1569. val = jQuery.data(elem, "handle").apply( elem, data );
  1570. // Handle triggering native .onfoo handlers
  1571. if ( !fn && elem["on"+type] && elem["on"+type].apply( elem, data ) === false )
  1572. val = false;
  1573. // Extra functions don't get the custom event object
  1574. if ( event )
  1575. data.shift();
  1576. // Handle triggering of extra function
  1577. if ( extra && jQuery.isFunction( extra ) ) {
  1578. // call the extra function and tack the current return value on the end for possible inspection
  1579. var ret = extra.apply( elem, data.concat( val ) );
  1580. // if anything is returned, give it precedence and have it overwrite the previous value
  1581. if (ret !== undefined)
  1582. val = ret;
  1583. }
  1584. // Trigger the native events (except for clicks on links)
  1585. if ( fn && donative !== false && val !== false && !(jQuery.nodeName(elem, 'a') && type == "click") ) {
  1586. this.triggered = true;
  1587. try {
  1588. elem[ type ]();
  1589. // prevent IE from throwing an error for some hidden elements
  1590. } catch (e) {}
  1591. }
  1592. this.triggered = false;
  1593. }
  1594. return val;
  1595. },
  1596. handle: function(event) {
  1597. // returned undefined or false
  1598. var val;
  1599. // Empty object is for triggered events with no data
  1600. event = jQuery.event.fix( event || window.event || {} );
  1601. // Namespaced event handlers
  1602. var parts = event.type.split(".");
  1603. event.type = parts[0];
  1604. var handlers = jQuery.data(this, "events") && jQuery.data(this, "events")[event.type], args = Array.prototype.slice.call( arguments, 1 );
  1605. args.unshift( event );
  1606. for ( var j in handlers ) {
  1607. var handler = handlers[j];
  1608. // Pass in a reference to the handler function itself
  1609. // So that we can later remove it
  1610. args[0].handler = handler;
  1611. args[0].data = handler.data;
  1612. // Filter the functions by class
  1613. if ( !parts[1] || handler.type == parts[1] ) {
  1614. var ret = handler.apply( this, args );
  1615. if ( val !== false )
  1616. val = ret;
  1617. if ( ret === false ) {
  1618. event.preventDefault();
  1619. event.stopPropagation();
  1620. }
  1621. }
  1622. }
  1623. // Clean up added properties in IE to prevent memory leak
  1624. if (jQuery.browser.msie)
  1625. event.target = event.preventDefault = event.stopPropagation =
  1626. event.handler = event.data = null;
  1627. return val;
  1628. },
  1629. fix: function(event) {
  1630. // Short-circuit if the event has already been fixed by jQuery.event.fix
  1631. if ( event[ expando ] )
  1632. return event;
  1633. // store a copy of the original event object
  1634. // and clone to set read-only properties
  1635. var originalEvent = event;
  1636. event = jQuery.extend({}, originalEvent);
  1637. // Mark the event as fixed by jQuery.event.fix
  1638. event[ expando ] = true;
  1639. // add preventDefault and stopPropagation since
  1640. // they will not work on the clone
  1641. event.preventDefault = function() {
  1642. // if preventDefault exists run it on the original event
  1643. if (originalEvent.preventDefault)
  1644. originalEvent.preventDefault();
  1645. // otherwise set the returnValue property of the original event to false (IE)
  1646. originalEvent.returnValue = false;
  1647. };
  1648. event.stopPropagation = function() {
  1649. // if stopPropagation exists run it on the original event
  1650. if (originalEvent.stopPropagation)
  1651. originalEvent.stopPropagation();
  1652. // otherwise set the cancelBubble property of the original event to true (IE)
  1653. originalEvent.cancelBubble = true;
  1654. };
  1655. // Fix target property, if necessary
  1656. if ( !event.target )
  1657. event.target = event.srcElement || document; // Fixes #1925 where srcElement might not be defined either
  1658. // check if target is a textnode (safari)
  1659. if ( event.target.nodeType == 3 )
  1660. event.target = originalEvent.target.parentNode;
  1661. // Add relatedTarget, if necessary
  1662. if ( !event.relatedTarget && event.fromElement )
  1663. event.relatedTarget = event.fromElement == event.target ? event.toElement : event.fromElement;
  1664. // Calculate pageX/Y if missing and clientX/Y available
  1665. if ( event.pageX == null && event.clientX != null ) {
  1666. var doc = document.documentElement, body = document.body;
  1667. event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc.clientLeft || 0);
  1668. event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc.clientTop || 0);
  1669. }
  1670. // Add which for key events
  1671. if ( !event.which && (event.charCode || event.keyCode) )
  1672. event.which = event.charCode || event.keyCode;
  1673. // Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs)
  1674. if ( !event.metaKey && event.ctrlKey )
  1675. event.metaKey = event.ctrlKey;
  1676. // Add which for click: 1 == left; 2 == middle; 3 == right
  1677. // Note: button is not normalized, so don't use it
  1678. if ( !event.which && event.button )
  1679. event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) ));
  1680. return event;
  1681. },
  1682. special: {
  1683. ready: {
  1684. setup: function() {
  1685. // Make sure the ready event is setup
  1686. bindReady();
  1687. return;
  1688. },
  1689. teardown: function() { return; }
  1690. },
  1691. mouseenter: {
  1692. setup: function() {
  1693. if ( jQuery.browser.msie ) return false;
  1694. jQuery(this).bind("mouseover", jQuery.event.special.mouseenter.handler);
  1695. return true;
  1696. },
  1697. teardown: function() {
  1698. if ( jQuery.browser.msie ) return false;
  1699. jQuery(this).unbind("mouseover", jQuery.event.special.mouseenter.handler);
  1700. return true;
  1701. },
  1702. handler: function(event) {
  1703. // If we actually just moused on to a sub-element, ignore it
  1704. if ( withinElement(event, this) ) return true;
  1705. // Execute the right handlers by setting the event type to mouseenter
  1706. arguments[0].type = "mouseenter";
  1707. return jQuery.event.handle.apply(this, arguments);
  1708. }
  1709. },
  1710. mouseleave: {
  1711. setup: function() {
  1712. if ( jQuery.browser.msie ) return false;
  1713. jQuery(this).bind("mouseout", jQuery.event.special.mouseleave.handler);
  1714. return true;
  1715. },
  1716. teardown: function() {
  1717. if ( jQuery.browser.msie ) return false;
  1718. jQuery(this).unbind("mouseout", jQuery.event.special.mouseleave.handler);
  1719. return true;
  1720. },
  1721. handler: function(event) {
  1722. // If we actually just moused on to a sub-element, ignore it
  1723. if ( withinElement(event, this) ) return true;
  1724. // Execute the right handlers by setting the event type to mouseleave
  1725. arguments[0].type = "mouseleave";
  1726. return jQuery.event.handle.apply(this, arguments);
  1727. }
  1728. }
  1729. }
  1730. };
  1731. jQuery.fn.extend({
  1732. bind: function( type, data, fn ) {
  1733. return type == "unload" ? this.one(type, data, fn) : this.each(function(){
  1734. jQuery.event.add( this, type, fn || data, fn && data );
  1735. });
  1736. },
  1737. one: function( type, data, fn ) {
  1738. return this.each(function(){
  1739. jQuery.event.add( this, type, function(event) {
  1740. jQuery(this).unbind(event);
  1741. return (fn || data).apply( this, arguments);
  1742. }, fn && data);
  1743. });
  1744. },
  1745. unbind: function( type, fn ) {
  1746. return this.each(function(){
  1747. jQuery.event.remove( this, type, fn );
  1748. });
  1749. },
  1750. trigger: function( type, data, fn ) {
  1751. return this.each(function(){
  1752. jQuery.event.trigger( type, data, this, true, fn );
  1753. });
  1754. },
  1755. triggerHandler: function( type, data, fn ) {
  1756. if ( this[0] )
  1757. return jQuery.event.trigger( type, data, this[0], false, fn );
  1758. return undefined;
  1759. },
  1760. toggle: function() {
  1761. // Save reference to arguments for access in closure
  1762. var args = arguments;
  1763. return this.click(function(event) {
  1764. // Figure out which function to execute
  1765. this.lastToggle = 0 == this.lastToggle ? 1 : 0;
  1766. // Make sure that clicks stop
  1767. event.preventDefault();
  1768. // and execute the function
  1769. return args[this.lastToggle].apply( this, arguments ) || false;
  1770. });
  1771. },
  1772. hover: function(fnOver, fnOut) {
  1773. return this.bind('mouseenter', fnOver).bind('mouseleave', fnOut);
  1774. },
  1775. ready: function(fn) {
  1776. // Attach the listeners
  1777. bindReady();
  1778. // If the DOM is already ready
  1779. if ( jQuery.isReady )
  1780. // Execute the function immediately
  1781. fn.call( document, jQuery );
  1782. // Otherwise, remember the function for later
  1783. else
  1784. // Add the function to the wait list
  1785. jQuery.readyList.push( function() { return fn.call(this, jQuery); } );
  1786. return this;
  1787. }
  1788. });
  1789. jQuery.extend({
  1790. isReady: false,
  1791. readyList: [],
  1792. // Handle when the DOM is ready
  1793. ready: function() {
  1794. // Make sure that the DOM is not already loaded
  1795. if ( !jQuery.isReady ) {
  1796. // Remember that the DOM is ready
  1797. jQuery.isReady = true;
  1798. // If there are functions bound, to execute
  1799. if ( jQuery.readyList ) {
  1800. // Execute all of them
  1801. jQuery.each( jQuery.readyList, function(){
  1802. this.apply( document );
  1803. });
  1804. // Reset the list of functions
  1805. jQuery.readyList = null;
  1806. }
  1807. // Trigger any bound ready events
  1808. $(document).triggerHandler("ready");
  1809. }
  1810. }
  1811. });
  1812. var readyBound = false;
  1813. function bindReady(){
  1814. if ( readyBound ) return;
  1815. readyBound = true;
  1816. // Mozilla, Opera (see further below for it) and webkit nightlies currently support this event
  1817. if ( document.addEventListener && !jQuery.browser.opera)
  1818. // Use the handy event callback
  1819. document.addEventListener( "DOMContentLoaded", jQuery.ready, false );
  1820. // If IE is used and is not in a frame
  1821. // Continually check to see if the document is ready
  1822. if ( jQuery.browser.msie && window == top ) (function(){
  1823. if (jQuery.isReady) return;
  1824. try {
  1825. // If IE is used, use the trick by Diego Perini
  1826. // http://javascript.nwbox.com/IEContentLoaded/
  1827. document.documentElement.doScroll("left");
  1828. } catch( error ) {
  1829. setTimeout( arguments.callee, 0 );
  1830. return;
  1831. }
  1832. // and execute any waiting functions
  1833. jQuery.ready();
  1834. })();
  1835. if ( jQuery.browser.opera )
  1836. document.addEventListener( "DOMContentLoaded", function () {
  1837. if (jQuery.isReady) return;
  1838. for (var i = 0; i < document.styleSheets.length; i++)
  1839. if (document.styleSheets[i].disabled) {
  1840. setTimeout( arguments.callee, 0 );
  1841. return;
  1842. }
  1843. // and execute any waiting functions
  1844. jQuery.ready();
  1845. }, false);
  1846. if ( jQuery.browser.safari ) {
  1847. var numStyles;
  1848. (function(){
  1849. if (jQuery.isReady) return;
  1850. if ( document.readyState != "loaded" && document.readyState != "complete" ) {
  1851. setTimeout( arguments.callee, 0 );
  1852. return;
  1853. }
  1854. if ( numStyles === undefined )
  1855. numStyles = jQuery("style, link[rel=stylesheet]").length;
  1856. if ( document.styleSheets.length != numStyles ) {
  1857. setTimeout( arguments.callee, 0 );
  1858. return;
  1859. }
  1860. // and execute any waiting functions
  1861. jQuery.ready();
  1862. })();
  1863. }
  1864. // A fallback to window.onload, that will always work
  1865. jQuery.event.add( window, "load", jQuery.ready );
  1866. }
  1867. jQuery.each( ("blur,focus,load,resize,scroll,unload,click,dblclick," +
  1868. "mousedown,mouseup,mousemove,mouseover,mouseout,change,select," +
  1869. "submit,keydown,keypress,keyup,error").split(","), function(i, name){
  1870. // Handle event binding
  1871. jQuery.fn[name] = function(fn){
  1872. return fn ? this.bind(name, fn) : this.trigger(name);
  1873. };
  1874. });
  1875. // Checks if an event happened on an element within another element
  1876. // Used in jQuery.event.special.mouseenter and mouseleave handlers
  1877. var withinElement = function(event, elem) {
  1878. // Check if mouse(over|out) are still within the same parent element
  1879. var parent = event.relatedTarget;
  1880. // Traverse up the tree
  1881. while ( parent && parent != elem ) try { parent = parent.parentNode } catch(error) { parent = elem; };
  1882. // Return true if we actually just moused on to a sub-element
  1883. return parent == elem;
  1884. };
  1885. // Prevent memory leaks in IE
  1886. // And prevent errors on refresh with events like mouseover in other browsers
  1887. // Window isn't included so as not to unbind existing unload events
  1888. jQuery(window).bind("unload", function() {
  1889. jQuery("*").add(document).unbind();
  1890. });
  1891. jQuery.fn.extend({
  1892. load: function( url, params, callback ) {
  1893. if ( jQuery.isFunction( url ) )
  1894. return this.bind("load", url);
  1895. var off = url.indexOf(" ");
  1896. if ( off >= 0 ) {
  1897. var selector = url.slice(off, url.length);
  1898. url = url.slice(0, off);
  1899. }
  1900. callback = callback || function(){};
  1901. // Default to a GET request
  1902. var type = "GET";
  1903. // If the second parameter was provided
  1904. if ( params )
  1905. // If it's a function
  1906. if ( jQuery.isFunction( params ) ) {
  1907. // We assume that it's the callback
  1908. callback = params;
  1909. params = null;
  1910. // Otherwise, build a param string
  1911. } else {
  1912. params = jQuery.param( params );
  1913. type = "POST";
  1914. }
  1915. var self = this;
  1916. // Request the remote document
  1917. jQuery.ajax({
  1918. url: url,
  1919. type: type,
  1920. dataType: "html",
  1921. data: params,
  1922. complete: function(res, status){
  1923. // If successful, inject the HTML into all the matched elements
  1924. if ( status == "success" || status == "notmodified" )
  1925. // See if a selector was specified
  1926. self.html( selector ?
  1927. // Create a dummy div to hold the results
  1928. jQuery("<div/>")
  1929. // inject the contents of the document in, removing the scripts
  1930. // to avoid any 'Permission Denied' errors in IE
  1931. .append(res.responseText.replace(/<script(.|\s)*?\/script>/g, ""))
  1932. // Locate the specified elements
  1933. .find(selector) :
  1934. // If not, just inject the full result
  1935. res.responseText );
  1936. self.each( callback, [res.responseText, status, res] );
  1937. }
  1938. });
  1939. return this;
  1940. },
  1941. serialize: function() {
  1942. return jQuery.param(this.serializeArray());
  1943. },
  1944. serializeArray: function() {
  1945. return this.map(function(){
  1946. return jQuery.nodeName(this, "form") ?
  1947. jQuery.makeArray(this.elements) : this;
  1948. })
  1949. .filter(function(){
  1950. return this.name && !this.disabled &&
  1951. (this.checked || /select|textarea/i.test(this.nodeName) ||
  1952. /text|hidden|password/i.test(this.type));
  1953. })
  1954. .map(function(i, elem){
  1955. var val = jQuery(this).val();
  1956. return val == null ? null :
  1957. val.constructor == Array ?
  1958. jQuery.map( val, function(val, i){
  1959. return {name: elem.name, value: val};
  1960. }) :
  1961. {name: elem.name, value: val};
  1962. }).get();
  1963. }
  1964. });
  1965. // Attach a bunch of functions for handling common AJAX events
  1966. jQuery.each( "ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","), function(i,o){
  1967. jQuery.fn[o] = function(f){
  1968. return this.bind(o, f);
  1969. };
  1970. });
  1971. var jsc = (new Date).getTime();
  1972. jQuery.extend({
  1973. get: function( url, data, callback, type ) {
  1974. // shift arguments if data argument was ommited
  1975. if ( jQuery.isFunction( data ) ) {
  1976. callback = data;
  1977. data = null;
  1978. }
  1979. return jQuery.ajax({
  1980. type: "GET",
  1981. url: url,
  1982. data: data,
  1983. success: callback,
  1984. dataType: type
  1985. });
  1986. },
  1987. getScript: function( url, callback ) {
  1988. return jQuery.get(url, null, callback, "script");
  1989. },
  1990. getJSON: function( url, data, callback ) {
  1991. return jQuery.get(url, data, callback, "json");
  1992. },
  1993. post: function( url, data, callback, type ) {
  1994. if ( jQuery.isFunction( data ) ) {
  1995. callback = data;
  1996. data = {};
  1997. }
  1998. return jQuery.ajax({
  1999. type: "POST",
  2000. url: url,
  2001. data: data,
  2002. success: callback,
  2003. dataType: type
  2004. });
  2005. },
  2006. ajaxSetup: function( settings ) {
  2007. jQuery.extend( jQuery.ajaxSettings, settings );
  2008. },
  2009. ajaxSettings: {
  2010. global: true,
  2011. type: "GET",
  2012. timeout: 0,
  2013. contentType: "application/x-www-form-urlencoded",
  2014. processData: true,
  2015. async: true,
  2016. data: null
  2017. },
  2018. // Last-Modified header cache for next request
  2019. lastModified: {},
  2020. ajax: function( s ) {
  2021. var jsonp, jsre = /=\?(&|$)/g, status, data;
  2022. // Extend the settings, but re-extend 's' so that it can be
  2023. // checked again later (in the test suite, specifically)
  2024. s = jQuery.extend(true, s, jQuery.extend(true, {}, jQuery.ajaxSettings, s));
  2025. // convert data if not already a string
  2026. if ( s.data && s.processData && typeof s.data != "string" )
  2027. s.data = jQuery.param(s.data);
  2028. // Handle JSONP Parameter Callbacks
  2029. if ( s.dataType == "jsonp" ) {
  2030. if ( s.type.toLowerCase() == "get" ) {
  2031. if ( !s.url.match(jsre) )
  2032. s.url += (s.url.match(/\?/) ? "&" : "?") + (s.jsonp || "callback") + "=?";
  2033. } else if ( !s.data || !s.data.match(jsre) )
  2034. s.data = (s.data ? s.data + "&" : "") + (s.jsonp || "callback") + "=?";
  2035. s.dataType = "json";
  2036. }
  2037. // Build temporary JSONP function
  2038. if ( s.dataType == "json" && (s.data && s.data.match(jsre) || s.url.match(jsre)) ) {
  2039. jsonp = "jsonp" + jsc++;
  2040. // Replace the =? sequence both in the query string and the data
  2041. if ( s.data )
  2042. s.data = (s.data + "").replace(jsre, "=" + jsonp + "$1");
  2043. s.url = s.url.replace(jsre, "=" + jsonp + "$1");
  2044. // We need to make sure
  2045. // that a JSONP style response is executed properly
  2046. s.dataType = "script";
  2047. // Handle JSONP-style loading
  2048. window[ jsonp ] = function(tmp){
  2049. data = tmp;
  2050. success();
  2051. complete();
  2052. // Garbage collect
  2053. window[ jsonp ] = undefined;
  2054. try{ delete window[ jsonp ]; } catch(e){}
  2055. if ( head )
  2056. head.removeChild( script );
  2057. };
  2058. }
  2059. if ( s.dataType == "script" && s.cache == null )
  2060. s.cache = false;
  2061. if ( s.cache === false && s.type.toLowerCase() == "get" ) {
  2062. var ts = (new Date()).getTime();
  2063. // try replacing _= if it is there
  2064. var ret = s.url.replace(/(\?|&)_=.*?(&|$)/, "$1_=" + ts + "$2");
  2065. // if nothing was replaced, add timestamp to the end
  2066. s.url = ret + ((ret == s.url) ? (s.url.match(/\?/) ? "&" : "?") + "_=" + ts : "");
  2067. }
  2068. // If data is available, append data to url for get requests
  2069. if ( s.data && s.type.toLowerCase() == "get" ) {
  2070. s.url += (s.url.match(/\?/) ? "&" : "?") + s.data;
  2071. // IE likes to send both get and post data, prevent this
  2072. s.data = null;
  2073. }
  2074. // Watch for a new set of requests
  2075. if ( s.global && ! jQuery.active++ )
  2076. jQuery.event.trigger( "ajaxStart" );
  2077. // If we're requesting a remote document
  2078. // and trying to load JSON or Script with a GET
  2079. if ( (!s.url.indexOf("http") || !s.url.indexOf("//")) && ( s.dataType == "script" || s.dataType =="json" ) && s.type.toLowerCase() == "get" ) {
  2080. var head = document.getElementsByTagName("head")[0];
  2081. var script = document.createElement("script");
  2082. script.src = s.url;
  2083. if (s.scriptCharset)
  2084. script.charset = s.scriptCharset;
  2085. // Handle Script loading
  2086. if ( !jsonp ) {
  2087. var done = false;
  2088. // Attach handlers for all browsers
  2089. script.onload = script.onreadystatechange = function(){
  2090. if ( !done && (!this.readyState ||
  2091. this.readyState == "loaded" || this.readyState == "complete") ) {
  2092. done = true;
  2093. success();
  2094. complete();
  2095. head.removeChild( script );
  2096. }
  2097. };
  2098. }
  2099. head.appendChild(script);
  2100. // We handle everything using the script element injection
  2101. return undefined;
  2102. }
  2103. var requestDone = false;
  2104. // Create the request object; Microsoft failed to properly
  2105. // implement the XMLHttpRequest in IE7, so we use the ActiveXObject when it is available
  2106. var xml = window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
  2107. // Open the socket
  2108. xml.open(s.type, s.url, s.async);
  2109. // Need an extra try/catch for cross domain requests in Firefox 3
  2110. try {
  2111. // Set the correct header, if data is being sent
  2112. if ( s.data )
  2113. xml.setRequestHeader("Content-Type", s.contentType);
  2114. // Set the If-Modified-Since header, if ifModified mode.
  2115. if ( s.ifModified )
  2116. xml.setRequestHeader("If-Modified-Since",
  2117. jQuery.lastModified[s.url] || "Thu, 01 Jan 1970 00:00:00 GMT" );
  2118. // Set header so the called script knows that it's an XMLHttpRequest
  2119. xml.setRequestHeader("X-Requested-With", "XMLHttpRequest");
  2120. } catch(e){}
  2121. // Allow custom headers/mimetypes
  2122. if ( s.beforeSend )
  2123. s.beforeSend(xml);
  2124. if ( s.global )
  2125. jQuery.event.trigger("ajaxSend", [xml, s]);
  2126. // Wait for a response to come back
  2127. var onreadystatechange = function(isTimeout){
  2128. // The transfer is complete and the data is available, or the request timed out
  2129. if ( !requestDone && xml && (xml.readyState == 4 || isTimeout == "timeout") ) {
  2130. requestDone = true;
  2131. // clear poll interval
  2132. if (ival) {
  2133. clearInterval(ival);
  2134. ival = null;
  2135. }
  2136. status = isTimeout == "timeout" && "timeout" ||
  2137. !jQuery.httpSuccess( xml ) && "error" ||
  2138. s.ifModified && jQuery.httpNotModified( xml, s.url ) && "notmodified" ||
  2139. "success";
  2140. if ( status == "success" ) {
  2141. // Watch for, and catch, XML document parse errors
  2142. try {
  2143. // process the data (runs the xml through httpData regardless of callback)
  2144. data = jQuery.httpData( xml, s.dataType );
  2145. } catch(e) {
  2146. status = "parsererror";
  2147. }
  2148. }
  2149. // Make sure that the request was successful or notmodified
  2150. if ( status == "success" ) {
  2151. // Cache Last-Modified header, if ifModified mode.
  2152. var modRes;
  2153. try {
  2154. modRes = xml.getResponseHeader("Last-Modified");
  2155. } catch(e) {} // swallow exception thrown by FF if header is not available
  2156. if ( s.ifModified && modRes )
  2157. jQuery.lastModified[s.url] = modRes;
  2158. // JSONP handles its own success callback
  2159. if ( !jsonp )
  2160. success();
  2161. } else
  2162. jQuery.handleError(s, xml, status);
  2163. // Fire the complete handlers
  2164. complete();
  2165. // Stop memory leaks
  2166. if ( s.async )
  2167. xml = null;
  2168. }
  2169. };
  2170. if ( s.async ) {
  2171. // don't attach the handler to the request, just poll it instead
  2172. var ival = setInterval(onreadystatechange, 13);
  2173. // Timeout checker
  2174. if ( s.timeout > 0 )
  2175. setTimeout(function(){
  2176. // Check to see if the request is still happening
  2177. if ( xml ) {
  2178. // Cancel the request
  2179. xml.abort();
  2180. if( !requestDone )
  2181. onreadystatechange( "timeout" );
  2182. }
  2183. }, s.timeout);
  2184. }
  2185. // Send the data
  2186. try {
  2187. xml.send(s.data);
  2188. } catch(e) {
  2189. jQuery.handleError(s, xml, null, e);
  2190. }
  2191. // firefox 1.5 doesn't fire statechange for sync requests
  2192. if ( !s.async )
  2193. onreadystatechange();
  2194. function success(){
  2195. // If a local callback was specified, fire it and pass it the data
  2196. if ( s.success )
  2197. s.success( data, status );
  2198. // Fire the global callback
  2199. if ( s.global )
  2200. jQuery.event.trigger( "ajaxSuccess", [xml, s] );
  2201. }
  2202. function complete(){
  2203. // Process result
  2204. if ( s.complete )
  2205. s.complete(xml, status);
  2206. // The request was completed
  2207. if ( s.global )
  2208. jQuery.event.trigger( "ajaxComplete", [xml, s] );
  2209. // Handle the global AJAX counter
  2210. if ( s.global && ! --jQuery.active )
  2211. jQuery.event.trigger( "ajaxStop" );
  2212. }
  2213. // return XMLHttpRequest to allow aborting the request etc.
  2214. return xml;
  2215. },
  2216. handleError: function( s, xml, status, e ) {
  2217. // If a local callback was specified, fire it
  2218. if ( s.error ) s.error( xml, status, e );
  2219. // Fire the global callback
  2220. if ( s.global )
  2221. jQuery.event.trigger( "ajaxError", [xml, s, e] );
  2222. },
  2223. // Counter for holding the number of active queries
  2224. active: 0,
  2225. // Determines if an XMLHttpRequest was successful or not
  2226. httpSuccess: function( r ) {
  2227. try {
  2228. // IE error sometimes returns 1223 when it should be 204 so treat it as success, see #1450
  2229. return !r.status && location.protocol == "file:" ||
  2230. ( r.status >= 200 && r.status < 300 ) || r.status == 304 || r.status == 1223 ||
  2231. jQuery.browser.safari && r.status == undefined;
  2232. } catch(e){}
  2233. return false;
  2234. },
  2235. // Determines if an XMLHttpRequest returns NotModified
  2236. httpNotModified: function( xml, url ) {
  2237. try {
  2238. var xmlRes = xml.getResponseHeader("Last-Modified");
  2239. // Firefox always returns 200. check Last-Modified date
  2240. return xml.status == 304 || xmlRes == jQuery.lastModified[url] ||
  2241. jQuery.browser.safari && xml.status == undefined;
  2242. } catch(e){}
  2243. return false;
  2244. },
  2245. httpData: function( r, type ) {
  2246. var ct = r.getResponseHeader("content-type");
  2247. var xml = type == "xml" || !type && ct && ct.indexOf("xml") >= 0;
  2248. var data = xml ? r.responseXML : r.responseText;
  2249. if ( xml && data.documentElement.tagName == "parsererror" )
  2250. throw "parsererror";
  2251. // If the type is "script", eval it in global context
  2252. if ( type == "script" )
  2253. jQuery.globalEval( data );
  2254. // Get the JavaScript object, if JSON is used.
  2255. if ( type == "json" )
  2256. data = eval("(" + data + ")");
  2257. return data;
  2258. },
  2259. // Serialize an array of form elements or a set of
  2260. // key/values into a query string
  2261. param: function( a ) {
  2262. var s = [];
  2263. // If an array was passed in, assume that it is an array
  2264. // of form elements
  2265. if ( a.constructor == Array || a.jquery )
  2266. // Serialize the form elements
  2267. jQuery.each( a, function(){
  2268. s.push( encodeURIComponent(this.name) + "=" + encodeURIComponent( this.value ) );
  2269. });
  2270. // Otherwise, assume that it's an object of key/value pairs
  2271. else
  2272. // Serialize the key/values
  2273. for ( var j in a )
  2274. // If the value is an array then the key names need to be repeated
  2275. if ( a[j] && a[j].constructor == Array )
  2276. jQuery.each( a[j], function(){
  2277. s.push( encodeURIComponent(j) + "=" + encodeURIComponent( this ) );
  2278. });
  2279. else
  2280. s.push( encodeURIComponent(j) + "=" + encodeURIComponent( a[j] ) );
  2281. // Return the resulting serialization
  2282. return s.join("&").replace(/%20/g, "+");
  2283. }
  2284. });
  2285. jQuery.fn.extend({
  2286. show: function(speed,callback){
  2287. return speed ?
  2288. this.animate({
  2289. height: "show", width: "show", opacity: "show"
  2290. }, speed, callback) :
  2291. this.filter(":hidden").each(function(){
  2292. this.style.display = this.oldblock || "";
  2293. if ( jQuery.css(this,"display") == "none" ) {
  2294. var elem = jQuery("<" + this.tagName + " />").appendTo("body");
  2295. this.style.display = elem.css("display");
  2296. elem.remove();
  2297. }
  2298. }).end();
  2299. },
  2300. hide: function(speed,callback){
  2301. return speed ?
  2302. this.animate({
  2303. height: "hide", width: "hide", opacity: "hide"
  2304. }, speed, callback) :
  2305. this.filter(":visible").each(function(){
  2306. this.oldblock = this.oldblock || jQuery.css(this,"display");
  2307. this.style.display = "none";
  2308. }).end();
  2309. },
  2310. // Save the old toggle function
  2311. _toggle: jQuery.fn.toggle,
  2312. toggle: function( fn, fn2 ){
  2313. return jQuery.isFunction(fn) && jQuery.isFunction(fn2) ?
  2314. this._toggle( fn, fn2 ) :
  2315. fn ?
  2316. this.animate({
  2317. height: "toggle", width: "toggle", opacity: "toggle"
  2318. }, fn, fn2) :
  2319. this.each(function(){
  2320. jQuery(this)[ jQuery(this).is(":hidden") ? "show" : "hide" ]();
  2321. });
  2322. },
  2323. slideDown: function(speed,callback){
  2324. return this.animate({height: "show"}, speed, callback);
  2325. },
  2326. slideUp: function(speed,callback){
  2327. return this.animate({height: "hide"}, speed, callback);
  2328. },
  2329. slideToggle: function(speed, callback){
  2330. return this.animate({height: "toggle"}, speed, callback);
  2331. },
  2332. fadeIn: function(speed, callback){
  2333. return this.animate({opacity: "show"}, speed, callback);
  2334. },
  2335. fadeOut: function(speed, callback){
  2336. return this.animate({opacity: "hide"}, speed, callback);
  2337. },
  2338. fadeTo: function(speed,to,callback){
  2339. return this.animate({opacity: to}, speed, callback);
  2340. },
  2341. animate: function( prop, speed, easing, callback ) {
  2342. var optall = jQuery.speed(speed, easing, callback);
  2343. return this[ optall.queue === false ? "each" : "queue" ](function(){
  2344. if ( this.nodeType != 1)
  2345. return false;
  2346. var opt = jQuery.extend({}, optall);
  2347. var hidden = jQuery(this).is(":hidden"), self = this;
  2348. for ( var p in prop ) {
  2349. if ( prop[p] == "hide" && hidden || prop[p] == "show" && !hidden )
  2350. return jQuery.isFunction(opt.complete) && opt.complete.apply(this);
  2351. if ( p == "height" || p == "width" ) {
  2352. // Store display property
  2353. opt.display = jQuery.css(this, "display");
  2354. // Make sure that nothing sneaks out
  2355. opt.overflow = this.style.overflow;
  2356. }
  2357. }
  2358. if ( opt.overflow != null )
  2359. this.style.overflow = "hidden";
  2360. opt.curAnim = jQuery.extend({}, prop);
  2361. jQuery.each( prop, function(name, val){
  2362. var e = new jQuery.fx( self, opt, name );
  2363. if ( /toggle|show|hide/.test(val) )
  2364. e[ val == "toggle" ? hidden ? "show" : "hide" : val ]( prop );
  2365. else {
  2366. var parts = val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),
  2367. start = e.cur(true) || 0;
  2368. if ( parts ) {
  2369. var end = parseFloat(parts[2]),
  2370. unit = parts[3] || "px";
  2371. // We need to compute starting value
  2372. if ( unit != "px" ) {
  2373. self.style[ name ] = (end || 1) + unit;
  2374. start = ((end || 1) / e.cur(true)) * start;
  2375. self.style[ name ] = start + unit;
  2376. }
  2377. // If a +=/-= token was provided, we're doing a relative animation
  2378. if ( parts[1] )
  2379. end = ((parts[1] == "-=" ? -1 : 1) * end) + start;
  2380. e.custom( start, end, unit );
  2381. } else
  2382. e.custom( start, val, "" );
  2383. }
  2384. });
  2385. // For JS strict compliance
  2386. return true;
  2387. });
  2388. },
  2389. queue: function(type, fn){
  2390. if ( jQuery.isFunction(type) || ( type && type.constructor == Array )) {
  2391. fn = type;
  2392. type = "fx";
  2393. }
  2394. if ( !type || (typeof type == "string" && !fn) )
  2395. return queue( this[0], type );
  2396. return this.each(function(){
  2397. if ( this.nodeType != 1)
  2398. return;
  2399. if ( fn.constructor == Array )
  2400. queue(this, type, fn);
  2401. else {
  2402. queue(this, type).push( fn );
  2403. if ( queue(this, type).length == 1 )
  2404. fn.apply(this);
  2405. }
  2406. });
  2407. },
  2408. stop: function(clearQueue, gotoEnd){
  2409. var timers = jQuery.timers;
  2410. if (clearQueue)
  2411. this.queue([]);
  2412. this.each(function(){
  2413. // go in reverse order so anything added to the queue during the loop is ignored
  2414. for ( var i = timers.length - 1; i >= 0; i-- )
  2415. if ( timers[i].elem == this ) {
  2416. if (gotoEnd)
  2417. // force the next step to be the last
  2418. timers[i](true);
  2419. timers.splice(i, 1);
  2420. }
  2421. });
  2422. // start the next in the queue if the last step wasn't forced
  2423. if (!gotoEnd)
  2424. this.dequeue();
  2425. return this;
  2426. }
  2427. });
  2428. var queue = function( elem, type, array ) {
  2429. if ( !elem )
  2430. return undefined;
  2431. type = type || "fx";
  2432. var q = jQuery.data( elem, type + "queue" );
  2433. if ( !q || array )
  2434. q = jQuery.data( elem, type + "queue",
  2435. array ? jQuery.makeArray(array) : [] );
  2436. return q;
  2437. };
  2438. jQuery.fn.dequeue = function(type){
  2439. type = type || "fx";
  2440. return this.each(function(){
  2441. var q = queue(this, type);
  2442. q.shift();
  2443. if ( q.length )
  2444. q[0].apply( this );
  2445. });
  2446. };
  2447. jQuery.extend({
  2448. speed: function(speed, easing, fn) {
  2449. var opt = speed && speed.constructor == Object ? speed : {
  2450. complete: fn || !fn && easing ||
  2451. jQuery.isFunction( speed ) && speed,
  2452. duration: speed,
  2453. easing: fn && easing || easing && easing.constructor != Function && easing
  2454. };
  2455. opt.duration = (opt.duration && opt.duration.constructor == Number ?
  2456. opt.duration :
  2457. { slow: 600, fast: 200 }[opt.duration]) || 400;
  2458. // Queueing
  2459. opt.old = opt.complete;
  2460. opt.complete = function(){
  2461. if ( opt.queue !== false )
  2462. jQuery(this).dequeue();
  2463. if ( jQuery.isFunction( opt.old ) )
  2464. opt.old.apply( this );
  2465. };
  2466. return opt;
  2467. },
  2468. easing: {
  2469. linear: function( p, n, firstNum, diff ) {
  2470. return firstNum + diff * p;
  2471. },
  2472. swing: function( p, n, firstNum, diff ) {
  2473. return ((-Math.cos(p*Math.PI)/2) + 0.5) * diff + firstNum;
  2474. }
  2475. },
  2476. timers: [],
  2477. timerId: null,
  2478. fx: function( elem, options, prop ){
  2479. this.options = options;
  2480. this.elem = elem;
  2481. this.prop = prop;
  2482. if ( !options.orig )
  2483. options.orig = {};
  2484. }
  2485. });
  2486. jQuery.fx.prototype = {
  2487. // Simple function for setting a style value
  2488. update: function(){
  2489. if ( this.options.step )
  2490. this.options.step.apply( this.elem, [ this.now, this ] );
  2491. (jQuery.fx.step[this.prop] || jQuery.fx.step._default)( this );
  2492. // Set display property to block for height/width animations
  2493. if ( this.prop == "height" || this.prop == "width" )
  2494. this.elem.style.display = "block";
  2495. },
  2496. // Get the current size
  2497. cur: function(force){
  2498. if ( this.elem[this.prop] != null && this.elem.style[this.prop] == null )
  2499. return this.elem[ this.prop ];
  2500. var r = parseFloat(jQuery.css(this.elem, this.prop, force));
  2501. return r && r > -10000 ? r : parseFloat(jQuery.curCSS(this.elem, this.prop)) || 0;
  2502. },
  2503. // Start an animation from one number to another
  2504. custom: function(from, to, unit){
  2505. this.startTime = (new Date()).getTime();
  2506. this.start = from;
  2507. this.end = to;
  2508. this.unit = unit || this.unit || "px";
  2509. this.now = this.start;
  2510. this.pos = this.state = 0;
  2511. this.update();
  2512. var self = this;
  2513. function t(gotoEnd){
  2514. return self.step(gotoEnd);
  2515. }
  2516. t.elem = this.elem;
  2517. jQuery.timers.push(t);
  2518. if ( jQuery.timerId == null ) {
  2519. jQuery.timerId = setInterval(function(){
  2520. var timers = jQuery.timers;
  2521. for ( var i = 0; i < timers.length; i++ )
  2522. if ( !timers[i]() )
  2523. timers.splice(i--, 1);
  2524. if ( !timers.length ) {
  2525. clearInterval( jQuery.timerId );
  2526. jQuery.timerId = null;
  2527. }
  2528. }, 13);
  2529. }
  2530. },
  2531. // Simple 'show' function
  2532. show: function(){
  2533. // Remember where we started, so that we can go back to it later
  2534. this.options.orig[this.prop] = jQuery.attr( this.elem.style, this.prop );
  2535. this.options.show = true;
  2536. // Begin the animation
  2537. this.custom(0, this.cur());
  2538. // Make sure that we start at a small width/height to avoid any
  2539. // flash of content
  2540. if ( this.prop == "width" || this.prop == "height" )
  2541. this.elem.style[this.prop] = "1px";
  2542. // Start by showing the element
  2543. jQuery(this.elem).show();
  2544. },
  2545. // Simple 'hide' function
  2546. hide: function(){
  2547. // Remember where we started, so that we can go back to it later
  2548. this.options.orig[this.prop] = jQuery.attr( this.elem.style, this.prop );
  2549. this.options.hide = true;
  2550. // Begin the animation
  2551. this.custom(this.cur(), 0);
  2552. },
  2553. // Each step of an animation
  2554. step: function(gotoEnd){
  2555. var t = (new Date()).getTime();
  2556. if ( gotoEnd || t > this.options.duration + this.startTime ) {
  2557. this.now = this.end;
  2558. this.pos = this.state = 1;
  2559. this.update();
  2560. this.options.curAnim[ this.prop ] = true;
  2561. var done = true;
  2562. for ( var i in this.options.curAnim )
  2563. if ( this.options.curAnim[i] !== true )
  2564. done = false;
  2565. if ( done ) {
  2566. if ( this.options.display != null ) {
  2567. // Reset the overflow
  2568. this.elem.style.overflow = this.options.overflow;
  2569. // Reset the display
  2570. this.elem.style.display = this.options.display;
  2571. if ( jQuery.css(this.elem, "display") == "none" )
  2572. this.elem.style.display = "block";
  2573. }
  2574. // Hide the element if the "hide" operation was done
  2575. if ( this.options.hide )
  2576. this.elem.style.display = "none";
  2577. // Reset the properties, if the item has been hidden or shown
  2578. if ( this.options.hide || this.options.show )
  2579. for ( var p in this.options.curAnim )
  2580. jQuery.attr(this.elem.style, p, this.options.orig[p]);
  2581. }
  2582. // If a callback was provided, execute it
  2583. if ( done && jQuery.isFunction( this.options.complete ) )
  2584. // Execute the complete function
  2585. this.options.complete.apply( this.elem );
  2586. return false;
  2587. } else {
  2588. var n = t - this.startTime;
  2589. this.state = n / this.options.duration;
  2590. // Perform the easing function, defaults to swing
  2591. this.pos = jQuery.easing[this.options.easing || (jQuery.easing.swing ? "swing" : "linear")](this.state, n, 0, 1, this.options.duration);
  2592. this.now = this.start + ((this.end - this.start) * this.pos);
  2593. // Perform the next step of the animation
  2594. this.update();
  2595. }
  2596. return true;
  2597. }
  2598. };
  2599. jQuery.fx.step = {
  2600. scrollLeft: function(fx){
  2601. fx.elem.scrollLeft = fx.now;
  2602. },
  2603. scrollTop: function(fx){
  2604. fx.elem.scrollTop = fx.now;
  2605. },
  2606. opacity: function(fx){
  2607. jQuery.attr(fx.elem.style, "opacity", fx.now);
  2608. },
  2609. _default: function(fx){
  2610. fx.elem.style[ fx.prop ] = fx.now + fx.unit;
  2611. }
  2612. };
  2613. // The Offset Method
  2614. // Originally By Brandon Aaron, part of the Dimension Plugin
  2615. // http://jquery.com/plugins/project/dimensions
  2616. jQuery.fn.offset = function() {
  2617. var left = 0, top = 0, elem = this[0], results;
  2618. if ( elem ) with ( jQuery.browser ) {
  2619. var parent = elem.parentNode,
  2620. offsetChild = elem,
  2621. offsetParent = elem.offsetParent,
  2622. doc = elem.ownerDocument,
  2623. safari2 = safari && parseInt(version) < 522,
  2624. fixed = jQuery.css(elem, "position") == "fixed";
  2625. // Use getBoundingClientRect if available
  2626. if ( elem.getBoundingClientRect ) {
  2627. var box = elem.getBoundingClientRect();
  2628. // Add the document scroll offsets
  2629. add(box.left + Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft),
  2630. box.top + Math.max(doc.documentElement.scrollTop, doc.body.scrollTop));
  2631. // IE adds the HTML element's border, by default it is medium which is 2px
  2632. // IE 6 and 7 quirks mode the border width is overwritable by the following css html { border: 0; }
  2633. // IE 7 standards mode, the border is always 2px
  2634. // This border/offset is typically represented by the clientLeft and clientTop properties
  2635. // However, in IE6 and 7 quirks mode the clientLeft and clientTop properties are not updated when overwriting it via CSS
  2636. // Therefore this method will be off by 2px in IE while in quirksmode
  2637. add( -doc.documentElement.clientLeft, -doc.documentElement.clientTop );
  2638. // Otherwise loop through the offsetParents and parentNodes
  2639. } else {
  2640. // Initial element offsets
  2641. add( elem.offsetLeft, elem.offsetTop );
  2642. // Get parent offsets
  2643. while ( offsetParent ) {
  2644. // Add offsetParent offsets
  2645. add( offsetParent.offsetLeft, offsetParent.offsetTop );
  2646. // Mozilla and Safari > 2 does not include the border on offset parents
  2647. // However Mozilla adds the border for table or table cells
  2648. if ( mozilla && !/^t(able|d|h)$/i.test(offsetParent.tagName) || safari && !safari2 )
  2649. border( offsetParent );
  2650. // Add the document scroll offsets if position is fixed on any offsetParent
  2651. if ( !fixed && jQuery.css(offsetParent, "position") == "fixed" )
  2652. fixed = true;
  2653. // Set offsetChild to previous offsetParent unless it is the body element
  2654. offsetChild = /^body$/i.test(offsetParent.tagName) ? offsetChild : offsetParent;
  2655. // Get next offsetParent
  2656. offsetParent = offsetParent.offsetParent;
  2657. }
  2658. // Get parent scroll offsets
  2659. while ( parent && parent.tagName && !/^body|html$/i.test(parent.tagName) ) {
  2660. // Remove parent scroll UNLESS that parent is inline or a table to work around Opera inline/table scrollLeft/Top bug
  2661. if ( !/^inline|table.*$/i.test(jQuery.css(parent, "display")) )
  2662. // Subtract parent scroll offsets
  2663. add( -parent.scrollLeft, -parent.scrollTop );
  2664. // Mozilla does not add the border for a parent that has overflow != visible
  2665. if ( mozilla && jQuery.css(parent, "overflow") != "visible" )
  2666. border( parent );
  2667. // Get next parent
  2668. parent = parent.parentNode;
  2669. }
  2670. // Safari <= 2 doubles body offsets with a fixed position element/offsetParent or absolutely positioned offsetChild
  2671. // Mozilla doubles body offsets with a non-absolutely positioned offsetChild
  2672. if ( (safari2 && (fixed || jQuery.css(offsetChild, "position") == "absolute")) ||
  2673. (mozilla && jQuery.css(offsetChild, "position") != "absolute") )
  2674. add( -doc.body.offsetLeft, -doc.body.offsetTop );
  2675. // Add the document scroll offsets if position is fixed
  2676. if ( fixed )
  2677. add(Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft),
  2678. Math.max(doc.documentElement.scrollTop, doc.body.scrollTop));
  2679. }
  2680. // Return an object with top and left properties
  2681. results = { top: top, left: left };
  2682. }
  2683. function border(elem) {
  2684. add( jQuery.curCSS(elem, "borderLeftWidth", true), jQuery.curCSS(elem, "borderTopWidth", true) );
  2685. }
  2686. function add(l, t) {
  2687. left += parseInt(l) || 0;
  2688. top += parseInt(t) || 0;
  2689. }
  2690. return results;
  2691. };
  2692. })();