/**
 * JavaScript scripts set for CMS
 *
 * @copyright Copyright (c) 2009, inaction.lt
 * @author    Benas Valančius <benas@inaction.lt>
 * @package   Framework
 *
 * $Id: public.js 453 2009-05-15 17:36:21Z noen $
 */

/**
 * Close message
 *
 * @param object obj
 */
function closeMessage(e)
{
    $(e.parentNode.parentNode).animate({
        height:0,
        opacity:0,
        paddingTop:0,
        marginTop:0,
        paddingBottom:0,
        marginBottom:0
    }, 1000);
    $(e.parentNode.parentNode).queue(function(){
        $(this).hide();
        $(this).dequeue();
    });
}

function getMessage(msg, type)
{
    switch(type)
    {
        case 'notice':
            return '<div class="notice">'+ msg +'</div>';
            break;
        case 'ok':
            return '<div class="ok"><div class="fr"><a href="#" onclick="closeMessage(this);return false;">'+ _('close') +'</a></div>'+ msg +'</div>';
            break;
        case 'info':
            return '<div class="info">'+ msg +'</div>';
            break;
        case 'error':
        default:
            return '<div class="error"><div class="fr"><a href="#" onclick="closeMessage(this);return false;">'+ _('close') +'</a></div>'+ msg +'</div>';
    }
}

var project = {
    menuActivate : function()
    {
        $('.menuItem').mouseover(function(){
            this.className = (this.className.indexOf('active') >= 0 ? 'menuItem active hover' : 'menuItem hover');
            $(this).find('ul').show();
        });
        $('.menuItem').mouseout(function(){
            this.className = (this.className.indexOf('active') >= 0 ? 'menuItem active' : 'menuItem');
            $(this).find('ul').hide();
        });
    }
};
