
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($('#testinput_xml').val() == '') {
        //xajax_message_erreur("Pour lancer ce clash, renseignez un nom d'utilisateur.");
        alert("Pour lancer ce clash, renseignez un nom d'utilisateur.");
        return false;
    }
    if(($('#testinput_xml').val() == "")||($('#clash_texte').val() == "")) {
        alert("Pour lancer ce clash, remplissez les champs (texte du clash et nom d'utilisateur).");
        //xajax_message_erreur("Pour lancer ce clash, remplissez les champs (texte du clash et nom d'utilisateur).");
        return false;
    }
    return true;
}

$(function() {            
    $("#clash_texte").keyup(function() {
        checkTexteSize(this);
    }).mouseup(function() {
        checkTexteSize(this);
    });
});
