var fixSortablePersonal = function(){
		if(!$.browser.msie) return;
		$('#personalisation_bar').SortableDestroy();
        $('#personalisation_bar').Sortable(
            {
                accept: 'personalisation_list',
                helperclass: 'sortHelper',
                activeclass : 'sortableactive',
                hoverclass : 'sortablehover',
                handle: 'div.makui_edit',
                tolerance: 'pointer',
                onStart : function(){
                    $.iAutoscroller.start(this, document.getElementsByTagName('body'));
                },
                onStop : function(){
                    serial = $.SortSerialize('personalisation_bar');
                    $.ajax({url: '/lavina/users/personal_move?'+serial.hash});
                    $.iAutoscroller.stop();
                    fixSortablePersonal();
                }
            }
        );
	}
var fixSortable = function(){
		if(!$.browser.msie) return;
		$('div.makui_box').SortableDestroy();
		$('div.makui_box').Sortable({
            accept: 'makui_paragraph',
            helperclass: 'sortHelper',
            activeclass : 	'sortableactive',
            hoverclass : 	'sortablehover',
            handle: 'div.makui_edit',
            tolerance: 'pointer',
            onChange : function(ser)
            {
                serial = $.SortSerialize();
                //alert(serial.hash);
                $.ajax({
                    url: '/lavina/paragraphs/move?'+serial.hash
                });
				fixSortable();

            },
            onStart : function()
            {
                $.iAutoscroller.start(this, document.getElementsByTagName('body'));
            },
            onStop : function()
            {
                $.iAutoscroller.stop();
            }
		})
	}



jQuery(document).ready(function($){


    $('div.makui_box').Sortable(
    {
        accept: 'makui_paragraph',
        helperclass: 'sortHelper',
        activeclass : 	'sortableactive',
        hoverclass : 	'sortablehover',
        handle: 'div.makui_edit',
        tolerance: 'pointer',
        onChange : function(ser)
        {
            serial = $.SortSerialize();
            //alert(serial.hash);
            $.ajax({
                url: '/lavina/paragraphs/move?'+serial.hash
            });
            fixSortable();

        },
        onStart : function()
        {
            $.iAutoscroller.start(this, document.getElementsByTagName('body'));
        },
        onStop : function()
        {
            $.iAutoscroller.stop();
        }
    }
    ); //sortable

        
});
