
function show_form_connexion () {
	document.getElementById("header_connexion").innerHTML = "<form action='' method='post'>"+
		"<table style='border:1px solid silver;background:#EEE'>"+
			"<tr>"+
				"<td align='right'>Pseudo</td>"+
				"<td><input type='text' id='pseudo'/></td>"+
			"</tr>"+
			"<tr>"+
				"<td align='right'>MdP</td>"+
				"<td><input type='passwrd' id='mdp'/></td>"+
			"</tr>"+
			"<tr>"+
				"<td><a href='./index.php?PA=4'><small>&laquo; inscription</small></a></td>"+
				"<td align='right'><input type='button' id='bouton' value='Se connecter' onclick='xajax_connexion(document.getElementById(\"pseudo\").value, document.getElementById(\"mdp\").value);return false;'/></td>"+
			"</tr>"+
		"</table>"+
	"</form>" ;
}

function checkTexteSize(myfield) {
	if(myfield.inchange) return;
	myfield.inchange=true;
	if(myfield.value.length >= 140) {
		myfield.value = myfield.value.substring(0,140);
		document.getElementById('nb_caracteres').style.color="red";
	}
	else {
		document.getElementById('nb_caracteres').style.color="black";
	}
	document.getElementById('nb_caracteres').innerHTML = (140-myfield.value.length)+' caract&egrave;res restants.';
	myfield.inchange=false;
}

function checkClashAller() {
	if(document.getElementById('isUsername').value==0) {
		xajax_message_erreur('Pour lancer ce clash, renseignez un nom d\'utilisateur.');
		return false;
	}
	
	if((document.getElementById('testinput_xml').value=="")||(document.getElementById('clash_texte').value=="")) {
		xajax_message_erreur('Pour lancer ce clash, remplissez les champs (texte du clash et nom d\'utilisateur).');
		return false;
	}
	
	form_creer_clash.submit();
}

/* FONCTION POPUP */
function repositionne_elems(){
	//positionne div_foreground_content au milieu de l'écran (en hauteur)
	if (navigator.appName == 'Microsoft Internet Explorer')
	{
		//document.getElementById('result_ajax').style.top = document.documentElement.scrollTop+'px';
		document.getElementById('div_foreground_content').style.top =  screen.height/5 + document.documentElement.scrollTop+'px';
		document.getElementById('div_foreground').style.height = screen.height + document.documentElement.scrollTop+'px';
	}
	else
	{
		//document.getElementById('result_ajax').style.top = window.pageYOffset + 'px';
		document.getElementById('div_foreground_content').style.top = (window.innerHeight/4 + window.pageYOffset) + 'px';
		document.getElementById('div_foreground').style.height = (window.innerHeight+window.pageYOffset)+'px';
	}
}

function hidePopup(){
	var elem = document.getElementById('div_foreground');
	elem.style.display = 'none';
	cache_div_foreground_content();
}

function cache_div_foreground_content(){
	elem = document.getElementById('div_foreground_content');
	elem.style.display = 'none';
}
/* ! FONCTION POPUP ! */