// JavaScript Document
jQuery(function(){
	jQuery(".m_title").bind('mouseover',function(){
		jQuery(this).css("cursor","move")
	});
	
    var $show = jQuery("#loader"); //进度条
    var $orderlist = jQuery("#orderlist");
	var $list = jQuery("#module_list");
	
	$list.sortable({
		opacity: 0.6,
		revert: true,
		cursor: 'move',
		handle: '.m_title',
		update: function(){
			 var new_order = [];
             $list.children(".modules").each(function() {
                new_order.push(this.title);
             });
			 var newid = new_order.join(',');
			 var oldid = $orderlist.val();
			 jQuery.ajax({
                type: "post",
                url: "update.php",
                data: { id: newid, order: oldid },   //id:新的排列对应的ID,order：原排列顺序
                beforeSend: function() {
                     $show.html("<img src='images/load.gif' /> 正在更新");
                },
                success: function(msg) {
                     //alert(msg);
					 $show.html("");
                }
             });
		}
	});
});