function slideSwitch() {
    var $active = $('#slideshow-box img.active');
    var countimgs=$('#slideshow-box img');
     if ( countimgs.length < 2 ) return;
    if ( $active.length == 0 ) $active = $('#slideshow img:last');
    
    var $next =  $active.next().length ? $active.next()
        : $('#slideshow-box img:first');
    
    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
}

$(function() {
    setInterval( "slideSwitch()", 5000 );
});


function resize_image(image, w, h) {

    if (typeof(image) != 'object') image = document.getElementById(image);

    if (w == null || w == undefined)
        w = (h / image.clientHeight) * image.clientWidth;

    if (h == null || h == undefined)
        h = (w / image.clientWidth) * image.clientHeight;

    image.style['height'] = h + 'px';
    image.style['width'] = w + 'px';
    return;
}
