﻿<!--

    var versionbrowser = "";
    var tipobrowser = "";

    //controlli per i vari browser
    $.each($.browser, function (key, value)
    {
        if (value==true && (key.toLowerCase()=='msie' || key.toLowerCase()=='mozilla' || key.toLowerCase()=='chrome' || key.toLowerCase()=='safari'))
        {
            tipobrowser = key.toLowerCase();
        }
        if (key.toLowerCase().indexOf("version") > -1)  versionbrowser = value;//Number(value);
    });

    $(document).ready(function ()
    {
        var indiceImg = 0;
        var evento;

        if ($('#imgPrincipale').length && arrayImg.length > 0)
        {
            pic = new Image(); 
            pic.onload = function()
            {
                imgVisualizza(); 
            }
            pic.src = arrayImg[indiceImg][0];
        }
        
        function imgVisualizza()
        {
            $("#imgPrincipale").attr("src",arrayImg[indiceImg][0]);
            $("#aimgPrincipale").attr("href",arrayImg[indiceImg][1]);
            $("#imgPrincipale").ready(function ()
            { 
                $("#imgPrincipale").fadeIn(500, function ()
                {
                    //clearTimeout(evento);
                    evento=setTimeout(visualizzaImgSuccessiva, 100);
                });
            });  
        }

        function imgOscura()
        {
            $("#imgPrincipale").fadeOut(500, function () {   imgVisualizza();  });
        }

        function visualizzaImgSuccessiva()
        {
            indiceImg++;
            if (indiceImg >= arrayImg.length) indiceImg = 0;
            pic = new Image(); 
            pic.onload = function()
            {
                evento=setTimeout(imgOscura, 5000); 
            }
            pic.src = arrayImg[indiceImg][0];
        }

        var indiceTesto=-1;
        setTimeout(spostaTesto, 150);
        function spostaTesto()
        {
            var lunghezzaTesto = 35;
            indiceTesto++;
            var testoVisualizzato="";
            if ((indiceTesto+lunghezzaTesto) < testoScorrevole.length)
            {
                testoVisualizzato = testoScorrevole.substring(indiceTesto, indiceTesto+lunghezzaTesto);
            }
            else if (indiceTesto < testoScorrevole.length)
            {
                var differenza = testoScorrevole.length - indiceTesto;
                testoVisualizzato = testoScorrevole.substring(indiceTesto, indiceTesto+differenza) + ' ' + testoScorrevole.substring(0, (lunghezzaTesto - differenza));
            }
            else
            {
                indiceTesto=0;
                testoVisualizzato = testoScorrevole.substring(indiceTesto, indiceTesto+lunghezzaTesto);
            }
            document.getElementById("txtScorr").innerText = testoVisualizzato;
            setTimeout(spostaTesto, 150);
        }

    });

//-->
