function rubklass() {
	function rub(a,b,c,d,e,f) { 

 		function ext(a,b,c,d,e,f) {
			this.datum=a;
  			this.tidning=b;
			this.rubrik=c;
			this.beskrivning=d;
  			this.url=e; 
			this.soundex=f;
  			return this;
 		}

		function addextra(a,b,c,d,e,f) {
   			this.extra.push(new ext(a,b,c,d,e,f));
  		}

 	 	this.datum=a;
		this.tidning=b;
  		this.rubrik=c;
		this.beskrivning=d;
		this.url=e;
		this.soundex=f;
		this.extra=new Array();
		this.addextra=addextra;
  		return this;
 	}  

 	function rsort() {
		this.rubriker.sort(datesort);
	}
	function rexport() {
		return this.rubriker;
	}
	function addrub(a,b,c,d,e,f,g) {
  		exist=0;
		for (i=0;i<this.rubriker.length;i++) {
   			if (this.rubriker[i].soundex==f) {
   				this.rubriker[i].addextra(a,b,c,d,e,f);
    				exist=1;
    				break;
   			}
  		}
  		if(exist==0) {
   			this.rubriker.push(new rub(a,b,c,d,e,f));
  		}
 	}

 	this.rubriker=new Array();
 	this.addrub=addrub;
	this.rsort=rsort;
	this.rexport=rexport;
	return this;
}

function datesort(r1,r2) {
if (r1.datum>r2.datum) retVal=-1;
else if (r1.datum<r2.datum) retVal=1;
else retVal=0;
return retVal;
}

