function replaceval(w, eq, key, val, newval) {
	var idx1, idx2, s1, s2, m, str;

	idx1 = w.s.indexOf(key + '=');

	if (idx1 >= 0) {
		idx2 = (w.s.indexOf('&',idx1+5) >= 0) ? w.s.indexOf('&',idx1+5) : w.s.length;

		m = w.s.substring(idx1+5, idx2);

		s1 = w.s.substring(0, idx1);
		s2 = w.s.substring(idx2);
	} else {
		idx = w.s.length;
		m = '';
		s1 = w.s;
		s2 = '';
	}

	if ((eq && m == val) || (!eq && m != val)) {
		str = w.p + '?' + s1;

		if (s1 != '' && s1.charAt(s1.length-1) != '&') {
			str += '&';
		}

		str += key + '=' + newval + s2;

		w.location.href = str;
	}
}


