﻿// File JScript
function LogOut() {
    var conf = confirm('Sei sicuro di voler procedere con l\'uscita dall\'applicazione?');
    if (conf) {
        window.top.location.href = 'LogOut.aspx';
    }
}

function CambiaEdizione(Anno) {
    var AnnoCorrente = document.getElementById('AnnoCorrente');
    if (AnnoCorrente) {
        AnnoCorrente.value = Anno;
    }
    document.forms[0].submit();
}

function AvviaRicerca() {
    
    var Search = document.getElementById('CMRicerca');
    
    if (Search.value == '')
    {
        alert('Inserire una parola di ricerca');
        return false;
    }
    
    document.location.href = 'Ricerca.aspx?Search=' + Search.value;
}

function OnKeyPressCMRicerca(e)
{
    var keynum;
    if(window.event) // IE
    {
       keynum = e.keyCode;
    }
    else if(e.which) // Netscape/Firefox/Opera
    {
       keynum = e.which;
    }
    
    if (keynum == 13)
    {
        if(window.event) // IE
        {
           e.keyCode = 0;
        }
        else if(e.which) // Netscape/Firefox/Opera
        {
           e.which = 0;
        }
        AvviaRicerca();
    }   
}
