$(document).ready(function()
{

    if($.trim($('#system_message_data').html()) != ''){
        $.blockUI({
            message: $('#system_message'),
            css: {
                border: 'none',
                padding: '15px',
                color: 'none',
                backgroundColor: 'none',
                left : '27%',
                top: '15%'
            },
            overlayCss:{
                backgroundColor: '#4c4c4c',
                opacity:0.6
            }
        });
        setTimeout($.unblockUI, 5000);
    }
/*Function for confrimation popovers*/

    $('a.confirm_pp').live('click',function(){
        $('#confirm_message_title').html($(this).attr('title'));
        $('#confirm_message_data').html($(this).attr('data'));
        $('#confirm_message_link').attr('href',$(this).attr('href'));
        $.blockUI({
            message: $('#confirm_message'),
            css: {
                border: 'none',
                padding: '15px',
                color: 'none',
                backgroundColor: 'none',
                left : '30%',
                top: '5%'
            },
            overlayCss:{
                backgroundColor: '#4c4c4c',
                opacity:0.6
            }
        });
        return false;
    });


    $('.close_confirm').live('click',function(){
        $.unblockUI({

            onUnblock: function(){
                $('#confirm_message_title').html('');
                $('#confirm_message_data').html('');
                $('#confirm_message_link').html('');

            }
        });
    });

    /*********************************************************************************/
        $("a.popover").fancybox({
            'overlayShow'	:	true
        });


        $("a.close_popover").live('click',function(){
		$('form').validationEngine('hideAll');
        $.fancybox.close();
		   
        });
		
		$("a.return_popover").live('click',function(){
           $.fancybox.close();
		   
		   $(this).fancybox({
				'overlayShow'	:	true
			});
        });
});

