// JavaScript Document

$(function() {            
    $('#ad_1 > img').each(function(i,e){
        rotate($(this),1000,3000,i);
    });
    function rotate(elem1,speed,timeout,i){
        elem1.animate({'marginLeft':'15px','width':'0px'},1000,function(){
            var other;
            if(elem1.parent().attr('id') == 'ad_1')
                other = $('#ad_1').children('img').eq(i);
            else
                other = $('#ad_1').children('img').eq(i);
                other.animate({'marginLeft':'0px','width':'15px'},1000,function(){
                var f = function() { rotate(other,speed,timeout,i) };
				
            });
        });
    }
});