/*
Copyright (c) 2010, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.com/yui/license.html
version: 3.1.1
build: 47
*/
YUI.add("array-extras",function(E){var C=E.Lang,D=Array.prototype,B=E.Array;B.lastIndexOf=(D.lastIndexOf)?function(A,F){return A.lastIndexOf(F);}:function(A,G){for(var F=A.length-1;F>=0;F=F-1){if(A[F]===G){break;}}return F;};B.unique=function(F,H){var A=F.slice(),G=0,J=-1,I=null;while(G<A.length){I=A[G];while((J=B.lastIndexOf(A,I))!==G){A.splice(J,1);}G+=1;}if(H){if(C.isNumber(A[0])){A.sort(B.numericSort);}else{A.sort();}}return A;};B.filter=(D.filter)?function(A,F,G){return D.filter.call(A,F,G);}:function(A,G,H){var F=[];B.each(A,function(K,J,I){if(G.call(H,K,J,I)){F.push(K);}});return F;};B.reject=function(A,F,G){return B.filter(A,function(J,I,H){return !F.call(G,J,I,H);});};B.every=(D.every)?function(A,F,G){return D.every.call(A,F,G);}:function(F,H,I){for(var G=0,A=F.length;G<A;G=G+1){if(!H.call(I,F[G],G,F)){return false;}}return true;};B.map=(D.map)?function(A,F,G){return D.map.call(A,F,G);}:function(A,G,H){var F=[];B.each(A,function(K,J,I){F.push(G.call(H,K,J,I));});return F;};B.reduce=(D.reduce)?function(A,H,F,G){return D.reduce.call(A,function(L,K,J,I){return F.call(G,L,K,J,I);},H);}:function(A,I,G,H){var F=I;B.each(A,function(L,K,J){F=G.call(H,F,L,K,J);});return F;};B.find=function(F,H,I){for(var G=0,A=F.length;G<A;G++){if(H.call(I,F[G],G,F)){return F[G];}}return null;};B.grep=function(A,F){return B.filter(A,function(H,G){return F.test(H);});};B.partition=function(A,G,H){var F={matches:[],rejects:[]};B.each(A,function(J,I){var K=G.call(H,J,I,A)?F.matches:F.rejects;K.push(J);});return F;};B.zip=function(F,A){var G=[];B.each(F,function(I,H){G.push([I,A[H]]);});return G;};B.forEach=B.each;},"3.1.1");YUI.add("arraylist",function(E){var D=E.Array,C=D.each,A;function B(F){if(F!==undefined){this._items=E.Lang.isArray(F)?F:D(F);}else{this._items=this._items||[];}}A={item:function(F){return this._items[F];},each:function(G,F){C(this._items,function(I,H){I=this.item(H);G.call(F||I,I,H,this);},this);return this;},some:function(G,F){return D.some(this._items,function(I,H){I=this.item(H);return G.call(F||I,I,H,this);},this);},indexOf:function(F){return D.indexOf(this._items,F);},size:function(){return this._items.length;},isEmpty:function(){return !this.size();}};A._item=A.item;B.prototype=A;E.mix(B,{addMethod:function(F,G){G=D(G);C(G,function(H){F[H]=function(){var J=D(arguments,0,true),I=[];C(this._items,function(M,L){M=this._item(L);var K=M[H].apply(M,J);if(K!==undefined&&K!==M){I.push(K);}},this);return I.length?I:this;};});}});E.ArrayList=B;},"3.1.1");YUI.add("arraylist-add",function(A){A.mix(A.ArrayList.prototype,{add:function(D,C){var B=this._items;if(A.Lang.isNumber(C)){B.splice(C,0,D);}else{B.push(D);}return this;},remove:function(D,C,E){E=E||this.itemsAreEqual;for(var B=this._items.length-1;B>=0;--B){if(E.call(this,D,this.item(B))){this._items.splice(B,1);if(!C){break;}}}return this;},itemsAreEqual:function(C,B){return C===B;}});},"3.1.1",{requires:["arraylist"]});YUI.add("arraylist-filter",function(A){A.mix(A.ArrayList.prototype,{filter:function(C){var B=[];A.Array.each(this._items,function(E,D){E=this.item(D);if(C(E)){B.push(E);}},this);return new this.constructor(B);}});},"3.1.1",{requires:["arraylist"]});YUI.add("array-invoke",function(A){A.Array.invoke=function(B,E){var D=A.Array(arguments,2,true),F=A.Lang.isFunction,C=[];A.Array.each(A.Array(B),function(H,G){if(F(H[E])){C[G]=H[E].apply(H,D);}});return C;};},"3.1.1");YUI.add("collection",function(A){},"3.1.1",{use:["array-extras","arraylist","arraylist-add","arraylist-filter","array-invoke"]});