    function toDrag(el,main){this.el=el;this.main=main;}		
	toDrag.prototype={		
		ahhg:function(){
			this.v={x:0,y:0,oX:0,oY:0,init:true},
			this.e={x:this.el.offsetLeft,y:this.el.offsetTop},
			this.m={x:0,y:0}
		},
		init:function(){this.ahhg();
			this.mouseDown();this.mouseUp();
		},
		mouseDown:function(){
			this.el.onmousedown=c$(this,'mouseMove');
			return false; 
		},
		mouseUp:function(){
			this.main.onmouseup=c$(this,'stopMove');		
			this.el.onmouseup=  c$(this,'stopMove');				
		},		
		mouseMove:function(){
			this.setSelect(false);
			this.v.init=true;
			this.main.onmousemove=c$(this,'trackMove');
			return false;
		},
		stopMove:function(){	
		    this.setSelect(true);	
			this.main.onmousemove=null;
		},
		setSelect:function(setr){
		    document.ondragstart=function(){return setr;}; 
		    document.onselectstart=function(){return setr;};  		
		},
		trackMove:function(e){			
			this.getPos(e);						
			this.styleTop(this.el,this.y);
			this.styleLeft(this.el,this.x)
			return false;
		},
		styleTop:function(el,val){el.style.top=val+'px';},
		styleLeft:function(el,val){el.style.left=val+'px';},
		getPos:function(e){					
			this.e=this.getElPos(this.el);	
			this.m=this.getMousePos(e);			
			if(this.v.init)this.setOffset();
			this.y=((this.m.y-this.e.y)+this.el.offsetTop)-this.v.oY;				
			this.x=((this.m.x-this.e.x)+this.el.offsetLeft)-this.v.oX;
		},
		setOffset:function(){
			this.v.oX=this.m.x-this.e.x;
			this.v.oY=this.m.y-this.e.y;
			this.v.init=false;
		},
		getElPos:function(el){		
			var c={x:0,y:0};
			while(el.offsetParent){
				c.x+=el.offsetLeft;
				c.y+=el.offsetTop;
				el=el.offsetParent;
			}return c;						
		},			
		getMousePos:function(event){		
			var e=(window.event)?window.event:event;
			if(e.pageX||e.pageY){return({x:e.pageX,y:e.pageY});}
			else{return({x:e.clientX,y:e.clientY});}			
		}
	};	
