
//mp_action_timer(30);
var timer;

function mpaction_switch_imgs(id){

    clearTimeout(timer);

    $('.spaces:visible').fadeOut('fast',function(){        
        var idi = id.substr( id.length-1   , 1);
        $('#mpaction_controll span').css('text-decoration','none');        
        $('#mpaction_controll span:eq('+ idi +')').css('text-decoration','underline');        
        
        $('#'+id).fadeIn('fast');
    })

}
function mpaction_auto_switch(direction){

       spaces = $('.spaces').get();

       active_id = $('.spaces:visible').attr('id');
       
       id = parseInt(active_id.match(/\d/));

       if(direction == 'right'){
        next = (spaces.length > id) ? (id+1) : 1  ;
       }
       else{
        next = (1 == id) ? (spaces.length): (id - 1)  ;
       }
       
       id_next = 'mpaction_img' + next;
       
       mpaction_switch_imgs(id_next);
       
       timer = setTimeout('mpaction_auto_switch("' +direction+ '")',6000);
}


