function lib_obj(obj,nest)
{ 
  this.evnt=document.getElementById(obj);
  this.css=this.evnt.style; 
  this.ref=document;
  this.x=parseInt(this.css.left);
  this.y=parseInt(this.css.top);
  this.w=this.evnt.offsetWidth;
	this.h=this.evnt.offsetHeight;
	this.z=this.css.zIndex;
  this.c=0 //Clip values
  this.c=this.css.clip; 
	this.c=this.c.slice(5,this.c.length-1); 
  this.c=this.c.split(' ');
  this.obj = obj + "Object";
	eval(this.obj + "=this")
  return this
}

//Moving object to **************
lib_obj.prototype.moveIt = function(x,y){
  this.x=x;
	this.y=y; 
	this.css.left=x;
	this.css.top=y;
}

//Misc ********************
lib_obj.prototype.putWidth = function(w){
	this.w = w;
  this.css.width=w;
}

lib_obj.prototype.putHight = function(h){
	this.h = h;
  this.css.height=h;
}

lib_obj.prototype.putZ = function(z){
	this.z = z;
  this.css.zIndex=z;
}

//Drag drop functions start *******************
dd_is_active=0; 
dd_obj=0; 
dd_mobj=0
function lib_dd(){
  dd_is_active=1;
  document.onmousemove=lib_dd_move;
  document.onmousedown=lib_dd_down;
  document.onmouseup=lib_dd_up;
}
lib_obj.prototype.dragdrop = function(obj){
  if(!dd_is_active) lib_dd();
  this.evnt.onmouseover=new Function("lib_dd_over("+this.obj+")")
  this.evnt.onmouseout=new Function("dd_mobj=0")
  if(obj) this.ddobj=obj;
}
lib_obj.prototype.nodragdrop = function(){
  this.evnt.onmouseover=""; 
	this.evnt.onmouseout="";
	this.evnt.document.onmousemove="";
  dd_obj=0; 
	dd_mobj=0;
	dd_is_active=0; 
}
//Drag drop event functions
function lib_dd_over(obj){dd_mobj=obj}
function lib_dd_up(e){dd_obj=0;}
function lib_dd_down(e){ //Mousedown
  if(dd_mobj){
    x=event.clientX;
    y=event.clientY;
    dd_obj=dd_mobj;
    dd_obj.clX=x-dd_obj.x; 
    dd_obj.clY=y-dd_obj.y;
  }
}

function lib_dd_move(e,y,rresize){ //Mousemove
  x=event.clientX;
  y=event.clientY;
  if(dd_obj){
    nx=x-dd_obj.clX; 
		ny=y-dd_obj.clY;
    if(dd_obj.ddobj) dd_obj.ddobj.moveIt(nx,ny);
    else dd_obj.moveIt(nx,ny);
  }
  return false      
}

function releaseDrop() {
	obj.nodragdrop();
}

function getDrag(div) {
	obj=new lib_obj(div.id)
	obj.dragdrop();
}
//Drag drop functions end *************
