function Shadow(eid) 
{
 if(!document.getElementById || !document.getElementsByTagName || !document.createElement || !document.appendChild) return;

  this.depth   = 2;   /* border width for each div  */
  this.radius  = -2;  /* from -3 (none) to 1 (rude) */
  this.margin  = 3;   /* space from angles          */

  var obj     = document.getElementById(eid);
  var body    = document.getElementsByTagName('body')[0];

  var left, top;

  var ombra   = new Array();
  var self    = this;

  getDistance = function() {
    left = top = 0;

    for (var tmpObj = obj; tmpObj.offsetParent; tmpObj = tmpObj.offsetParent)
      left += tmpObj.offsetLeft;

    for (var tmpObj = obj; tmpObj.offsetParent; tmpObj = tmpObj.offsetParent)
      top += tmpObj.offsetTop;
  }

  this.draw = function() {

    getDistance();
  
    var idx = 0;

    function placeDiv(offsetleft, offsettop, larghezza, altezza, color) {           
      var resize = false;
	  MSIE = navigator.userAgent.indexOf("MSIE") > 0 ? 1 : 0;
  
      if(typeof ombra[idx] == 'undefined')
        ombra[idx] = document.createElement('div');
      else
        resize = true;

      ombra[idx].style.position = 'absolute';
      
      ombra[idx].style.width   = larghezza + 'px';
      ombra[idx].style.height  = altezza + 'px';
      
      ombra[idx].style.left    = (left + offsetleft) + 'px';
      ombra[idx].style.top     = (top + offsettop) + 'px';
//	  alert(obj.style.zIndex + '-' + ombra[idx].style.zIndex);
      
      ombra[idx].style.borderRight   = self.depth + 'px solid ' + color; 
      ombra[idx].style.borderBottom  = self.depth + 'px solid ' + color; 
      
      if(!resize) el = body.appendChild(ombra[idx]);
      
      idx++;    
    }

    placeDiv(self.depth * 3 + self.margin, self.depth + self.margin,
      obj.offsetWidth - (self.depth + self.margin), obj.offsetHeight - (self.depth + self.margin) - self.radius, '#ddd');

    placeDiv(self.depth + self.margin, self.depth * 3 + self.margin,
      obj.offsetWidth - (self.depth + self.margin) - self.radius, obj.offsetHeight - (self.depth + self.margin), '#ddd');

//    placeDiv(self.depth + self.margin - 1, self.depth + self.margin - 1, 
//      obj.offsetWidth - self.margin + 1, obj.offsetHeight - self.margin + 1, '#bbb');

    if (MSIE) {
	  d = 1;
      placeDiv(self.depth + self.margin - 1 + d, self.depth + self.margin - 1 + d,
        obj.offsetWidth - self.margin + 1+d, obj.offsetHeight - self.margin + 1+d, '#bbb');
      placeDiv(self.depth + self.margin + d, self.depth + self.margin+d,
        obj.offsetWidth - (self.depth + self.margin)+d, obj.offsetHeight - (self.depth + self.margin)+d, '#999');
	} else {
      placeDiv(self.depth + self.margin - 1, self.depth + self.margin - 1, 
        obj.offsetWidth - self.margin + 1, obj.offsetHeight - self.margin + 1, '#bbb');
      placeDiv(self.depth + self.margin, self.depth + self.margin,
        obj.offsetWidth - (self.depth + self.margin), obj.offsetHeight - (self.depth + self.margin), '#999');
	}

    var handler = window.onresize;
    var thisref = self;

    window.onresize = function() {
      if(handler != null && typeof handler != 'undefined')
        handler();
      thisref.draw();
    }

  }   
  return this;
}

//window.onload = function() {
//  shadow = new Shadow('eccomi');
//}

drawShadow = function() {
    shadow.depth  = Number(myForm['depth'].value);
    shadow.margin = Number(myForm['margin'].value);
    shadow.radius = Number(myForm['radius'].value);
    shadow.draw();
    return false;    
}