var DhtmL={
   version:"0.1",
   trance: null,
   runner: false,
   runnerId:0,
   cur_el:null,
   cur_pos:-1,
   mark:-1,
  
   addPop: function(p){ 
       var b=document.getElementsByTagName('body')[0];
       b.appendChild(p);   
    },
	
   addRelPop: function(par, pop){    
	   if(isNull(par)) return null;
       par.appendChild(pop);   
    },
 
   removeBodyPop: function(p){ 
       var b=document.getElementsByTagName('body')[0];
       b.removeChild(p);     
   },
   
   doTrance: function(x){
	 if(!isNull(document.getElementById('trance'))) return null;  
	 this.trance=document.createElement('div');
	 this.trance.id='trance';
     var w=document.documentElement.clientWidth;
     var h=document.documentElement.clientHeight;
	 this.trance.innerHTML=".";
     DhtmL.addPop(this.trance);
	 this.trance.style.width=w;
     this.trance.style.height=h;
	 this.trance.style.zIndex=10;
   },
   
   undoTrance: function(){
	 DhtmL.removeBodyPop(this.trance);  
   },
   
   killEl: function(nm){
        if((nm+"").length=0) return null;
	    var victim=document.getElementById(nm);	
	    if(!isNull(victim)){
		   var par=""+victim.parentNode.id;		   
           if(par.length>0) 	   
		      document.getElementById(par).removeChild(document.getElementById(nm));
	    }
   },
  
  slideFromTop: function(el){
    DhtmL.addPop(this.cur_el);
    DhtmL.moveIt();
   },
   
   moveIt: function(e){
      this.cur_pos=this.mark==1?this.cur_pos+5:this.cur_pos-5;
      this.cur_el.style.top=this.cur_pos+'px';      
      if(this.cur_pos<0&&this.cur_pos>-155){
        this.runnerId=setTimeout("DhtmL.moveIt("+e+")", 5);
        this.runner=true;
      }else{
        if(this.mark==0){
          DhtmL.removeBodyPop(this.cur_el);
          switch(e){
            case 1:{User.buildLogin();break;}
            case 2:{User.buildRegister();break;}
            case 3:{User.buildForgot();break;}
          }
        }
      }
   },
   
   stopRunner: function(){
     if(this.runner) clearTimeout(this.runnerId);
     this.runner=false;
   }
}
