function setLanguageCookie(language) {
	var days = 90;
	var today = new Date();
	var defaultExpire = new Date();
	defaultExpire.setTime(today.getTime() + 1000*60*60*24*days);
	
	cLang = getCookie("CheltenhamLang");
	if ((cLang==null)||(cLang=='')) {
	cLang = 1;
	}
	setCookie("CheltenhamLang", language, defaultExpire, null, null, null);
}

function setLanguageDropDown(s, l) {
	var url = location.href;
	var h = location.hostname;
	var u = "http://www";
	var v = parseFloat(l.value);
	
	// Fix for USHR to stop alert on change language
	if ((url.indexOf("usracing") > -1) && (url.indexOf("coupon.jsp") > -1)) {
		setConfirmChange();
	}
	
	if ((h.indexOf("test") > -1) || (h == "localhost") || (h == "172.17.0.1")) {
		u = "http://test";
	} else if (h.indexOf("dev") > -1) {
		u = "http://dev";
	}
	
	switch(v) {		
		case 4:
			if (s == '100') {
				location.href = u + '.vcbet.gr?lang=' + v;
			} else {
				setLanguageCookie(v);
				langFunc(document.location.href);
			}
			break;
		case 22:
			location.href = u + '.vcbet.ie';
			break;
		case 25:
			if (s == '100') {
				location.href = u + '.vbahis.com?lang=' + v;
			} else {
				setLanguageCookie(v);
				langFunc(document.location.href);
			}
			break;
		case 15:
			if ((s == '100') && (location.href.indexOf("vcstavka.com") == -1)) {
				location.href = u + '.vcstavka.com?lang=' + v;
			} else {
				setLanguageCookie(v);
				langFunc(document.location.href);
			}
			break;
		case 26:
			if ((s == '100') && (location.href.indexOf("vcapuestas.com.ar") == -1)) {
				location.href = u + '.vcapuestas.com.ar?lang=' + v;
			} else {
				setLanguageCookie(v);
				langFunc(document.location.href);
			}
			break;
		case 0:	// For .ie, 1 = Irish, and 0 = English to redirect back to .com
			location.href = u + '.vcbet.com';
			break;
		default:
			setLanguageCookie(v);
			langFunc(document.location.href);
			break;
	}
	l.disabled = true;
}