
function application()
  {
  this.windowLoaded = false;
  this.onLoads = new Array();
  if (window.onload != null)
    {
    this.addOnload(new objfn(window.onload));
    }
//  window.onload = this.triggerOnLoads;
  attachNodeEvent(window, "load", new objfn("triggerOnLoads", this));
//  alert('adding');
  this.dragObject = null;
  }

application.prototype.isDragObjectSet = function()
  {
  return this.dragObject != null;
  }

application.prototype.getDraggedObject = function()
  {
  return this.dragObject;
  }

application.prototype.setDraggedObject = function(dObj)
  {
  this.clearDraggedObject();
  this.dragObject = dObj;
  }

application.prototype.clearDraggedObject = function()
  {
  if (this.dragObject == null)
    {
    return;
    }
  this.dragObject.dropped();
  this.dragObject = null;
  }

application.prototype.addOnload = function(fn)
  {
  if (this.windowLoaded)
    {
    fn.run();
    return;
    }
//  this.onLoads[this.onLoads.length] = fn;
//  attachNodeEvent(window, "load", new objfn("triggerOnLoads", this));
  attachNodeEvent(window, "load", fn);
  }

application.prototype.addOnLoad = function(fn)
  {
  return this.addOnload(fn);
  }

application.prototype.triggerOnLoads = function()
  {
//  alert('hey');
  app.windowLoaded = true;
/*  for(var i = 0; i < app.onLoads.length; i++)
    {
    app.onLoads[i].run();
    }*/
  attachNodeEvent(document.body, "mouseup", new objfn("clearDraggedObject", this))
  }

//alert('s');
if (window.app == null)
  {
  window.app = new application();
  }else
  {
//  alert('2x');
  }
//alert('e');

function applicationDragObject()
  {
  this.heldObj = null;
  this.dropFn = null;
  }

applicationDragObject.prototype.dropped = function()
  {
  if (this.dropFn != null)
    {
    this.dropFn.run(this);
    }
  }
