var project = {};

project.alert = function(message, msgTitle, msgButton)
{
    var ranId = 'dialog_'+ project.randomCode(16);

    $('<div id="'+ ranId +'" title="'+ (msgTitle !== undefined ? msgTitle : 'Pranešimas') +'"><div class="confirmContent">'+ message +'</div></div>').dialog({
        width : 350,
        template : {
            classTitle : 'redNotice'
        },
        buttons : [
            {
                title : (msgButton !== undefined ? msgButton : 'Gerai'),
                action : function()
                {
                    $('#'+ ranId).dialog('remove');
                    return false;
                },
                template : {
                    className : 'icon_ok'
                }
            }
        ]
    });
    $('#'+ ranId).dialog('open');
    $('#'+ ranId +' .icon_ok').focus();
    return ranId;
};

project.randomCode = function(length)
{
    var chars = 'abcdefghijklmnopqrstuvwxyz';
    var code = '';
    for(x = 0; x < length; x++)
    {
        i = Math.floor(Math.random() * chars.length);
        code += chars.charAt(i);
    }
    return code;
};

project.openWindow = function(mypage, w, h, myname)
{
    var winl = (screen.width-w)/2;
    var wint = (screen.height-h)/2;
    var settings = 'height=' + h + ',width=' + w + ',top=' + wint + ',left=' + winl + ',scrollbars=no,toolbar=no';
    win = window.open(mypage, myname, settings);
    if(parseInt(navigator.appVersion) >= 4)
    {
        win.window.focus();
    }
}

