var textBox = document.getElementById("textBox");
var handleRight = document.getElementById("handleRight");
var handleCorner = document.getElementById("handleCorner");
var handleBottom = document.getElementById("handleBottom");
var textDiv = document.getElementById("textDiv");
var myApplet = document.getElementById("myApplet");
var myAppletInner = document.getElementById("myAppletInner");

new dragObject(handleRight, null, new Position(55, 0), new Position(1500, 0), null, RightMove, null, false);
new dragObject(handleBottom, null, new Position(0, 55), new Position(0, 1500), null, BottomMove, null, false);
new dragObject(handleCorner, null, new Position(55, 55), new Position(1500, 1500), null, CornerMove, null, false);

function BottomMove(newPos, element)
{
  DoHeight(newPos.Y, element);
}

function RightMove(newPos, element)
{
  DoWidth(newPos.X, element);
}

function CornerMove(newPos, element)
{
  DoHeight(newPos.Y, element);
  DoWidth(newPos.X, element);
}

function DoHeight(y, element)
{
  textDiv.style.height = (y + 5) + 'px';

  if(element != handleCorner)
    handleCorner.style.top = y + 'px';

  handleRight.style.height = y + 'px';

  if(element != handleBottom)
    handleBottom.style.top = y + 'px';
  
  textBox.style.height = (y - 5) + 'px';
  
  document.myApplet.height = y;
  myApplet.style.height = y + 'px';
  myAppletInner.style.height = y + 'px';
 
}

function DoWidth(x, element)
{
  textDiv.style.width =  (x + 5) + 'px';

  if(element != handleCorner)
    handleCorner.style.left = x + 'px';

  if(element != handleRight)
    handleRight.style.left = x + 'px';

  handleBottom.style.width = x + 'px';

  textBox.style.width = (x - 5) + 'px';
  document.myApplet.width = x - 5;
  myApplet.style.width = x + 'px';
  myAppletInner.style.width = x + 'px';
 
}

