function Receiver() {
	this.location = ""+location;
	this.hasQuery = (this.location.indexOf("?") > -1)? true : false;
	this.query = location.search.substring(1,location.search.length);
	if(this.hasQuery)
		this.url = this.location.substring(0,this.location.indexOf("?"));
	else
		this.url = this.location;
	this.paramCnt = this.countParams();
	this.getParams();
	//alert(this.paramCnt)
}
Receiver.prototype.countParams = function(){
	var buf = this.query;
	var newL = paramCnt = 0;
	while(1==1){
		first = buf.indexOf("=");
		if(first > -1)
			buf = buf.substring(first+1,buf.length);
		//debug(buf)
		if(newL == buf.length) break;
		paramCnt++;
		newL = buf.length;	
	}
	//debug(".countParams: "+paramCnt);
	return paramCnt;
}

Receiver.prototype.getParams = function(){
	var buf = this.query;
	var newL = 0;
	while(1==1){
		first = buf.indexOf("=");
		if(first > -1){
			this.params = true;
			endValue = buf.indexOf("&");
			if(endValue == -1)
				endValue = buf.length;
			val = unescape(buf.substring(first+1,endValue).replaceAll("+"," "));

			param = buf.substring(0,first);
			if(this[param]){
				if(typeof this[param] == "object"){
					this[param][this[param].length] = val;
					window[param][window[param].length] = val;
				}
				else{
					buf2 = this[param];
					this[param] = new Array();
					this[param][0] = buf2;
					this[param][1] = val;
					window[param] = new Array();
					window[param][0] = buf2;
					window[param][1] = val;
				}
			}
			else {
				this[param] = val;
				window[param] = val;
			}

			buf = buf.substring(endValue+1,buf.length);
		}
		if(newL == buf.length) break;
		newL = buf.length;	
	}
}
Receiver.prototype.getValueOf = function(paramname){
	if(!this[paramname]) return "";
	return this[paramname];
}
/*
Receiver.prototype.setValueOf = function(paramname){
	if(this[paramname])
		this[paramname] = ;
}
*/
String.prototype.replaceAll = function(what,to){
	var s = this;
	var buf = "";
	do{
		if(s.indexOf(what)!=-1){
			buf += s.substring(0,s.indexOf(what))+to;
			s = s.substring(s.indexOf(what)+what.length,s.length);
		}
	}
	while(s.indexOf(what)!=-1);
	buf += s;
	return buf;
}

function replaceEntities(str) {
	
	var entities	= new Array("&uuml;",	"&auml;",	"&ouml;",	"&Uuml;",	"&Auml;",	"&Ouml;",	"&szlig;",	"&nbsp;");
	var chars		= new Array("ü",		"ä",		"ö",		"Ü",		"Ä",		"Ö",		"ß",		" ");
	for(var i=0; i<entities.length; i++){//alert((str.indexOf(entities[i]) != -1)? entities[i]+" kommt vor\n" : entities[i]+" kommt NICHT vor\n")
		if(str.indexOf(entities[i]) != -1)
			str = str.replaceAll( entities[i], chars[i] )
	}
	return str;
}
