/*
Use jool v0.9.0.8
This code ©2010 Giovanni Di Gregorio All Rights Reserved
Every intellectual property reserved.

Wed Sep  8 03:52:52 2010
*/

j.domready(function() {

    var splash;
    var splashbkg;
    var splashtxt;
    var sender;

    splashSwap = j.fx({
        duration: 200,
        easing: 'expoOut',
        fps: 60,
        next:
        j.script({
            code: 'movePhotoHeader.play()'
        })
    });
    splashSwap2 = j.fx({
        duration: 200,
        fps: 60,
        easing: 'expoOut'
    });
    splashSwapBkg = j.fx({
        duration: 200,
        fps: 60,
        easing: 'expoOut'
    });
    splashSwapBkg2 = j.fx({
        duration: 200,
        fps: 60,
        easing: 'expoOut'
    });
    splashSwapText = j.fx({
        duration: 200,
        fps: 60,
        easing: 'expoOut'
    });
    splashSwapText2 = j.fx({
        duration: 200,
        fps: 60,
        easing: 'expoOut'
    });
    movePhotoHeader = j.fx({
        object: ['#header-photo'],
        duration: 400,
        fps: 60,
        easing: 'quadOut'
    });

    j.event.add({
        object: j.$('.button-menu'),
        event: 'mouseover',
        action: function(e) {
            splash = '#splash-' + target.id;
            splashbkg = '#splash-' + target.id + '-background';
            splashtxt = '#news-header-' + target.id;
            sender = target.id;

            $$('header-link-cronaca').style.visibility = 'hidden';
            $$('header-link-politica').style.visibility = 'hidden';
            $$('header-link-sport').style.visibility = 'hidden';
            $$('header-link-cultura').style.visibility = 'hidden';
            $$('header-link-economia').style.visibility = 'hidden';

            if (sender == 'cronaca') {
                movePhotoHeader.marginTop = [0];
                $$('header-link-cronaca').style.visibility = 'visible';
            }
            if (sender == 'politica') {
                movePhotoHeader.marginTop = [ - 190];
                $$('header-link-politica').style.visibility = 'visible';
            }
            if (sender == 'sport') {
                movePhotoHeader.marginTop = [ - 380];
                $$('header-link-sport').style.visibility = 'visible';
            }
            if (sender == 'cultura') {
                movePhotoHeader.marginTop = [ - 570];
                $$('header-link-cultura').style.visibility = 'visible';
            }
            if (sender == 'economia') {
                movePhotoHeader.marginTop = [ - 760];
                $$('header-link-economia').style.visibility = 'visible';
            }

            splashSwap.object = [splash];
            splashSwap.opacity = [100];
            splashSwap.play();
            splashSwap2.object = j.$('.splash');
            splashSwap2.except = splash;
            splashSwap2.opacity = [0];
            splashSwap2.play();

            splashSwapBkg.object = [splashbkg];
            splashSwapBkg.opacity = [100];
            splashSwapBkg.play();
            splashSwapBkg2.object = j.$('.splash-background');
            splashSwapBkg2.except = splashbkg;
            splashSwapBkg2.opacity = [0];
            splashSwapBkg2.play();

            splashSwapText.object = [splashtxt];
            splashSwapText.opacity = [100];
            splashSwapText.play();
            splashSwapText2.object = j.$('.news-header');
            splashSwapText2.except = splashtxt;
            splashSwapText2.opacity = [0];
            splashSwapText2.play();

        }
    });

})
