function CombinationGenerator(n,r){this.numLeft;this.n=n;this.r=r;this.a=new Array();this.total=combinations(this.n,this.r);this.numLeft=this.total;for(var i=0;i<this.r;i++){this.a[i]=i;}if(typeof(_person_prototype_called)=='undefined'){_person_prototype_called=true;CombinationGenerator.prototype.getNext=_getNext;CombinationGenerator.prototype.hasMore=_hasMore;CombinationGenerator.prototype.getTotal=_getTotal;}function _hasMore(){return this.numLeft>0;}function _getTotal(){return this.total;}function _getNext(){if(this.numLeft==this.total){this.numLeft=this.numLeft-1;return this.a;}var i=this.r-1;while(this.a[i]==this.n-this.r+i){i--;}this.a[i]=this.a[i]+1;for(var j=i+1;j<this.r;j++){this.a[j]=this.a[i]+j-i;}this.numLeft=this.numLeft-1;return this.a;}}