function showAlert (alertDiv)
{
    var div = EL (alertDiv);
    var pos = getDocumentScroll();

    div.style.display = 'block';
    div.style.top     = (pos.y + 100) + "px";

    toggleCurtain();

    return false;
}


function hideMessages (alertDiv)
{
    var div = EL (alertDiv);
        
    div.style.display = 'none';
}


function setCookie (article1, quantity1, article2, quantity2)
{
    var value = article1 + '_' + quantity1;
    if ( article2 )
    {
        value += article2 + '_' + quantity2;
    }

    document.cookie = "basket=" + escape(value) + ";path=/;expires=" + new Date("January 1, 3000").toGMTString();
    showAlert ('basketSaved');
}


function submitLieuForm()
{
    var form             = EL ('lieuForm');
    var postalCodeField  = EL ('postalCodeField');
    var cityField        = EL ('cityField');
    
    if ( postalCodeField.value.length <= 0 && cityField.value.length <= 0 )
    {
        showAlert ('fitterSearch');
        return false;
    }
    
    form.submit();
    
    return true;
}


function checkKey (e)
{
    if (curtainVisible)
    {
        return;
    }

    var touche;
    
    if(window.event) // IE
    {
        touche = e.keyCode;
    }
    else if(e.which) // Netscape/Firefox/Opera
    {
        touche = e.which;
    }
    

    if (touche == 13)
    {
        if (!submitLieuForm())
        {
            EL ('fitterSearch').focus();
        }
    }
}


    