function DropShadow(DivRef)
{
	this.div = document.createElement('div');
    this.div.style.position="absolute";
    this.div.style.top='0px';
    this.div.style.right='0px';
    if (typeof this.div.style.filter=='undefined') {
      new Image().src = "/images/shadow.png";
      new Image().src = "/images/shadow_ur.png";
      new Image().src = "/images/shadow_ll.png";
      this.createShadow();
      this.offset=5;
    } else {
      this.div.style.backgroundColor='#888';
      this.div.style.filter='progid:DXImageTransform.Microsoft.Blur(makeShadow=1, shadowOpacity=0.3, pixelRadius=3)';
      this.offset=0; // MS blur filter already does offset
    }
    this.div.style.display = "none";
	this.DivRef=jQuery('#'+DivRef);
    this.DivRef.parent().append(this.div);
    
}

DropShadow.prototype = {
  createShadow: function() {
    var tab = document.createElement('table');
    tab.style.height='100%';
    tab.style.width='100%';
    tab.cellSpacing=0;
    tab.dir='ltr';

    var tr1=tab.insertRow(-1);
    tr1.style.height='8px';
    var td11=tr1.insertCell(-1);
    td11.style.width='8px';
    var td12=tr1.insertCell(-1);
    td12.style.background="transparent url(/images/shadow_ur.png) no-repeat right bottom"

    var tr2=tab.insertRow(-1);
    var td21=tr2.insertCell(-1);
    td21.style.background="transparent url(/images/shadow_ll.png) no-repeat right bottom"
    var td22=tr2.insertCell(-1);
    td22.style.background="transparent url(/images/shadow.png) no-repeat right bottom"

    this.div.appendChild(tab);
  },

  hide: function() {
    this.div.style.display = "none";
  },

  move: function() {
	  var pos = this.DivRef.position();
	  var top = pos.top;
	  var left = pos.left;
    this.div.style.top  = (parseInt(top || '0')+this.offset)+'px';
    this.div.style.left = (parseInt(left || '0')+this.offset)+'px';
  },

  show: function() {
    this.div.style.width = this.DivRef.width() + 'px';
    this.div.style.height= this.DivRef.height() + 'px';
    this.move();
    this.div.style.zIndex= parseInt(this.DivRef.css('z-index')) - 1;
    this.div.style.display = "block";
  }
}


