
GamerEnv.prototype = new GamerConfig();
GamerEnv.prototype.constructor = GamerEnv;
GamerEnv.prototype.baseClass = GamerConfig.prototype.constructor;
/// inherit methods
GamerEnv.prototype.getNameSuffix = GamerConfig.prototype.getNameSuffix;

function GamerEnv () {

	/// member params
	//// inherits this.sNameSuffix 
	this.bAcceptsCookies = false;
	this.iUserVersion = 0;
	this.aUrlParams = new Array();
	this.aBrowserCats = new Array();


	/// methods
	this.getBrowseCategories = function () {
		return this.aBrowserCats;
	}
	this.getBrowseVersion = function () {
		return this.iUserVersion;
	}

	this.getUrlParams = function () {
		return this.aUrlParams;
	}

	// This next little bit of code tests whether the user accepts cookies.
	this.getAcceptsCookies = function () {
		return this.bAcceptsCookies;
	}


	///// constructor actions

	/// cookies available
	if(document.cookie == '') {
		document.cookie = 'WM_acceptsCookies=yes'; // Try to set a cookie.
		if(document.cookie.indexOf('WM_acceptsCookies=yes') != -1) {
			this.bAcceptsCookies = true; 
		}
	} else {
		this.bAcceptsCookies  = true;
	}
	
	/// browser categories
	var b = navigator.appName
	if (b=="Netscape") {
		this.b = "ns"
	} else if ( b.toLowerCase().indexOf( "explorer" ) != -1 ) {
		this.b = "ie"
	} else {
		aBrowserCats.b = b
	}
	this.version = navigator.appVersion
	this.v = parseInt(this.version);
	this.aBrowserCats["v"] = this.v;
	this.aBrowserCats["ns"] = (this.b=="ns" && this.v>=4)
	this.aBrowserCats["ns4"] = (this.b=="ns" && this.v==4)
	this.aBrowserCats["ns5"] = (this.b=="ns" && this.v==5)
	this.aBrowserCats["ns6"] = (this.b=="ns" && this.v==6)
	this.aBrowserCats["ie"] = (this.b=="ie" && this.v>=4)
	this.aBrowserCats["ie4"] = (this.version.indexOf('MSIE 4')>0)
	this.aBrowserCats["ie5"] = (this.version.indexOf('MSIE 5')>0)
	this.aBrowserCats["ie6"] = (this.version.indexOf('MSIE 6')>0)
	this.aBrowserCats["min"] = (this.ns||this.ie)
	/// browser version
	if (navigator.appVersion.indexOf("MSIE")!=-1){
		var temp=navigator.appVersion.split("MSIE");
		this.iUserVersion = parseFloat(temp[1]);
	}
	else 
	{
		this.iUserVersion = 0;
	}

	//// url params
	var querystring = location.search;
	var qs = querystring.substring(1);
	var nv = qs.split('&');	
	for(i = 0; i < nv.length; i++)
	{
		eq = nv[i].indexOf('=');
//		this.aUrlParams[i] = new Array(nv[i].substring(0,eq).toLowerCase(),unescape(nv[i].substring(eq + 1)));
		this.aUrlParams[nv[i].substring(0,eq).toLowerCase()] = unescape(nv[i].substring(eq + 1));
	}
}

var gamerEnv = new GamerEnv();
