function login() {

	if(document.getElementById('errorLogin') != null)
		document.getElementById('errorLogin').innerHTML = "&nbsp;";	

	var page = "login.php";
	var data = "action=in";
	
	data += "&login="+GetElementById("log_login").value;
	data += "&code="+GetElementById("log_code").value;
	data += "&game="+GetElementById("log_game").value;
	
	if (window.ActiveXObject)
	{
		//Internet Explorer
		var XhrObj = new ActiveXObject("Microsoft.XMLHTTP");
	}
	else
	{
		var XhrObj = new XMLHttpRequest();
	}

	//Ouverture du fichier en methode POST
	XhrObj.open("POST", page);
	
	//Ok pour la page cible
	XhrObj.onreadystatechange = function()
	{
		if (XhrObj.readyState == 4 && XhrObj.status == 200)
		{
			var response = XhrObj.responseText;			
			if(response!="") {
				window.location.replace('http://dedimania.com/SITE/log.php');
			} else {
				if(document.getElementById('errorLogin') != null)
					document.getElementById('errorLogin').innerHTML = "<font color='#f00'><b>Error in Login or Community Code</b></font>";
			}
		}
	}
	XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded');;
	XhrObj.send(data);
}

function logout() {
	var page = "login.php";
	var data = "action=out";
	
	if (window.ActiveXObject)
	{
		//Internet Explorer
		var XhrObj = new ActiveXObject("Microsoft.XMLHTTP");
	}
	else
	{
		var XhrObj = new XMLHttpRequest();
	}

	//Ouverture du fichier en methode POST
	XhrObj.open("POST", page);
	
	//Ok pour la page cible
	XhrObj.onreadystatechange = function()
	{
		if (XhrObj.readyState == 4 && XhrObj.status == 200)
		{
			window.location.replace('http://dedimania.com/SITE/log.php');
		}
	}
	XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded');;
	XhrObj.send(data);
}



function loginout() {
	var content = GetElementById("menu5").innerHTML;

	if(content.search('Logout') != -1) {
		content = "<b>Login</b>";
		logout();
	} else {
		window.location.replace('http://dedimania.com/SITE/log.php');
	}
}