var lastOpen = 0;
function showInfo(id){
    if(!document.getElementById) return;
    if(lastOpen != 0){ hideInfo(lastOpen); }
    document.getElementById('showInfo').style.display = '';
    document.getElementById('showInfo-'+ id).style.display = '';
    lastOpen = id;
}
function hideInfo(){
    if(!document.getElementById) return;
    document.getElementById('showInfo-'+ lastOpen).style.display = 'none';
    document.getElementById('showInfo').style.display = 'none';
    lastOpen = 0;
}


function showComment(id){
    document.getElementById('form-'+ id).nome.value = '';
    document.getElementById('form-'+ id).email.value = '';
    document.getElementById('form-'+ id).sito.value = 'http://';
    document.getElementById('form-'+ id).testo.value = '';
    document.getElementById('ins-'+ id).style.display = '';
}
function hideComment(id){
    document.getElementById('ins-'+ id).style.display = 'none';
}


function checkIns(id){
    if(document.getElementById('form-'+ id).nome.value == ''){
        window.alert('Attenzione! Non hai inserito il nome.');
        return false;
    }
    var email = document.getElementById('form-'+ id).email.value;
    var espressione = /^[_a-z0-9+-]+(\.[_a-z0-9+-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)+$/;
    if(email == ''){
        window.alert('Attenzione! Non hai inserito l’email.');
        return false;
    }
    if(!espressione.test(email)){
        window.alert('Attenzione! Email non valida.');
        return false;
    }
    if(document.getElementById('form-'+ id).testo.value == ''){
        window.alert('Attenzione! Non hai inserito il messaggio.');
        return false;
    }
    return true;
}

var lastOpenGame = 0;
function shInfoGame(id){
    if(!document.getElementById) return;
    if(lastOpenGame != 0){ document.getElementById('info-'+ lastOpenGame).style.display = 'none'; }
    if(lastOpenGame != id){ document.getElementById('info-'+ id).style.display = ''; lastOpenGame = id; }
    else { document.getElementById('info-'+ id).style.display = 'none'; lastOpenGame = 0; }
}