/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
=* Bibliotek för användning av *=*=
=*=*=*=*=* frågesträngar *=*=*=*=*=
=*=*=*=* Skrivet av spango *=*=*=*=
=*=*=* <gustaf-c@dsv.su.se> =*=*=*=
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
function QueryString(){
	this.values = {};
	this.queryString = "";
	if(arguments.length == 0)
		this.queryString = location.search?location.search:"";
	else // hade argument
		this.queryString = arguments[0];
	if(this.queryString.indexOf("?") == 0)
		this.queryString = this.queryString.substring(1);
	var pairs = this.queryString.split("&");
	for(var i in pairs){
		pairs[ i] = pairs[ i].split("=");
		for(var j in pairs[ i]) // avkoda URL
			pairs[ i][j] = unescapePlus(pairs[ i][j]);
		var key = pairs[ i][0];
		var value = pairs[ i][1];
		if(this.values[key]){ // finns redan
			if( (typeof this.values[key]) == (typeof []) ){ // fler finns redan
				this.values[key] = this.values[key].push(value); // appendera
			} /* if array */ else if( (typeof this.values[key]) == (typeof "string")){
				this.values[key] = [this.values[key], value]; // skapa ny array
			} else this.values[key] = value;
		} else { // finns inte
			this.values[key] = value;
		} // if this.values[key]
	} // for pairs
} // function QueryString

function qsGet(key){
	var alt ="";
	if(arguments.length == 2)
		alt = arguments[1];
	return this.values[key]? this.values[key] : alt;
}

function qsToString(){
	return this.queryString;
}
QueryString.prototype.get      = qsGet;
QueryString.prototype.toString = qsToString;

function unescapePlus(str){ // unescape med plustecken
	str = globalReplace(str, "+", " ");
	return unescape(str);
}

// I Opera 5 funkar inte String.replace av någon konstig
// anledning, så vi får lov att använda en egen funktion.
function globalReplace(str, what, withWhat){ 
	var tmp = "";
	while(str.length != 0)
		if(str.indexOf(what) == 0){
			tmp += withWhat;
			str = str.substring(what.length);
		} else {
			tmp += str.charAt(0);
			str = str.substring(1);
		}//else
	return tmp;
}//globalReplace

var page = new QueryString().get("page");

if (page.length > 0){
    window.frames["iframe2"].location.href = page;
}