﻿function pageLoad() {


    var slide = $find('SSBehaviorID');

    slide.add_slideChanging(animateSlides);
    var ae = $find("ae");
    var be = ae.get_OnLoadBehavior();
    var an = be.get_animation();
    fadein = an.get_animations()[1];
    fadeout = an.get_animations()[0];

    fadein.set_duration(0.5);
    fadeout.set_duration(0.5);

}

function animateSlides() {
    fadein.play();
    window.setTimeout("fadeout.play()", 4000);

}

function goToDetails() {
    var id = $find("SSBehaviorID")._slides[$find("SSBehaviorID")._currentIndex].ImagePath;   //get the description 
//    var id = $find("SSBehaviorID")._slides[$find("SSBehaviorID")._currentIndex].Description;   //get the description 
    //go to the target url. 

    location.href=id
//    alert(id)
}

//La funzione blink è da verificare
function blink(id, delay) {
    this.obj = "blinkObj" + blink.count++;
    eval(this.obj + " = this ");
    this.css = (document.getElementById ? document.getElementById(id).style : (document.all ? document.all.fooImg.style : document.layers.fooImg));
    if (!this.css && !document.layers) alert('Errore: non trovo il DIV con id="' + id + '"');
    this.delay = delay || 1000;
    this.blinking = false;

    this.setDelay = function (delay) { this.delay = delay; }

    this.isBlinking = function () { return this.blinking; }

    this.start = function () { if (this.isBlinking()) return false; else this.go(); return true; }

    this.go = function () {
        this.blinking = true;
        if (this.isVisible()) this.hide();
        else this.show();
        this.timer = setTimeout(this.obj + ".go()", this.delay);
    }

    this.isVisible = function () { return (this.css.visibility == "visible" || this.css.visibility == "show"); }

    this.hide = function () { this.css.visibility = (document.layers ? "hide" : "hidden"); }

    this.show = function () { this.css.visibility = (document.layers ? "show" : "visible"); }

    this.stop = function () {
        this.show();
        this.blinking = false;
        clearTimeout(this.timer);
    }
    return this;
}
blink.count = 0;

