$(document).ready(function() {
   // do stuff when DOM is ready
   $(".date-field").datePicker().val(new Date().asString()).trigger('change');
   render_buttons();
});

function render_buttons() {
    $('.btn').each(function() {
        var b = $(this);
        var tt = b.text() || b.val();
        if ($(this).is(':input')) {
            b = $('<a>').insertAfter(this).addClass(this.className).attr('id',this.id);
            $(b).click(function(){
                $(this).parents('form').submit();
            });
            $(this).remove();
        }
        b.text('').css({cursor:'pointer'}).append($('<span>').text(tt).append('</span>'));
    });
}

function add_notification(message) {
    if($('.messages').length > 0) {
        $('.messages').append('<li><span>' + message + '</span></li>');
    }
    else {
        $('#bd').before('<ul class="messages"><li><span>' + message + '</span></li></ul>');
    }
};

function blockuimessage_css() {
    css = {
        top:  ($(window).height() - 500) /2 + 'px', 
        left: ($(window).width() - 500) /2 + 'px', 
        border: 'none',
        textAlign: 'left',
        padding: '0px 15px 15px 15px', 
        backgroundColor: '#000', 
        '-webkit-border-radius': '10px', 
        '-moz-border-radius': '10px', 
        opacity: .8, 
        color: '#fff'
    }
    return css
}

function blockuiform_css() {
    css = {
        top:  ($(window).height() - 500) /2 + 'px', 
        left: ($(window).width() - 500) /2 + 'px', 
        border: 'none', 
        textAlign: 'left',
        width: '460px',
        padding: '0px 15px 15px 15px', 
        backgroundColor: '#000', 
        '-webkit-border-radius': '10px', 
        '-moz-border-radius': '10px', 
        opacity: .9, 
        color: '#fff'
    }
    return css
}