function C(){
	return CookieTest();
}
function CookieTest(){

	// Check if cookie exists
	if (document.cookie.length !== 0){
		return true;
	}
	else{

		varCookie = 'bet365=1;expires= Thu, 01-Jan-2010 00:00:01 GMT';
		varCookie = varCookie + ';path=/';

		//document.cookie = varCookie;

		if (document.cookie.length === 0){
			window.location="default.asp?cookies=false";
		}
		else{
			var exp = new Date(0);

			// Delete cookie
			document.cookie = 'bet365=0;expires= ' + exp.toGMTString();
			return true;
		}
	}
}

function GetCookie(name, attribute){
	var aCookies = document.cookie.split(';');
	var strCookie;
	var aCookieElements;
	for(i=0;i<aCookies.length;i++) {
//
// The crunching code has problems with the following line - it mashes /^ +/ to /^+/ - simply fix by hand in the crunched version.
//
		aCookies[i]=aCookies[i].replace(/^ +/,'').replace(/ +$/,'');
		if(name==aCookies[i].split('=')[0]){
			strCookie=aCookies[i].substring((aCookies[i].indexOf('=') + 1),aCookies[i].length);
			aCookieElements=strCookie.split('&');
			for(j=0;j<aCookieElements.length;j++){
				if(attribute==aCookieElements[j].split('=')[0]){
					return unescape(aCookieElements[j].split('=')[1]);
				}
			}
		}
	}
	return null;
}

function SetCookie(name, attribute, value){
	var aCookies = document.cookie.split(';');
	var strCookie;
	var aCookieElements=new Array();
	var bFound=false;
	for(i=0;i<aCookies.length;i++) {
//
// The crunching code has problems with the following line - it mashes /^ +/ to /^+/ - simply fix by hand in the crunched version.
//
		aCookies[i]=aCookies[i].replace(/^ +/,'').replace(/ +$/,'');
		if(name==aCookies[i].split('=')[0]){
			strCookie=aCookies[i].substring((aCookies[i].indexOf('=') + 1),aCookies[i].length);
			aCookieElements=strCookie.split('&');
			for(j=0;j<aCookieElements.length;j++){
				if(attribute==aCookieElements[j].split('=')[0]){
					aCookieElements[j]=attribute+'='+escape(value).replace(/\+/g,'%2b');
					bFound=true;
				}
			}
		}
	}
	if(!bFound){
		aCookieElements.length++;
		aCookieElements[aCookieElements.length - 1]=attribute+'='+escape(value).replace(/\+/g,'%2b');
	}
	document.cookie=name+'=; expires=Thu, 01-Jan-70 00:00:01 GMT;path=/';
	document.cookie=name+'='+aCookieElements.join('&')+';path=/';
}

function Replace(string, text, by) {
	var newstr;	
	if (string === null){
		newstr = by;
	}
	else{
		var strLength = string.length;
		var txtLength = text.length;

		if ((strLength === 0) || (txtLength === 0)) {return string;}

		var i = string.indexOf(text);

		if ((!i) && (text != string.substring(0, txtLength))) {return string;}

		if (i == -1) {return string;}

		newstr = string.substring(0,i) + by;

		if (i+txtLength < strLength)	{newstr += Replace(string.substring(i+txtLength,strLength),text,by);}
	}		
	return newstr;

}

