﻿var $j=jQuery.noConflict();

$j(document).ready(function(){
    if($j("#colLeft").length && $j("#colRight").length)
    {
        $j("#colLeft").sortable({   connectWith:['#colRight'],
                                    handle:$j('.Col1CateTitle'),
                                    opacity:0.7,
                                    tolerance:'pointer',
                                    helper:'clone',
                                    revert:true,
                                    update:function(){
                                                        var ls = $j('#colLeft').sortable('toArray');
                                                        var rs = $j('#colRight').sortable('toArray');
                                                        
                                                        $j.ajax({   type:"GET",
                                                                    //url:"http://localhost/SGTT/Ajax/SavePersonalizeConfig.aspx",
                                                                    url: "http://118.69.212.144/Ajax/SavePersonalizeConfig.aspx",
                                                                    data:"hcl="+ls+"&hcr="+rs
                                                                });
                                                    }
                                });
                                    
        $j("#colRight").sortable({  connectWith:['#colLeft'],
                                    handle:$j('.Col1CateTitle'),
                                    tolerance:'pointer',
                                    opacity:0.7,
                                    revert:true,
                                    helper:'clone',
                                    update:function(){
                                                        var ls = $j("#colLeft").sortable('toArray');
                                                        var rs = $j("#colRight").sortable('toArray');
                                                        
                                                        $j.ajax({   type:"GET",
                                                                    url: "http://118.69.212.144/Ajax/SavePersonalizeConfig.aspx",
                                                                    data:"hcl="+ls+"&hcr="+rs
                                                                });
                                                        }
                                });
     }

//     if ($j("#colRightR").length) {
//         $j("#colRightR").sortable({ 
//             //connectWith: ['#colLeft'],
//             handle: $j('.Col1CateTitle'),
//             tolerance: 'pointer',
//             opacity: 0.7,
//             revert: true,
//             helper: 'clone',
//             update: function() {
//                 var ls = $j("#colLeft").sortable('toArray');
//                 var rs = $j("#colRight").sortable('toArray');

//                 $j.ajax({ type: "GET",
//                     url: "http://localhost/SGTT/Ajax/SavePersonalizeConfig.aspx",
//                     data: "hcl=" + ls + "&hcr=" + rs
//                 });
//             }
//         });
//     }
    
});