function GetCountry() {
	var country = "UK";
	var url = document.location.toString();

	var genericArray = new Array(
		/^https?:\/\/(.{2})\./, /toshiba-(.{2})\./, /toshibacsg-(.{2})\./,
		/comp(.{2})\.stage/
	);

	for (i = 0; i < genericArray.length; i++) {
		var results = genericArray[i].exec(url);
		if (results != null && results.length == 2)
			return results[1].toUpperCase();
	}

	var testArray = new Array(
		new Array("ae", /^https?:\/\/gulf\./, /compgulf\.stage/)
	);

	for (i=0; i<testArray.length; i++) {
		for (j=1; j<testArray[i].length; j++) {
			if (testArray[i][j].exec(url) != null)
				return testArray[i][0].toUpperCase();
		}
	}

	return country.toUpperCase();
}

function GetCountryList() {
	var country = GetCountry();
	
	var testArray = new Array(
		new Array("ch", new Array("CH-DE", "CH-FR")),
		new Array("be", new Array("BE-NL", "BE-FR"))
	);
	
	for (i = 0; i < testArray.length; i++) {
		if (country == testArray[i][0].toUpperCase())
			return testArray[i][1];
	}
	
	return new Array(country);
}

function Get_Cookie(name) {
    var start = document.cookie.indexOf(name+"=");
    var len = start+name.length+1;
    if ((!start) && (name != document.cookie.substring(0,name.length))) return null;
    if (start == -1) return null;
    var end = document.cookie.indexOf(";",len);
    if (end == -1) end = document.cookie.length;
    return unescape(document.cookie.substring(len,end));
}

function Set_Cookie(name,value,expires,path,domain,secure) {
    document.cookie = name + "=" +escape(value) +
        ( (expires) ? ";expires=" + expires.toGMTString() : "") +
        ( (path) ? ";path=" + path : "") + 
        ( (domain) ? ";domain=" + domain : "") +
        ( (secure) ? ";secure" : "");
}

function Delete_Cookie(name,path,domain) {
    if (Get_Cookie(name)) document.cookie = name + "=" +
       ( (path) ? ";path=" + path : "") +
       ( (domain) ? ";domain=" + domain : "") +
       ";expires=Thu, 01-Jan-70 00:00:01 GMT";
}


function isCookieEnabled() {
	Set_Cookie('temp','temp');
	var temp = Get_Cookie('temp');
	if (!temp) {      
		return false;
	}
	else {
		return true;
	}
}

function isOutdatedBrowser() {
	var agent = navigator.userAgent.toLowerCase();
	
	var isOpera = (agent.indexOf("opera") != -1);
	var isGecko = (!isOpera) && (agent.indexOf("gecko/") != -1);
	var isNS = (!isOpera && !isGecko) && ((agent.indexOf("mozilla") != -1) && (agent.indexOf("spoofer") == -1) && (agent.indexOf("compatible") == -1));
	
	if (isNS && (parseFloat(navigator.appVersion) < 5))
		return true;
	else
		return false;
}


