looping through child divs and check for a condition.

looping through child divs and check for a condition.

I have this simple code, a condition and action repeated but I am sure there is a way of not repeating my self.

I have tried using .each(), .siblings() and  #layer_wrp > div  in various ways. 

All these layers are nested in a #layer_wrp.

Can anyone advise ?

Thanks

My code:

var $welcome_layer = $("#welcome_layer")

etc......

$(function() {
jQuery.fn.slideRightOut = (function(){
if($welcome_layer.css("margin-left") ==='900px') {
        $(this).css("z-index",-1).stop().animate({ marginLeft: "1800px" }, 1200);
    } else if ($work_layer.css("margin-left") ==='900px'){
        $(this).css("z-index",-1).stop().animate({ marginLeft: "1800px" }, 1200);
        }else if ($diver_layer.css("margin-left") ==='900px'){
        $(this).css("z-index",-1).stop().animate({ marginLeft: "1800px" }, 1200);
    }else if ($robin_layer.css("margin-left") ==='900px'){
        $(this).css("z-index",-1).stop().animate({ marginLeft: "1800px" }, 1200);
    }else if ($other_layer.css("margin-left") ==='900px'){
        $(this).css("z-index",-1).stop().animate({ marginLeft: "1800px" }, 1200);
    }else if ($experi_layer.css("margin-left") ==='900px'){
        $(this).css("z-index",-1).stop().animate({ marginLeft: "1800px" }, 1200);
    }else if ($cool_layer.css("margin-left") ==='900px'){
        $(this).css("z-index",-1).stop().animate({ marginLeft: "1800px" }, 1200);
    }else if ($contact_layer.css("margin-left") ==='900px'){
        $(this).css("z-index",-1).stop().animate({ marginLeft: "1800px" }, 1200);
       }else {
    }
});
});