function class_automove(){


    var begin_top=null;
    var begin_left=null;
    
    var ende_top;
    
    var end_top=null;
    var end_left=null;
    
    var richtung=null;

    //intervallobjekt
    var aktiv = null;
    //intervallobjekt fuer object move
    var aktiv1 = null;
    
    var zaehler=1;

    //führe schleife 100 mal durch
    var schrittweite=100;

    //verschiebe um step-pixel
    var step=2;
    
    //intervalllänge in millisekunden
    var timeintervall=1;
   
    this.init=function(obj){
        
        richtung=obj.id;

        if(!aktiv){
            //intervallobjekt starten / funktionsanme/länge
            aktiv = window.setInterval("window.my_automove.move()",timeintervall); 

            window.no_drag=false;
        }
        return;

    }
    
    this.init_obj_move=function(top,left,idx,obj){

        end_top=parseInt(container_height/2)-top;
        end_left=parseInt(container_width/2)-left;

        if(!aktiv1){
            //intervallobjekt starten / funktionsanme/länge
            aktiv1 = window.setInterval("window.my_automove.move_to_obj("+idx+")",timeintervall);

            window.no_drag=false;
        }
        return;

    }
    
    this.get_begin_move_coords=function(){
        begin_top=window.map_top;
        begin_left=window.map_left;
        return;
    }
    this.move_to_obj=function(idx){

        if(window.map_top>end_top){
            window.map_top=parseInt(window.map_top-step);
        }
        else if(window.map_top<end_top){
            window.map_top=parseInt(window.map_top+step);
        }
        else if(window.map_top==end_top){
            window.map_top=parseInt(window.map_top);
        }

        if(window.map_left>end_left){
            window.map_left=parseInt(window.map_left-step);
        }
        else if(window.map_left<end_left){
            window.map_left=parseInt(window.map_left+step);
        }
        else if(window.map_left==end_left){
            window.map_left=parseInt(window.map_left);
        }

        window.map_coords.set_coords();

        if((Math.abs(window.map_left-end_left)<2) && (Math.abs(window.map_top-end_top)<2)){
            window.clearInterval(aktiv1);
            aktiv1=null;
            window.no_drag=true;
            window.mapbuilder.validate_scope(window.map_main);

            window.my_kat_controller.blinker(idx);
        }
    }
    this.move=function(){

        if(richtung=='r_nw'){
            window.map_top=window.map_top+step;
            window.map_left=window.map_left-step;
        }
        else if(richtung=='r_n'){
            window.map_top=window.map_top+step;

        }
        else if(richtung=='r_no'){
            window.map_top=window.map_top+step;
            window.map_left=window.map_left+step;
        }
        else if(richtung=='r_w'){
            window.map_left=window.map_left+step;
        }
        else if(richtung=='r_o'){
            window.map_left=window.map_left-step;
        }
        else if(richtung=='r_sw'){
            window.map_top=window.map_top-step;
            window.map_left=window.map_left+step;
        }
        else if(richtung=='r_s'){
             window.map_top=window.map_top-step;
        }
        else if(richtung=='r_so'){
            window.map_top=window.map_top-step;
            window.map_left=window.map_left-step;
        }

        window.map_coords.set_coords();

        zaehler++;

        if(zaehler>=schrittweite){
            window.clearInterval(aktiv);
            aktiv=null;
            zaehler=1;
            window.no_drag=true;
            window.mapbuilder.validate_scope(window.map_main);

        }
    }
}