
/**
 * JavaScript scripts set for CMS
 *
 * @copyright Copyright (c) 2011, ecto.lt
 * @author    Benas Valančius <benas@ecto.lt>
 * @package   Framework
 *
 * $Id: public.js 2961 2011-09-15 13:13:55Z noen $
 */

$().ready(function(){
    dpp = new iPopup('ax_su_pop', 'dpp');
    apopup  = new iPopup('ax_su_adm', 'apopup ');
});

/**
 * 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>';
    }
}

function getPrint(url)
{
	var topVal  = Math.ceil((screen.height - 620) / 2);
	var leftVal = Math.ceil((screen.width  - 600) / 2);

    window.open(url + window.location.hash,'WinName','width=600,height=620,scrollbars=yes,left='+leftVal+',top='+topVal);
}
