function moveMdm(whitch,total){
   //declaring variables
   element_to_move = whitch;
   move_element_by = $("#mdm_item_"+whitch).position().left;



   for(var i=0;i<total;i++){
     if(i == whitch){
         $("#mdm_link"+whitch+" input").removeAttr('class').addClass("button_mdm_over"+whitch);
         $("#mdm_link"+whitch+" input").removeAttr('onmouseover');
         $("#mdm_link"+whitch+" input").removeAttr('onmouseout');
         $("#mdm_link"+whitch+" input").attr('disabled','disabled');
     }else{
         $("#mdm_link"+i+" input").removeAttr('class').addClass("button_mdm"+i);
         $("#mdm_link"+i+" input").removeAttr('disabled');
     }
   }

   //testing if the element_to_move has a positive x
   if(move_element_by > 0){

     for(var i=0;i<total;i++){
        //animate all
        $("#mdm_item_"+i).animate({
        left: '-='+(0+move_element_by)
        }, 1000, function() {
        // Animation complete.
        });
      }
   //do this if the element_to_move has a negativ x
   }else{

     for(var i=0;i<total;i++){
        //animate all
        $("#mdm_item_"+i).animate({
        left: '+='+(0-move_element_by)
        }, 1000, function() {
        // Animation complete.

        });
      }
   }
}

$(document).ready(function () {
  moveMdm(0,3)
})

