//
// Anonym login.
//
function AnonymLogin()
{
    var f = document.forms['FormAnonymLogin'];
    var catId = f.catId.value;
    var pwd = f.pwd.value;
    
    // Case error - blank pwd.
    if ((pwd == '') || (pwd == jsld["password"]))
    {
        $('#AnonymMsg').html(jsld["this field cannot be blank"]);
        $('#AnonymMsg').show();
        return false;
    }
    
    else
    {
        Hide('AnonymBtn');
        ShowInline('AnonymIconServer');
        
        $.ajax(
        {
            type: "GET",
            dataType: "script",
            url: 'http://isether.com/ips/mod/site/ajax.php',
            data: 'action=LoginAnonym&catId='+catId+'&pwd='+pwd+'&sid='+siteId,
            
            success: function(msg)
            {
                msg;
            },
            
            error: function (XMLHttpRequest, textStatus, errorThrown) 
            {
                alert('ajax failed');
            }

        });
        
        return false;
    }
}

function FinishAnonymLogin(catId)
{
    //
    // Case login succeeded - go to page
    // in edit mode.
    //
    if (catId != 0)
    {
        /*var f = document.forms['FormAnonymLogin'];
        f.submit();*/
        editUrl = AppendUrl(JS_MODULE_WLIB_CATEGORY+'?'+catId);
        location.href = editUrl;
    }
    
    //
    // Case login failed.
    //
    else
    {
        ShowInline('AnonymBtn');
        Hide('AnonymIconServer');

        $('#AnonymMsg').html(jsld["wrong email or password"]);
        $('#AnonymMsg').show();
        return false;
    }
}

//
// Toggle forum message text in the
// 'new forum messages' module, at the
// home page.
//
// Though short, it is implemneted as
// a function, since the $ sign does
// not work in a link, at FF.
//
function ToggleForumMsg(msgId)
{     
    $('#fm' + msgId).toggle();
}