﻿
var intervallo;

function slideSwitch() {
    var $active = $('#slideshow div.active');

    if ($active.length == 0) $active = $('#slideshow div:last');
    var $next = $active.next().length ? $active.next()
        : $('#slideshow div:first');


    $active.addClass('last-active');

    $next.css({ opacity: 0.0 })
        .addClass('active')
        .animate({ opacity: 1.0 }, 1000, function () {
            $active.removeClass('active last-active');
        });
}

function slideSwitch2($i) {
    var $active = $('#slideshow div.active');

    if ($active.length == 0) $active = $('#slideshow div:last');

    $newbox = '#slideshow div.box' + $i;
    var $next = $($newbox);
    $active.addClass('last-active');

    $next.css({ opacity: 0.0 })
        .addClass('active')
        .animate({ opacity: 1.0 }, 1000, function () {
            $active.removeClass('active last-active');
            clearInterval(intervallo);
            intervallo = setInterval("slideSwitch()", 5000);

        });
}





$(document).ready(function () {
    if ((navigator.userAgent.indexOf('iPhone') != -1) || (navigator.userAgent.indexOf('iPod') != -1) || (navigator.userAgent.indexOf('iPad') != -1)) {
        intervallo=setInterval( "slideSwitch()", 5000 );
    }
    else {
        var flashvars = {
    };
    var params = {
        wmode: "window",
        allowScriptAccess: "sameDomain",
        allowFullScreen: "false",
        quality: "high",
        bgcolor: "#f16530",
        play: "true",
        loop: "true",
        scale: "showall",
        menu: "false",
        devicefont: "false"
    };
    var attributes = {
        id: "BannerFlash",
        name: "BannerFlash"
    }
    swfobject.embedSWF("http://www.aiporicerche.it/aiporicerche/_swf/BannerFlash.swf", "slideshow", "417", "150", "9.1.0", "/js/expressInstall.swf", flashvars, params, attributes);
}
});


