writeDrag.handleId = "handle";

writeDrag.writeId = "cntnt";

function wrapContent(e, img, w, h, txt, wd, offx, offy) {

  var imgStr, cntnt, win, str;

  imgStr = '<img src="' + img + '"' + (w? ' width="' + w + '"': "") + (h? ' height="' + h + '"': "") + '>';

  if ( dragObj.supported && typeof document.body.innerHTML != "undefined" ) {

    cntnt = '<div class="img">' + imgStr + '</div>';

    if (txt) cntnt += '<div class="msg">' + txt + '</div>';  

    if (!wd) wd = w; 

    writeDrag.set(e, cntnt, wd, offx, offy);

  } else { // non-capable browsers will open sub window

    w = w+80 || wd || 250; h = h+80 || 250; // size

    win = window.open('', 'subwin', 'resizable,width='+w+',height='+h+',left=100,top=100');

    if (win && !win.closed) win.resizeTo(w,h); 

    str = '<html><head><title>Image Display</title></head>';

  	str += '<body style="text-align:center">';

    str += imgStr + (txt? '<p>' + txt + '</p>':"");

  	str += '</body></html>'

  	win.document.write(str);

  	win.document.close();

    if (win && !win.closed) win.focus(); 

  } 

  return false;

}