// expode and parseQuery are functions to deal with query string
function explode(item,delimiter) {
	tempArray=new Array(1);
	var Count=0;
	var tempString=new String(item);
	while (tempString.indexOf(delimiter)>0) {
		tempArray[Count]=tempString.substr(0,tempString.indexOf(delimiter));
		tempString=tempString.substr(tempString.indexOf(delimiter)+1,tempString.length-tempString.indexOf(delimiter)+1);
		Count=Count+1
	}
	tempArray[Count]=tempString;
	return tempArray;
}
function parseQuery() {
	var returnVals = new Array();
	var qString = new String(window.location);
	var queryStart = qString.indexOf('?');
	if (queryStart==-1) {
		return returnVals;
	}
	var query = qString.substring(queryStart + 1, qString.length);
	parts = explode(query, "&");
	for (i in parts) {
		bits = explode(parts[i], "=");
		returnVals[bits[0].toLowerCase()] = bits[1]; // query[] indexes are now lowercase!
	}
	return returnVals;
}

var query = parseQuery();