            //configuration - durations in ms
            fade=5000;
            overlay=2000;
            slide=30000;
            slideshowheight=200;
            widths = [];
            aspects = [];

            //do not modify
            aspect=1.33;
            first=true;
            if ($("#slideshow img:last")[0]==undefined) cachecheck = true; else cachecheck = false;

            function animationmain(loops, items, item){
                if (loops==0) {anirunning =false; return;}
                if (loops==-10000) loops=-1;
                $($("#slideshow img")[item-1]).queue(fixsizes).fadeIn(fade, function(){
                    $('.overlay').html($($("#slideshow img")[item-1]).attr('alt')).slideDown(overlay).delay(slide).queue(function(){
                        $('.overlay').dequeue();
                        $('.overlay').slideUp(overlay,function(){
                            $($("#slideshow img")[item+1]).delay().fadeOut(fade);
                            next=item+1;
                            if (item==items) next=1;
                            animationmain(loops-1,items,next);
                        });
                    });
                });
            }

            function animationstart(loops){
                items=$('#slideshow img').length
                if (loops==-1) animationmain(-1,items,1);
                animationmain(loops*items,items,1);
            }

            $(document).ready(function(){
                setTimeout(function(){
                    if ($('#slideshow').height()<2300) slideshowheight=$('#slideshow').height();
                    if ($('#col-two .boxed').width()<2000) $('#slideshow').css('width',$('#col-two .boxed').width());
                    $('.crop').css('width',$('#col-two .boxed').width());
                    $('.crop').css('left',$('#col-two .boxed').offset().left);
                    $('#slideshow img').css('width',$('#col-two .boxed').width());
                    $('.overlay').css('width',$('#col-two .boxed').width()-20);
              //       setTimeout(function(){ if (!anirunning) animationstart(-1);}, 2200 ); //-1 for infinite
                }, 200 );
            });

            

            $(window).resize(function() {
                $('#slideshow').css('width',$('#col-two .boxed').width());
                $('.crop').css('width',$('#col-two .boxed').width());
                $('.crop').css('left',$('#col-two .boxed').offset().left);
                $('#slideshow img').css('width',$('#col-two .boxed').width());
                $('.overlay').css('width',$('#col-two .boxed').width()-20);
                i=0;
                $('#slideshow img').each(function(){
                    i++;
                    //alert(widths[i]);
                    if($(this).width()/$('#slideshow').width()>$(this).height()/$('#slideshow').height()){
                        $(this).css('height',slideshowheight+'px');
                        $(this).css('width',(slideshowheight*aspects[i])+'px');
                        $(this).css('margin-left','-'+($(this).width()-$('#slideshow').width())/2+'px');
                        $(this).css('margin-top','0px');
                    } else {
                        $(this).css('width',$('#slideshow').width()+'px');
                        $(this).css('height',($(this).width()/aspects[i])+'px');
                        $(this).css('margin-top','-'+($(this).height()-$('#slideshow').height())/2+'px');
                        $(this).css('margin-left','0px');
                    }
                });

            });

            function fixsizes(){
//                if (!first) aspect=$(this)[0].width/$(this)[0].height;
//                first = false;
               // alert('fix');
               if (cachecheck) $(this).delay(400);
                if ($(this)[0].width/$('#slideshow').width()>$(this)[0].height/slideshowheight) {
                            $(this).css('height',slideshowheight+'px');
                            $(this).css('width',(slideshowheight*aspect)+'px');
                            $(this).css('margin-left','-'+($(this).width()-$('#slideshow').width())/2+'px');
                } else {
                            $(this).css('width',$('#slideshow').width()+'px');
                            $(this).css('margin-top','-'+($(this).height()-slideshowheight)/2+'px');
                }
                $(this).dequeue();
            }
