if (navigator.userAgent.toLowerCase().indexOf("msie 6") !=- 1) {
  alert("Attenzione: stai utilizzando una vecchia versione di Internet Explorer!\nLa visualizzazione potrebbe non essere corretta.")
}

// inizio preload immagini layout
var myimages=new Array()
function preload(){
	//$$('html')[0].style.visibility='hidden';
  var tot = preload.arguments.length;
  for (i=0;i<tot;i++){
		myimages[i] = new Image();
		//if (i == tot-1) myimages[i].onload = $$('html')[0].style.visibility='visible';
		myimages[i].src = preload.arguments[i];
	}
}

preload("images/bg_box.png",
        "images/bg_menu_rosso.jpg",
        "images/donna.png",
        "images/tit_macroaree.jpg",
        "images/invio.png",
        "images/logo.png",
        "images/logo_unip.png",
        "images/menu_01.png",
        "images/menu_02.png",
        "images/menu_03.png",
        "images/menu_04.png",
        "images/menu_05.png",
        "images/slide/1.jpg",
        "images/slide/2.jpg",
        "images/slide/3.jpg",
        "images/slide/4.jpg",
        "images/sfondo.jpg",
        "images/freccia.png");
// fine preload immagini layout

function effect(obj,speed) {
      if (speed==null) speed = 500;
      if (typeof(obj)=='object') {
          return new Fx.Tween(obj, { duration:speed, transition: 'linear' });
      }
}

function vis(id) { 
    var $H = $(id).scrollHeight + 'px';
    var h = $(id).style.height ? $(id).style.height : '1px';
    if ( h != '1px') {
        effect($(id),300).start('height',$H, '1px');
    } else {
        effect($(id),200).start('height', '1px', $H);
    }
}

document.addEvent( 'domready' , function() {

    if (document.all) {// ............le solite odiose modifiche da fare per Internet Explorer.........
        if ($('box_news')) $('box_news').style.left='20px';
        $('slide').style.left='-14px';
        $('slide').style.top='14px';
        $('slide').style.marginBottom='20px';
    }
      
    DD_roundies.addRule('.smussato', 8);
    DD_roundies.addRule('#menu_rosso', 8);
    DD_roundies.addRule('.minimenu', 4);
    
    SqueezeBox.assign($$('a[rel=boxed]'));

    SqueezeBox.assign($$('a.squeezeboxed'), {
    		parse: 'rel'
    });
    
    //var animationHeader = function () { effect($('menu_rosso'),2000).start('top', '-750px', '-20px'); }
    //var animationHeader = function () { effect($('menu_rosso'),1200).start('opacity', '0', '1'); }
    //    animationHeader.delay(500);
    
    if (document.all) {
        $('contenuti').style.visibility='visible';
        $('IE_fade').style.display='block';
        $('menu_rosso').style.height='750px';
        effect($('IE_fade'),1000).start('opacity', '1', '0');
        var nascondiFade = function(){$('IE_fade').style.display='none';}
            nascondiFade.delay(1500);
    } else {
        effect($('contenuti'),1000).start('opacity', '0', '1');
    }
    
    var animationMenuTop = function () {effect($('menu_top'),1000).start('height', '1px', '46px');}
        animationMenuTop.delay(1200);
     //$('menu_top').style.height='46px';
        
    $$('.menu').addEvent( 'mouseover' , function() {
           effect(this,300).start('margin-left', '0', '15px');
    } );
    $$('.menu').addEvent( 'mouseout' , function() {
           effect(this,300).start('margin-left', '15px', '0');
    } );

    $$('input').addEvent( 'focus' , function() {
           effect(this,200).start('background-color', '#ebe9e9', '#FFCC66');
    } );
    $$('input').addEvent( 'blur' , function() {
           effect(this,200).start('background-color', '#FFCC66', '#ebe9e9');
    } );

    $$('li').addEvent( 'mouseover' , function() {
           effect(this,200).start('margin-left', '0', '6px');
           effect(this,200).start('color', '#aeadad', '#666666');
    } );
    $$('li').addEvent( 'mouseout' , function() {
           effect(this,200).start('margin-left', '6px', '0');
           effect(this,200).start('color', '#666666', '#aeadad');
    } );

    $('submit').addEvent( 'mouseover' , function() {
           effect(this,200).start('left', '0', '2px');
    } );
    $('submit').addEvent( 'mouseout' , function() {
           effect(this,50).start('left', '2px', '0');
    } );
    
} );
