var curLang = null;
function detectLang(languages)
{
	if(navigator.language)	// FF, Chrome, Opéra, Safari, BlackBerry
	{
		for(var i = 0; i < languages.length; i++) { if(navigator.language.indexOf(languages[i]) == 0) { curLang = languages[i]; break; } }
	}
	else if(navigator.browserLanguage)	// IE
	{
		for(var i = 0; i < languages.length; i++) { if(navigator.browserLanguage.indexOf(languages[i]) == 0) { curLang = languages[i]; break; } }
	}
}

function detecFlash(major, minor, revision) 
{
	var hasRequestedVersion;
	if(arguments.length == 3) hasRequestedVersion =  DetectFlashVer(major, minor, revision);
	else hasRequestedVersion =  DetectFlashVer(9, 0, 124);
	
	if ((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/BlackBerry/i))) 
	{
		if(curLang) window.location.href = "mobile/" + curLang + "/index.html";
		else window.location.href = "mobile/fr/index.html";
	}
	else if (hasRequestedVersion) { window.location.href = "beevirtua/beevirtua.html"; }
	else if (!hasRequestedVersion)
	{
		var s = screen;
		if (s.width <= 480 && s.height <= 320 || s.width <= 320 && s.height <= 480) 
		{
			if(curLang) window.location.href = "mobile/" + curLang + "/index.html";
			else window.location.href = "mobile/fr/index.html";
		}
		else {
			if(curLang) window.location.href = "html/" + curLang + "/index.html";
			else window.location.href = "html/fr/index.html";
		}
	}
}

