防百度的个性化页面JS
    花了好长时间整的JS,个性化页面拖曳功能
$(document).ready(function() {
 if (typeof(console) == 'undefined') {
  console = {
   debug : function() {
   }
  }
 }
 var cmd = console;
 var sDrag = $('#sampleDivForDrag');
 var fDrag = $('#fordrag'); // proxy
 $("div", $("#lay_tab")).each(function() {
  if ($(this).attr("id")) {
   $(this).click(function() {
    $("div", $("#lay_tab")).each(function() {
     $(this).removeClass('on')
    });
    var id = $(this).attr("id");
    if (id == 'lay2') {
     $('#layout >tbody >tr >td').each(function(i) {
      $(this).attr('id', 'modtd2_' + i);
      $(this).attr('class', 'c2t' + (i + 1) + ' lay2td' + i);
     });
    } else if (id == 'lay5') {
     $('#layout >tbody >tr >td').each(function(i) {
      $(this).attr('id', 'modtd4_' + i);
      $(this).attr('class', 'c3t' + (i + 1) + ' lay5td' + i);
     });
    } else if (id == 'lay4') {
     $('#layout >tbody >tr >td').each(function(i) {
      $(this).attr('id', 'modtd4_' + i);
      $(this).attr('class', 'c3t' + (i + 1) + ' lay4td' + i);
     });
    } else if (id == 'lay3') {
     $('#layout >tbody >tr >td').each(function(i) {
      $(this).attr('id', 'modtd_' + i);
      $(this).attr('class', 'c2t' + (i + 1) + ' lay3td' + i);
     });
     // $('#modtd_0').addClass('c2t1 lay2td0')
    } else if (id == 'lay1') {
     $('#layout >tbody >tr >td').each(function(i) {
      $(this).attr('id', 'modtd_' + i);
      $(this).attr('class', 'c2t' + (i + 1) + ' lay1td' + i);
     });
     // $('#modtd_0').addClass('c2t1 lay2td0')
    } else if (id == 'lay0') {
     $('#layout >tbody >tr >td').each(function(i) {
      $(this).attr('id', 'modtd_' + i);
      $(this).attr('class', 'c1t' + (i + 1) + ' lay0td' + i);
     });
     // $('#modtd_0').addClass('c2t1 lay2td0')
    }
    $(this).addClass("on");
   });
  }
 });
 // return;
 var model = $("div[rel]='drag'");
 var rels = {};
 var tds = {};
 cmd.debug(model);
 $.each(model, function() {
  var tar = $(this);
  $(this).find('table:first').each(function() {   
   $(this).drag("init", function() {
    $('#layout >tbody >tr >td:visible').each(function(i) {
     var id = $(this).attr('class');
     p = $(this).offset();
     tds[id] = jQuery.extend(p, {
      w : $(this).width(),
      h : $(this).height()
     });
     $(this).css('background-color',i+'f666'+i);
    });
    $("div[rel]='drag':visible").each(function() {
  &n