function openpopup(theURL) {
	window.open(theURL,'popup','toolbar=yes,location=yes,directories=no,status=no,menubar=yes,scrollbars=yes,resizable=yes,width=470,height=400');
	window.focus();	
}

function setCookie (name, value, expires, path, domain, secure) {
	document.cookie =	name + "=" + escape (value) + 
						((expires) ? "; expires=" + expires.toGMTString() : "") + 
						((path) ? "; path=" + path : "") + 
						((domain) ? "; domain=" + domain : "") + 
						((secure) ? "; secure" : "");
	}

function getCookieVal (offset) {
	var varEndString = document.cookie.indexOf (";", offset);
	if (varEndString == -1) {
		varEndString = document.cookie.length;
		}
	return unescape(document.cookie.substring(offset, varEndString));
	}

function getCookie (name) {
	var varName = name + "=";
	var varNameLength = varName.length;
	var varCookieLength = document.cookie.length;
	var i = 0;
	while (i < varCookieLength) {
		var j = i + varNameLength;
		if (document.cookie.substring(i, j) == varName) {
			return getCookieVal (j);
			}
		i = document.cookie.indexOf(" ", i) + 1;
		if (i == 0) {
			break;
			}
		}
	return null;
	}

function deleteCookie (name,path,domain) {
	if (getCookie (name)) {
		document.cookie =	name + "=" + 
							((path) ? "; path=" + path : "") + 
							((domain) ? "; domain=" + domain : "") + 
							"; expires=Thu, 01-Jan-70 00:00:01 GMT";
		}
	}
	
function QSHandler() {
	var qs = location.search.substr(1).split("&");
	this.data = [];
	for(var i = 0; i < qs.length; i++) this.data[qs[i].split("=")[0]] = qs[i].split("=")[1];
	this.QueryString = function(x) {
	return this.data[x];
	};
} 
var Request = new QSHandler();
